mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-04 23:39:31 +08:00
Optimize pgsql IsAnyTable
This commit is contained in:
parent
8e182e1236
commit
b4d44ce7b5
@ -250,6 +250,24 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public override bool IsAnyTable(string tableName, bool isCache = true)
|
||||
{
|
||||
if (isCache == false)
|
||||
{
|
||||
var sql = @"select 1 from pg_class c
|
||||
inner join
|
||||
pg_namespace n on n.oid = c.relnamespace and nspname='"+GetSchema()+@"'
|
||||
inner join
|
||||
pg_tables z on z.tablename=c.relname and Lower(z.tablename)='" + tableName.ToLower()+@"'
|
||||
where relkind in('p', 'r') and relname not like 'pg\_%' and relname not like 'sql\_%' and schemaname='public' order by relname";
|
||||
var isAny=this.Context.Ado.GetDataTable(sql).Rows.Count>0;
|
||||
return isAny;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.IsAnyTable(tableName, isCache);
|
||||
}
|
||||
}
|
||||
public override List<string> GetDbTypes()
|
||||
{
|
||||
var result = this.Context.Ado.SqlQuery<string>(@"SELECT DISTINCT data_type
|
||||
|
Loading…
Reference in New Issue
Block a user