mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Update sqlite bulkcopy
This commit is contained in:
parent
29fbc5c593
commit
5c77c7269f
@ -75,6 +75,13 @@ namespace SqlSugar
|
|||||||
private async Task<int> _BulkCopy(DataTable dt, List<Dictionary<string, object>> dictionary, int i, SqliteConnection cn)
|
private async Task<int> _BulkCopy(DataTable dt, List<Dictionary<string, object>> dictionary, int i, SqliteConnection cn)
|
||||||
{
|
{
|
||||||
using (var cmd = cn.CreateCommand())
|
using (var cmd = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
if (this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true)
|
||||||
|
{
|
||||||
|
cmd.CommandText = this.Context.Insertable(dictionary.First()).AS(dt.TableName).ToSqlString().Replace(";SELECT LAST_INSERT_ROWID();", "");
|
||||||
|
i += await cmd.ExecuteNonQueryAsync();
|
||||||
|
}
|
||||||
|
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();", "");
|
||||||
foreach (DataRow dataRow in dt.Rows)
|
foreach (DataRow dataRow in dt.Rows)
|
||||||
@ -98,11 +105,22 @@ namespace SqlSugar
|
|||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
private async Task<int> _BulkUpdate(DataTable dt, List<Dictionary<string, object>> dictionary, int i,string [] whereColums,string [] updateColums, SqliteConnection cn)
|
private async Task<int> _BulkUpdate(DataTable dt, List<Dictionary<string, object>> dictionary, int i,string [] whereColums,string [] updateColums, SqliteConnection cn)
|
||||||
{
|
{
|
||||||
using (var cmd = cn.CreateCommand())
|
using (var cmd = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
if (this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true)
|
||||||
|
{
|
||||||
|
cmd.CommandText = this.Context.Updateable(dictionary.First())
|
||||||
|
.WhereColumns(whereColums)
|
||||||
|
.UpdateColumns(updateColums)
|
||||||
|
.AS(dt.TableName).ToSqlString();
|
||||||
|
i += await cmd.ExecuteNonQueryAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
cmd.CommandText = this.Context.Updateable(dictionary.First())
|
cmd.CommandText = this.Context.Updateable(dictionary.First())
|
||||||
.WhereColumns(whereColums)
|
.WhereColumns(whereColums)
|
||||||
@ -130,6 +148,7 @@ namespace SqlSugar
|
|||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user