mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 优化 Sqlite 只有一个字段字段的插入;#1326
This commit is contained in:
parent
95e8ec7c83
commit
bba57a1da9
@ -58,6 +58,22 @@ namespace FreeSql.Sqlite.Curd
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToSql()
|
||||||
|
{
|
||||||
|
if (_table.Columns.Count == 1 && _table.ColumnsByPosition[0].Attribute.IsIdentity)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
var didx = 0;
|
||||||
|
foreach (var d in _source)
|
||||||
|
{
|
||||||
|
if (didx++ > 0) sb.Append(";\r\n");
|
||||||
|
sb.Append("INSERT INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" DEFAULT VALUES");
|
||||||
|
}
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
return base.ToSql();
|
||||||
|
}
|
||||||
|
|
||||||
#if net40
|
#if net40
|
||||||
#else
|
#else
|
||||||
public override Task<int> ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchValuesLimit > 0 ? _batchValuesLimit : 5000, _batchParameterLimit > 0 ? _batchParameterLimit : 999, cancellationToken);
|
public override Task<int> ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchValuesLimit > 0 ? _batchValuesLimit : 5000, _batchParameterLimit > 0 ? _batchParameterLimit : 999, cancellationToken);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user