mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-29 01:47:06 +08:00
1.新增存储过程判断是否存在
2.已加入 SqlServer、MySql、Oracle
This commit is contained in:
parent
53dd753736
commit
b8185131c1
@ -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
|
||||
|
@ -55,6 +55,7 @@ namespace SqlSugar
|
||||
protected abstract string DeleteTableRemarkSql { get; }
|
||||
protected abstract string IsAnyTableRemarkSql { get; }
|
||||
protected abstract string RenameTableSql { get; }
|
||||
protected abstract string IsAnyProcedureSql { get; }
|
||||
#endregion
|
||||
|
||||
#region Check
|
||||
|
@ -25,6 +25,7 @@ namespace SqlSugar
|
||||
bool IsIdentity(string tableName, string column);
|
||||
bool IsAnyConstraint(string ConstraintName);
|
||||
bool IsAnySystemTablePermissions();
|
||||
bool IsAnyProcedure(string procName);
|
||||
#endregion
|
||||
|
||||
#region DDL
|
||||
|
@ -218,6 +218,7 @@ namespace SqlSugar
|
||||
return "alter table {0} rename to {1}";
|
||||
}
|
||||
}
|
||||
protected override string IsAnyProcedureSql => throw new NotImplementedException();
|
||||
#endregion
|
||||
|
||||
#region Check
|
||||
|
@ -195,7 +195,7 @@ namespace SqlSugar
|
||||
return " Select count(1) from (SELECT to_regclass('Index_UnitCodeTest1_Id_CreateDate') as c ) t where t.c is not null";
|
||||
}
|
||||
}
|
||||
|
||||
protected override string IsAnyProcedureSql => throw new NotImplementedException();
|
||||
#endregion
|
||||
|
||||
#region Check
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -194,6 +194,7 @@ namespace SqlSugar
|
||||
return " Select count(1) from (SELECT to_regclass('{0}') as c ) t where t.c is not null";
|
||||
}
|
||||
}
|
||||
protected override string IsAnyProcedureSql => throw new NotImplementedException();
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -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
|
||||
|
@ -170,7 +170,7 @@ namespace SqlSugar
|
||||
return " Select count(1) from (SELECT to_regclass('{0}') as c ) t where t.c is not null";
|
||||
}
|
||||
}
|
||||
|
||||
protected override string IsAnyProcedureSql => throw new NotImplementedException();
|
||||
#endregion
|
||||
|
||||
#region Check
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -136,6 +136,7 @@ namespace SqlSugar
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
protected override string IsAnyProcedureSql => throw new NotImplementedException();
|
||||
#endregion
|
||||
|
||||
#region Check
|
||||
|
Loading…
Reference in New Issue
Block a user