Skip to content

Commit

Permalink
DaMeng自增长返回,不满足reg_SEQ,则使用Select @@Identity
Browse files Browse the repository at this point in the history
  • Loading branch information
ligengrong committed Nov 19, 2024
1 parent b12c37a commit b5fec5f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions XCode/DataAccessLayer/Database/DaMeng.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ public override Int64 InsertAndGetIdentity(String sql, CommandType type = Comman
var m = reg_SEQ.Match(sql);
if (m != null && m.Success && m.Groups != null && m.Groups.Count > 0)
rs = ExecuteScalar<Int64>($"Select {m.Groups[1].Value}.currval From dual");
else
rs = ExecuteScalar<Int64>("Select @@Identity");
}
Commit();
return rs;
Expand Down Expand Up @@ -253,6 +255,8 @@ public override async Task<Int64> InsertAndGetIdentityAsync(String sql, CommandT
var m = reg_SEQ.Match(sql);
if (m != null && m.Success && m.Groups != null && m.Groups.Count > 0)
rs = await ExecuteScalarAsync<Int64>($"Select {m.Groups[1].Value}.currval From dual");
else
rs = await ExecuteScalarAsync<Int64>("Select @@Identity");
}
Commit();
return rs;
Expand Down

0 comments on commit b5fec5f

Please sign in to comment.