Skip to content

Commit

Permalink
- 修复 Oracle 导航属性 表别名过长的问题;
Browse files Browse the repository at this point in the history
  • Loading branch information
28810 authored and 28810 committed Feb 25, 2020
1 parent 7796cd1 commit 96f3957
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,13 @@ internal static string ToSqlStatic(CommonUtils _commonUtils, CommonExpression _c
sbnav.Clear();
if (tbUnionsGt0) sb.Append(") ftb");
}
return sb.Append(_tosqlAppendContent).ToString();
var sql = sb.Append(_tosqlAppendContent).ToString();

var aliasGreater30 = 0;
foreach (var tb in _tables)
if (tb.Alias.Length > 30) sql = sql.Replace(tb.Alias, $"than30_{aliasGreater30++}");

return sql;
}

public OdbcOracleSelect(IFreeSql orm, CommonUtils commonUtils, CommonExpression commonExpression, object dywhere) : base(orm, commonUtils, commonExpression, dywhere) { }
Expand Down
8 changes: 7 additions & 1 deletion Providers/FreeSql.Provider.Oracle/Curd/OracleSelect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,13 @@ internal static string ToSqlStatic(CommonUtils _commonUtils, CommonExpression _c
sbnav.Clear();
if (tbUnionsGt0) sb.Append(") ftb");
}
return sb.Append(_tosqlAppendContent).ToString();
var sql = sb.Append(_tosqlAppendContent).ToString();

var aliasGreater30 = 0;
foreach (var tb in _tables)
if (tb.Alias.Length > 30) sql = sql.Replace(tb.Alias, $"than30_{aliasGreater30++}");

return sql;
}

public OracleSelect(IFreeSql orm, CommonUtils commonUtils, CommonExpression commonExpression, object dywhere) : base(orm, commonUtils, commonExpression, dywhere) { }
Expand Down

0 comments on commit 96f3957

Please sign in to comment.