mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 20:43:46 +08:00
Update sqlite update column
This commit is contained in:
@@ -257,6 +257,7 @@ namespace SqlSugar
|
||||
#region Methods
|
||||
public override bool UpdateColumn(string tableName, DbColumnInfo column)
|
||||
{
|
||||
var isTran = this.Context.Ado.IsNoTran();
|
||||
try
|
||||
{
|
||||
if (column.IsPrimarykey)
|
||||
@@ -264,6 +265,7 @@ namespace SqlSugar
|
||||
Check.ExceptionEasy("Sqlite no support alter column primary key","Sqlite不支持修改主键");
|
||||
}
|
||||
|
||||
if (isTran)
|
||||
// Start a transaction
|
||||
this.Context.Ado.BeginTran();
|
||||
|
||||
@@ -291,6 +293,7 @@ namespace SqlSugar
|
||||
//Step 6: Drop the temporary column
|
||||
this.DropColumn(tableName, tempColumn);
|
||||
|
||||
if (isTran)
|
||||
// Commit the transaction
|
||||
this.Context.Ado.CommitTran();
|
||||
|
||||
@@ -298,6 +301,7 @@ namespace SqlSugar
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (isTran)
|
||||
// Handle exceptions, log, or rollback the transaction if necessary
|
||||
this.Context.Ado.RollbackTran();
|
||||
// Log the exception or throw it again based on your requirements
|
||||
|
Reference in New Issue
Block a user