Skip to content

Commit

Permalink
- 修复 Xugu Insert + AsTable + ExecuteIdentity bug;
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Nov 1, 2023
1 parent af23578 commit 448b25c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 114 deletions.
98 changes: 0 additions & 98 deletions FreeSql/FreeSql.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 4 additions & 16 deletions Providers/FreeSql.Provider.Xugu/Curd/XuguInsert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected override long RawExecuteIdentity()
//using (var command = cmd.Connection.CreateCommand()) {
//command.CommandType = CommandType.Text;
var sqlIdentity = $"SELECT {_commonUtils.QuoteSqlName(identCols.First().Value.Attribute.Name)} FROM {_table.DbName} WHERE \"ROWID\"='{rowid}'";
var sqlIdentity = $"SELECT {_commonUtils.QuoteSqlName(identCols.First().Value.Attribute.Name)} FROM {_commonUtils.QuoteSqlName(TableRuleInvoke())} WHERE \"ROWID\"='{rowid}'";
//command.CommandText = sql;
Expand Down Expand Up @@ -91,11 +91,6 @@ protected override long RawExecuteIdentity()

protected override List<T1> RawExecuteInserted()
{





var sql = this.ToSql();
if (string.IsNullOrEmpty(sql)) return null;

Expand All @@ -119,7 +114,7 @@ protected override List<T1> RawExecuteInserted()
{
var rowid = (cmd as XGCommand).get_insert_rowid();
var sqlIdentity = $"SELECT {sbColumn} FROM {_table.DbName} WHERE \"ROWID\"='{rowid}'";
var sqlIdentity = $"SELECT {sbColumn} FROM {_commonUtils.QuoteSqlName(TableRuleInvoke())} WHERE \"ROWID\"='{rowid}'";
ret = _orm.Ado.Query<T1>(_table.TypeLazy ?? _table.Type, _connection, _transaction, CommandType.Text, sqlIdentity, _commandTimeout, _params);
Expand Down Expand Up @@ -147,8 +142,6 @@ protected override List<T1> RawExecuteInserted()

async protected override Task<long> RawExecuteIdentityAsync(CancellationToken cancellationToken = default)
{


var sql = this.ToSql();
if (string.IsNullOrEmpty(sql)) return 0;

Expand All @@ -170,7 +163,7 @@ async protected override Task<long> RawExecuteIdentityAsync(CancellationToken ca
await _orm.Ado.ExecuteNonQueryAsync(_connection, _transaction, CommandType.Text, sql, _commandTimeout, cmd =>
{
var rowid = (cmd as XGCommand).get_insert_rowid();
var sqlIdentity = $"SELECT {_commonUtils.QuoteSqlName(identCols.First().Value.Attribute.Name)} FROM {_table.DbName} WHERE \"ROWID\"='{rowid}'";
var sqlIdentity = $"SELECT {_commonUtils.QuoteSqlName(identCols.First().Value.Attribute.Name)} FROM {_commonUtils.QuoteSqlName(TableRuleInvoke())} WHERE \"ROWID\"='{rowid}'";
if (!long.TryParse(_orm.Ado.ExecuteScalar(CommandType.Text, sqlIdentity, _params).ToString(), out ret))
{
Expand All @@ -193,11 +186,6 @@ await _orm.Ado.ExecuteNonQueryAsync(_connection, _transaction, CommandType.Text,
}
async protected override Task<List<T1>> RawExecuteInsertedAsync(CancellationToken cancellationToken = default)
{





var sql = this.ToSql();
if (string.IsNullOrEmpty(sql)) return null;

Expand All @@ -219,7 +207,7 @@ await _orm.Ado.ExecuteNonQueryAsync(_connection, _transaction, CommandType.Text,
{
var rowid = (cmd as XGCommand).get_insert_rowid();
var sqlIdentity = $"SELECT {sbColumn} FROM {_table.DbName} WHERE \"ROWID\"='{rowid}'";
var sqlIdentity = $"SELECT {sbColumn} FROM {_commonUtils.QuoteSqlName(TableRuleInvoke())} WHERE \"ROWID\"='{rowid}'";
ret = _orm.Ado.Query<T1>(_table.TypeLazy ?? _table.Type, _connection, _transaction, CommandType.Text, sqlIdentity, _commandTimeout, _params);
return Task.CompletedTask;
Expand Down

0 comments on commit 448b25c

Please sign in to comment.