Skip to content

Commit b5fec5f

Browse files
committed
DaMeng自增长返回,不满足reg_SEQ,则使用Select @@Identity
1 parent b12c37a commit b5fec5f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

XCode/DataAccessLayer/Database/DaMeng.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ public override Int64 InsertAndGetIdentity(String sql, CommandType type = Comman
218218
var m = reg_SEQ.Match(sql);
219219
if (m != null && m.Success && m.Groups != null && m.Groups.Count > 0)
220220
rs = ExecuteScalar<Int64>($"Select {m.Groups[1].Value}.currval From dual");
221+
else
222+
rs = ExecuteScalar<Int64>("Select @@Identity");
221223
}
222224
Commit();
223225
return rs;
@@ -253,6 +255,8 @@ public override async Task<Int64> InsertAndGetIdentityAsync(String sql, CommandT
253255
var m = reg_SEQ.Match(sql);
254256
if (m != null && m.Success && m.Groups != null && m.Groups.Count > 0)
255257
rs = await ExecuteScalarAsync<Int64>($"Select {m.Groups[1].Value}.currval From dual");
258+
else
259+
rs = await ExecuteScalarAsync<Int64>("Select @@Identity");
256260
}
257261
Commit();
258262
return rs;

0 commit comments

Comments
 (0)