Skip to content

Commit

Permalink
- 修复 GBase BIGSERIAL 自增问题;#1919
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Nov 12, 2024
1 parent 233990d commit 8f25e50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion FreeSql/Internal/UtilsExpressionTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ public static ColumnInfo ColumnAttributeToInfo(TableInfo trytb, object entityDef
if (colType == typeof(int) || colType == typeof(uint))
colattr.DbType = "SERIAL";
else if (colType == typeof(long) || colType == typeof(ulong))
colattr.DbType = "SERIAL8";
colattr.DbType = colattr.DbType.IndexOf("BIGSERIAL", StringComparison.OrdinalIgnoreCase) != -1 ?
"BIGSERIAL" : "SERIAL8"; //#1919
}
if (colattr.MapType.NullableTypeOrThis() == typeof(DateTime))
{
Expand Down
4 changes: 2 additions & 2 deletions Providers/FreeSql.Provider.GBase/Curd/GBaseInsert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ protected override long RawExecuteIdentity()
{
if (identityType == typeof(int) || identityType == typeof(uint)) identitySql = "SELECT dbinfo('sqlca.sqlerrd1') FROM dual";
else if (identityType == typeof(long) || identityType == typeof(ulong)) identitySql =
identityCol.Attribute.DbType.IndexOf("bigserial", StringComparison.OrdinalIgnoreCase) != -1 ?
"SELECT dbinfo('bigserial') FROM dual" : "SELECT dbinfo('serial8') FROM dual";
identityCol.Attribute.DbType.IndexOf("bigserial", StringComparison.OrdinalIgnoreCase) != -1 ?
"SELECT dbinfo('bigserial') FROM dual" : "SELECT dbinfo('serial8') FROM dual";
}
var before = new Aop.CurdBeforeEventArgs(_table.Type, _table, Aop.CurdType.Insert, string.Concat(sql, $"; {identitySql};"), _params);
_orm.Aop.CurdBeforeHandler?.Invoke(this, before);
Expand Down

0 comments on commit 8f25e50

Please sign in to comment.