From: Carlos G. Á. <car...@us...> - 2005-09-28 15:49:22
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/Schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10432 Modified Files: PgColumns.cs Log Message: no message Index: PgColumns.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/Schema/PgColumns.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PgColumns.cs 13 Sep 2005 18:21:51 -0000 1.2 --- PgColumns.cs 28 Sep 2005 15:49:10 -0000 1.3 *************** *** 28,58 **** string sql = "SELECT " + ! "null AS TABLE_CATALOG, " + ! "pg_namespace.nspname AS TABLE_SCHEMA, " + ! "pg_class.relname AS TABLE_NAME, " + ! "pg_attribute.attname AS COLUMN_NAME, " + ! "pg_attribute.atttypid AS DATA_TYPE, " + ! "cast(0 as int4) AS NUMERIC_PRECISION, " + ! "cast(0 as int4) AS NUMERIC_SCALE, " + ! "pg_attribute.attlen AS COLUMN_SIZE, " + ! "pg_attribute.attndims AS COLUMN_DIMENSIONS, " + ! "pg_attribute.attnum AS ORDINAL_POSITION, " + ! "pg_attrdef.adsrc AS COLUMN_DEFAULT, " + ! "pg_attribute.attnotnull AS IS_NOT_NULL, " + ! "(pg_depend.objid is not null) AS IS_AUTOINCREMENT, " + ! "case pg_attribute.attstorage " + ! "when 'p' THEN 'PLAIN' " + ! "when 'e' THEN 'EXTERNAL' "+ ! "when 'm' THEN 'MAIN' " + ! "when 'x' THEN 'EXTENDED' " + ! "END AS STORAGE, " + ! "pg_description.description AS DESCRIPTION " + ! "FROM pg_attribute " + ! "left join pg_class ON pg_attribute.attrelid = pg_class.oid " + ! "left join pg_namespace ON pg_class.relnamespace = pg_namespace.oid " + ! "left join pg_attrdef ON (pg_class.oid = pg_attrdef.adrelid AND pg_attribute.attnum = pg_attrdef.adnum) " + ! "left join pg_description ON (pg_attribute.attrelid = pg_description.objoid AND pg_attribute.attnum = pg_description.objsubid) " + ! "left join pg_depend ON (pg_attribute.attrelid = pg_depend.refobjid AND pg_attribute.attnum = pg_depend.refobjsubid AND pg_depend.deptype = 'i') " + ! "WHERE pg_attribute.attisdropped = false AND pg_attribute.attnum > 0 "; if (restrictions != null && restrictions.Length > 0) --- 28,49 ---- string sql = "SELECT " + ! "table_catalog, " + ! "table_schema, " + ! "table_name, " + ! "column_name, " + ! "data_type, " + ! "numeric_precision, " + ! "numeric_scale, " + ! "ordinal_position, " + ! "case is_nullable when true then false when false then true AS is_not_null, " + ! "column_default, " + ! "character_octet_length, " + ! "character_set_catalog, " + ! "character_set_schema, " + ! "character_set_name, " + ! "collation_catalog, " + ! "collation_schema, " + ! "collation_name, " + ! "FROM information_schema.columns "; if (restrictions != null && restrictions.Length > 0) *************** *** 61,64 **** --- 52,56 ---- if (restrictions.Length > 0) { + sql += String.Format(" and table_catalog = '{0}'", restrictions[1]); } *************** *** 66,70 **** if (restrictions.Length > 1 && restrictions[1] != null) { ! sql += String.Format(" and pg_namespace.nspname = '{0}'", restrictions[1]); } --- 58,62 ---- if (restrictions.Length > 1 && restrictions[1] != null) { ! sql += String.Format(" and table_schema = '{0}'", restrictions[1]); } *************** *** 72,76 **** if (restrictions.Length > 2 && restrictions[2] != null) { ! sql += String.Format(" and pg_class.relname = '{0}'", restrictions[1]); } --- 64,68 ---- if (restrictions.Length > 2 && restrictions[2] != null) { ! sql += String.Format(" and table_name = '{0}'", restrictions[1]); } *************** *** 78,86 **** if (restrictions.Length > 3 && restrictions[3] != null) { ! sql += String.Format(" and pg_attribute.attname = '{0}'", restrictions[2]); } } ! sql += " ORDER BY pg_namespace.nspname, pg_class.relname, pg_attribute.attnum"; return sql; --- 70,78 ---- if (restrictions.Length > 3 && restrictions[3] != null) { ! sql += String.Format(" and column_name = '{0}'", restrictions[2]); } } ! sql += " ORDER BY table_catalog, table_schema, table_name, ordinal_position"; return sql; |