From: Carlos G. Á. <car...@us...> - 2005-09-13 18:21:59
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/PostgreSqlClient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29583/PostgreSql/Data/PostgreSqlClient Modified Files: PgDataReader.cs Log Message: Started the rework of the Schema support Index: PgDataReader.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/PostgreSqlClient/PgDataReader.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PgDataReader.cs 12 Sep 2005 18:27:45 -0000 1.5 --- PgDataReader.cs 13 Sep 2005 18:21:51 -0000 1.6 *************** *** 232,235 **** --- 232,236 ---- PgCommand primaryKeyCmd = new PgCommand(this.GetPrimaryKeysSql(), this.connection); primaryKeyCmd.Parameters.Add("@OidTable", PgDbType.Int4); + primaryKeyCmd.InternalPrepare(); for (int i = 0; i < command.Statement.RowDescriptor.Fields.Length; i++) *************** *** 288,292 **** schemaRow["IsReadOnly"] = (bool)columnInfo[10]; schemaRow["IsAutoIncrement"] = (bool)columnInfo[10]; ! schemaRow["IsKey"] = this.IsPrimaryKey(pKeyInfo, (short)columnInfo[6]); schemaRow["AllowDBNull"] = ((bool)columnInfo[9]) ? false : true; schemaRow["BaseSchemaName"] = columnInfo[0].ToString(); --- 289,293 ---- schemaRow["IsReadOnly"] = (bool)columnInfo[10]; schemaRow["IsAutoIncrement"] = (bool)columnInfo[10]; ! schemaRow["IsKey"] = this.IsPrimaryKey(pKeyInfo, (int)columnInfo[6]); schemaRow["AllowDBNull"] = ((bool)columnInfo[9]) ? false : true; schemaRow["BaseSchemaName"] = columnInfo[0].ToString(); *************** *** 325,330 **** "pg_attribute.attname AS COLUMN_NAME, " + "pg_attribute.atttypid AS DATA_TYPE, " + - "0 AS NUMERIC_PRECISION, " + - "0 AS NUMERIC_SCALE, " + "pg_attribute.attlen AS COLUMN_SIZE, " + "pg_attribute.attndims AS COLUMN_DIMENSIONS, " + --- 326,329 ---- *************** *** 353,360 **** private string GetPrimaryKeysSql() { ! throw new NotImplementedException(); } ! private bool IsPrimaryKey(System.Array pKeyInfo, short ordinal) { if (pKeyInfo != null) --- 352,372 ---- private string GetPrimaryKeysSql() { ! return "SELECT " + ! "null AS TABLE_CATALOG, " + ! "pg_namespace.nspname AS TABLE_SCHEMA, " + ! "pg_class.relname AS TABLE_NAME, " + ! "pg_constraint.conname AS PK_NAME, " + ! "pg_constraint.conkey AS PK_COLUMNS, " + ! "pg_description.description AS DESCRIPTION " + ! "FROM pg_constraint " + ! "left join pg_class ON pg_constraint.conrelid = pg_class.oid " + ! "left join pg_namespace ON pg_constraint.connamespace = pg_namespace.oid " + ! "left join pg_description ON pg_constraint.oid = pg_description.objoid " + ! "WHERE " + ! "pg_constraint.contype = 'p' and " + ! "pg_class.oid = @OidTable"; } ! private bool IsPrimaryKey(System.Array pKeyInfo, int ordinal) { if (pKeyInfo != null) |