- 修复 GBase BIGSERIAL 自增问题;#1919

This commit is contained in:
2881099
2024-11-12 11:48:14 +08:00
parent 233990dfb5
commit 8f25e50ad6
2 changed files with 4 additions and 3 deletions

View File

@@ -313,7 +313,8 @@ namespace FreeSql.Internal
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))
{

View File

@@ -49,8 +49,8 @@ namespace FreeSql.GBase.Curd
{
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);