|
@@ -40,24 +40,30 @@ public enum QuerySQL {
|
|
|
+ "AND C.COLUMN_NAME=A.COLUMN_NAME WHERE A.TABLE_NAME = '%s' ORDER BY A.COLUMN_ID ",
|
|
|
"TABLE_NAME", "COMMENTS", "COLUMN_NAME", "DATA_TYPE", "COMMENTS", "KEY"),
|
|
|
|
|
|
- SQL_SERVER("sql_server",
|
|
|
- "select cast(name as varchar(500)) as TABLE_NAME from sysObjects where xtype='U' order by name",
|
|
|
- "select name as TABLE_NAME,(select cast(value as varchar(500)) from sys.extended_properties where major_id=id and minor_id = 0) as COMMENTS from sysobjects where xtype='U'",
|
|
|
- "SELECT cast(a.NAME AS VARCHAR(500)) AS TABLE_NAME,cast(b.NAME AS VARCHAR(500)) AS COLUMN_NAME, "
|
|
|
- + "cast(c.VALUE AS VARCHAR(500)) AS COMMENTS,cast(sys.types.NAME AS VARCHAR (500)) AS DATA_TYPE,"
|
|
|
- + "(" + " SELECT CASE count(1) WHEN 1 then 'PRI' ELSE '' END"
|
|
|
- + " FROM syscolumns,sysobjects,sysindexes,sysindexkeys,systypes "
|
|
|
- + " WHERE syscolumns.xusertype = systypes.xusertype AND syscolumns.id = object_id (A.NAME) AND sysobjects.xtype = 'PK'"
|
|
|
- + " AND sysobjects.parent_obj = syscolumns.id " + " AND sysindexes.id = syscolumns.id "
|
|
|
- + " AND sysobjects.NAME = sysindexes.NAME AND sysindexkeys.id = syscolumns.id "
|
|
|
- + " AND sysindexkeys.indid = sysindexes.indid "
|
|
|
- + " AND syscolumns.colid = sysindexkeys.colid AND syscolumns.NAME = B.NAME) as 'KEY',"
|
|
|
- + " b.is_identity isIdentity "
|
|
|
- + " FROM sys.TABLES a " + " INNER JOIN sys.COLUMNS b ON b.object_id = a.object_id "
|
|
|
- + " LEFT JOIN sys.types ON b.user_type_id = sys.types.user_type_id "
|
|
|
- + " LEFT JOIN sys.extended_properties c ON c.major_id = b.object_id AND c.minor_id = b.column_id "
|
|
|
- + " WHERE a.NAME = '%s' and sys.types.NAME !='sysname' ",
|
|
|
- "TABLE_NAME", "COMMENTS", "COLUMN_NAME", "DATA_TYPE", "COMMENTS", "KEY"),
|
|
|
+ SQL_SERVER("sql_server",
|
|
|
+ "select cast(name as varchar(500)) as TABLE_NAME from sysObjects where (xtype='U' or xtype='v') order by name",
|
|
|
+ "select " +
|
|
|
+ "cast(so.name as varchar(500)) as TABLE_NAME, " +
|
|
|
+ "cast(sep.value as varchar(500)) as COMMENTS " +
|
|
|
+ "from sysobjects so " +
|
|
|
+ "left JOIN sys.extended_properties sep on sep.major_id=so.id and sep.minor_id=0 " +
|
|
|
+ "where (xtype='U' or xtype='v')",
|
|
|
+ "SELECT cast(a.NAME AS VARCHAR(500)) AS TABLE_NAME,cast(b.NAME AS VARCHAR(500)) AS COLUMN_NAME, "
|
|
|
+ + "cast(c.VALUE AS VARCHAR(500)) AS COMMENTS,cast(sys.types.NAME AS VARCHAR (500)) AS DATA_TYPE,"
|
|
|
+ + "(" + " SELECT CASE count(1) WHEN 1 then 'PRI' ELSE '' END"
|
|
|
+ + " FROM syscolumns,sysobjects,sysindexes,sysindexkeys,systypes "
|
|
|
+ + " WHERE syscolumns.xusertype = systypes.xusertype AND syscolumns.id = object_id (A.NAME) AND sysobjects.xtype = 'PK'"
|
|
|
+ + " AND sysobjects.parent_obj = syscolumns.id " + " AND sysindexes.id = syscolumns.id "
|
|
|
+ + " AND sysobjects.NAME = sysindexes.NAME AND sysindexkeys.id = syscolumns.id "
|
|
|
+ + " AND sysindexkeys.indid = sysindexes.indid "
|
|
|
+ + " AND syscolumns.colid = sysindexkeys.colid AND syscolumns.NAME = B.NAME) as 'KEY',"
|
|
|
+ + " b.is_identity isIdentity "
|
|
|
+ + " FROM ( select name,object_id from sys.tables UNION all select name,object_id from sys.views ) a "
|
|
|
+ + " INNER JOIN sys.COLUMNS b ON b.object_id = a.object_id "
|
|
|
+ + " LEFT JOIN sys.types ON b.user_type_id = sys.types.user_type_id "
|
|
|
+ + " LEFT JOIN sys.extended_properties c ON c.major_id = b.object_id AND c.minor_id = b.column_id "
|
|
|
+ + " WHERE a.NAME = '%s' and sys.types.NAME !='sysname' ",
|
|
|
+ "TABLE_NAME", "COMMENTS", "COLUMN_NAME", "DATA_TYPE", "COMMENTS", "KEY"),
|
|
|
|
|
|
POSTGRE_SQL("postgre_sql", "select tablename from pg_tables where schemaname='%s' ORDER BY tablename",
|
|
|
"SELECT A.tablename, obj_description(relfilenode, 'pg_class') AS comments FROM pg_tables A, pg_class B WHERE A.schemaname='%s' AND A.tablename = B.relname",
|