Update sqlite truncate table

This commit is contained in:
sunkaixuan
2022-05-24 20:00:18 +08:00
parent 5a2eca8781
commit c9a7dd7364
2 changed files with 22 additions and 4 deletions

View File

@@ -260,9 +260,18 @@ namespace SqlSugar
#region Methods
public override bool TruncateTable(string tableName)
{
base.TruncateTable(tableName);
base.TruncateTable(tableName);//delete data
try
{
//clear sqlite identity
return this.Context.Ado.ExecuteCommand($"UPDATE sqlite_sequence SET seq = 0 WHERE name = '{tableName}'") > 0;
}
catch
{
//if no identity sqlite_sequence
return true;
}
}
/// <summary>
///by current connection string
/// </summary>

View File

@@ -256,9 +256,18 @@ namespace SqlSugar
#region Methods
public override bool TruncateTable(string tableName)
{
base.TruncateTable(tableName);
base.TruncateTable(tableName);//delete data
try
{
//clear sqlite identity
return this.Context.Ado.ExecuteCommand($"UPDATE sqlite_sequence SET seq = 0 WHERE name = '{tableName}'") > 0;
}
catch
{
//if no identity sqlite_sequence
return true;
}
}
/// <summary>
///by current connection string
/// </summary>