Skip to content

Commit

Permalink
- 修复 Xugu DataType 对应问题;#1934
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Nov 29, 2024
1 parent ccd13ba commit cfb3bfa
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions Extensions/FreeSql.Extensions.ZeroEntity/ZeroDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ void LocalAdd(TableInfo table, T data, bool isCheck, ColumnInfo[] _tableReturnCo
case DataType.ShenTong:
case DataType.DuckDB:
case DataType.Firebird: //firebird 只支持单条插入 returning
case DataType.Xugu:
if (_tableIdentitys.Length == 1 && _tableReturnColumns.Length == 1)
{
var idtval = OrmInsert(table).AppendData(data).ExecuteIdentity();
Expand Down
1 change: 1 addition & 0 deletions FreeSql.DbContext/DbSet/DbSetAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ async Task AddPrivAsync(TEntity data, bool isCheck, CancellationToken cancellati
case DataType.ShenTong:
case DataType.DuckDB:
case DataType.Firebird: //firebird 只支持单条插入 returning
case DataType.Xugu:
if (_tableIdentitys.Length == 1 && _tableReturnColumns.Length == 1)
{
await DbContextFlushCommandAsync(cancellationToken);
Expand Down
1 change: 1 addition & 0 deletions FreeSql.DbContext/DbSet/DbSetSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void AddPriv(TEntity data, bool isCheck)
case DataType.ShenTong:
case DataType.DuckDB:
case DataType.Firebird: //firebird 只支持单条插入 returning
case DataType.Xugu:
if (_tableIdentitys.Length == 1 && _tableReturnColumns.Length == 1)
{
DbContextFlushCommand();
Expand Down
3 changes: 3 additions & 0 deletions FreeSql/Extensions/FreeSqlGlobalExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,7 @@ WHERE @cte_ids IS NOT NULL
case DataType.Firebird:
case DataType.ClickHouse:
case DataType.DuckDB:
case DataType.Xugu:
sql1ctePath = select._commonExpression.ExpressionWhereLambda(select._tables, select._tableRule,
Expression.Call(typeof(Convert).GetMethod("ToString", new Type[] { typeof(string) }), pathSelector?.Body), select._diymemexpWithTempQuery, null, null);
break;
Expand Down Expand Up @@ -847,6 +848,7 @@ WHERE @cte_ids IS NOT NULL
case DataType.CustomMySql:
case DataType.Firebird:
case DataType.DuckDB:
case DataType.Xugu:
nsselsb.Append("RECURSIVE ");
break;
}
Expand Down Expand Up @@ -900,6 +902,7 @@ public static TSelect OrderByRandom<TSelect, T1>(this ISelect0<TSelect, T1> that
case DataType.KingbaseES:
case DataType.ShenTong:
case DataType.DuckDB:
case DataType.Xugu:
return that.OrderBy("random()");
case DataType.Oracle:
case DataType.OdbcOracle:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ public TSelect ForUpdate(bool noawait = false)
case DataType.OdbcPostgreSQL:
case DataType.CustomPostgreSQL:
case DataType.KingbaseES:
case DataType.Xugu:
_tosqlAppendContent = $"{_tosqlAppendContent} for update{(noawait ? " nowait" : "")}";
break;
case DataType.Oracle:
Expand Down
2 changes: 2 additions & 0 deletions FreeSql/Internal/CommonProvider/UpdateJoinProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public void ValidateDataType(Action InterceptSqlServer, Action InterceptMySql, A
case DataType.KingbaseES:
case DataType.ShenTong:
case DataType.DuckDB:
case DataType.Xugu:
InterceptPostgreSQL?.Invoke(); break;
case DataType.Oracle:
case DataType.OdbcOracle:
Expand Down Expand Up @@ -216,6 +217,7 @@ public IUpdateJoin<T1, T2> SetIf(bool condition, Expression<Func<T1, T2, bool>>
case DataType.CustomPostgreSQL:
case DataType.KingbaseES:
case DataType.ShenTong:
case DataType.Xugu:
break;
default:
var tbalias = _query2Provider._tables.Where(tb => tb.Table == col.Table).FirstOrDefault()?.Alias ?? _query2Provider._tables[0].Alias;
Expand Down
1 change: 1 addition & 0 deletions FreeSql/Internal/CommonProvider/UpdateProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@ public virtual void ToSqlExtension110(StringBuilder sb, bool isAsTableSplited)
case DataType.CustomPostgreSQL:
case DataType.KingbaseES:
case DataType.ShenTong:
case DataType.Xugu:
vcvalue = $"{_tableAlias}.{vcname}"; //set name = b.name
break;
default:
Expand Down
4 changes: 3 additions & 1 deletion FreeSql/Internal/UtilsExpressionTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ public static ColumnInfo ColumnAttributeToInfo(TableInfo trytb, object entityDef
case DataType.CustomPostgreSQL:
case DataType.KingbaseES:
case DataType.ShenTong:
case DataType.Xugu:
if (strlen < 0) colattr.DbType = $"TEXT{strNotNull}";
else colattr.DbType = Regex.Replace(colattr.DbType, charPattern, m =>
replaceCounter++ == 0 ? $"{m.Groups[1].Value}({strlen})" : m.Groups[0].Value);
Expand Down Expand Up @@ -470,7 +471,8 @@ public static ColumnInfo ColumnAttributeToInfo(TableInfo trytb, object entityDef
case DataType.CustomPostgreSQL:
case DataType.KingbaseES:
case DataType.ShenTong: //驱动引发的异常:“System.Data.OscarClient.OscarException”(位于 System.Data.OscarClient.dll 中)
colattr.DbType = $"BYTEA{strNotNull}"; //变长二进制串
case DataType.Xugu:
colattr.DbType = $"BYTEA{strNotNull}"; //变长二进制串
break;
case DataType.Oracle:
case DataType.OdbcOracle:
Expand Down

0 comments on commit cfb3bfa

Please sign in to comment.