Synchronization code

This commit is contained in:
sunkaixuan 2022-11-22 15:03:26 +08:00
parent 5eeb85deb8
commit 25285367de
7 changed files with 29 additions and 2 deletions

View File

@ -598,6 +598,10 @@ namespace SqlSugar
this.Context.Ado.ExecuteCommand(sql);
return true;
}
public virtual bool IsAnyProcedure(string procName) {
string sql = string.Format(this.IsAnyProcedureSql, procName);
return this.Context.Ado.GetInt(sql)>0;
}
#endregion
#region Private

View File

@ -55,6 +55,7 @@ namespace SqlSugar
protected abstract string DeleteTableRemarkSql { get; }
protected abstract string IsAnyTableRemarkSql { get; }
protected abstract string RenameTableSql { get; }
protected virtual string IsAnyProcedureSql { get; }
#endregion
#region Check

View File

@ -218,6 +218,7 @@ namespace SqlSugar
return "alter table {0} rename to {1}";
}
}
protected override string IsAnyProcedureSql => throw new NotImplementedException();
#endregion
#region Check

View File

@ -153,6 +153,13 @@ namespace SqlSugar
return "alter table {0} change column {1} {2}";
}
}
protected override string IsAnyProcedureSql
{
get
{
return "select count(*) from information_schema.Routines where ROUTINE_NAME='{0}' and ROUTINE_TYPE='PROCEDURE'";
}
}
#endregion
#region Check

View File

@ -221,6 +221,13 @@ namespace SqlSugar
return "alter table {0} rename to {1}";
}
}
protected override string IsAnyProcedureSql
{
get
{
return "SELECT COUNT(*) FROM user_objects WHERE OBJECT_TYPE = 'PROCEDURE' AND OBJECT_NAME ='{0}'";
}
}
#endregion
#region Check

View File

@ -204,7 +204,7 @@ namespace SqlSugar
return " SELECT count(1) WHERE upper('{0}') IN ( SELECT upper(indexname) FROM pg_indexes )";
}
}
protected override string IsAnyProcedureSql => throw new NotImplementedException();
#endregion
#region Check

View File

@ -269,6 +269,13 @@ namespace SqlSugar
return "select count(*) from sys.indexes where name='{0}'";
}
}
protected override string IsAnyProcedureSql
{
get
{
return "select count(*) from sys.objects where [object_id] = OBJECT_ID(N'sp_GetSubLedgerJoinWithdrawalApplicationRecords') and [type] in (N'P')";
}
}
#endregion
#region Check
@ -563,7 +570,7 @@ namespace SqlSugar
string sql = string.Format(this.RenameColumnSql, tableName, oldColumnName, newColumnName);
this.Context.Ado.ExecuteCommand(sql);
return true;
}
}
#endregion
}
}