Skip to content

Commit 96f3957

Browse files
2881028810
authored andcommitted
- 修复 Oracle 导航属性 表别名过长的问题;
1 parent 7796cd1 commit 96f3957

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Providers/FreeSql.Provider.Odbc/Oracle/Curd/OdbcOracleSelect.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,13 @@ internal static string ToSqlStatic(CommonUtils _commonUtils, CommonExpression _c
121121
sbnav.Clear();
122122
if (tbUnionsGt0) sb.Append(") ftb");
123123
}
124-
return sb.Append(_tosqlAppendContent).ToString();
124+
var sql = sb.Append(_tosqlAppendContent).ToString();
125+
126+
var aliasGreater30 = 0;
127+
foreach (var tb in _tables)
128+
if (tb.Alias.Length > 30) sql = sql.Replace(tb.Alias, $"than30_{aliasGreater30++}");
129+
130+
return sql;
125131
}
126132

127133
public OdbcOracleSelect(IFreeSql orm, CommonUtils commonUtils, CommonExpression commonExpression, object dywhere) : base(orm, commonUtils, commonExpression, dywhere) { }

Providers/FreeSql.Provider.Oracle/Curd/OracleSelect.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,13 @@ internal static string ToSqlStatic(CommonUtils _commonUtils, CommonExpression _c
121121
sbnav.Clear();
122122
if (tbUnionsGt0) sb.Append(") ftb");
123123
}
124-
return sb.Append(_tosqlAppendContent).ToString();
124+
var sql = sb.Append(_tosqlAppendContent).ToString();
125+
126+
var aliasGreater30 = 0;
127+
foreach (var tb in _tables)
128+
if (tb.Alias.Length > 30) sql = sql.Replace(tb.Alias, $"than30_{aliasGreater30++}");
129+
130+
return sql;
125131
}
126132

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

0 commit comments

Comments
 (0)