Update sqlite

This commit is contained in:
sunkaixuan 2024-02-14 23:02:18 +08:00
parent c069ce471b
commit fdf3662d4d

View File

@ -78,9 +78,12 @@ namespace SqlSugar
{ {
if (this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true) if (this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true)
{ {
cmd.CommandText = this.Context.Insertable(dictionary.First()).AS(dt.TableName).ToSqlString().Replace(";SELECT LAST_INSERT_ROWID();", ""); foreach (var item in dictionary)
{
cmd.CommandText = this.Context.Insertable(item).AS(dt.TableName).ToSqlString().Replace(";SELECT LAST_INSERT_ROWID();", "");
i += await cmd.ExecuteNonQueryAsync(); i += await cmd.ExecuteNonQueryAsync();
} }
}
else else
{ {
cmd.CommandText = this.Context.Insertable(dictionary.First()).AS(dt.TableName).ToSql().Key.Replace(";SELECT LAST_INSERT_ROWID();", ""); cmd.CommandText = this.Context.Insertable(dictionary.First()).AS(dt.TableName).ToSql().Key.Replace(";SELECT LAST_INSERT_ROWID();", "");
@ -114,12 +117,15 @@ namespace SqlSugar
{ {
if (this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true) if (this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true)
{ {
cmd.CommandText = this.Context.Updateable(dictionary.First()) foreach (var item in dictionary)
{
cmd.CommandText = this.Context.Updateable(item)
.WhereColumns(whereColums) .WhereColumns(whereColums)
.UpdateColumns(updateColums) .UpdateColumns(updateColums)
.AS(dt.TableName).ToSqlString(); .AS(dt.TableName).ToSqlString();
i += await cmd.ExecuteNonQueryAsync(); i += await cmd.ExecuteNonQueryAsync();
} }
}
else else
{ {
cmd.CommandText = this.Context.Updateable(dictionary.First()) cmd.CommandText = this.Context.Updateable(dictionary.First())