mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 02:29:39 +08:00
Update sqlite truncate table
This commit is contained in:
@@ -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>
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user