Index: src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java,v retrieving revision 1.24 diff -c -r1.24 DatabaseMetaData.java *** src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java 2001/08/04 19:32:04 1.24 --- src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java 2001/08/13 17:31:51 *************** *** 43,52 **** static final int iInt4Oid = 23; // OID for int4 static final int VARHDRSZ = 4; // length for int4 - // This is a default value for remarks - private static final byte defaultRemarks[]="no remarks".getBytes(); - - public DatabaseMetaData(Connection conn) { this.connection = conn; --- 43,48 ---- *************** *** 1517,1524 **** java.sql.ResultSet r; // ResultSet for the SQL query that we need to do Vector v = new Vector(); // The new ResultSet tuple stuff - byte remarks[] = defaultRemarks; - f[0] = new Field(connection, "PROCEDURE_CAT", iVarcharOid, 32); f[1] = new Field(connection, "PROCEDURE_SCHEM", iVarcharOid, 32); f[2] = new Field(connection, "PROCEDURE_NAME", iVarcharOid, 32); --- 1513,1518 ---- *************** *** 1540,1546 **** tuple[1] = null; // Schema name tuple[2] = r.getBytes(1); // Procedure name tuple[3] = tuple[4] = tuple[5] = null; // Reserved ! tuple[6] = remarks; // Remarks if (r.getBoolean(2)) tuple[7] = Integer.toString(java.sql.DatabaseMetaData.procedureReturnsResult).getBytes(); --- 1534,1540 ---- tuple[1] = null; // Schema name tuple[2] = r.getBytes(1); // Procedure name tuple[3] = tuple[4] = tuple[5] = null; // Reserved ! tuple[6] = null; // Remarks if (r.getBoolean(2)) tuple[7] = Integer.toString(java.sql.DatabaseMetaData.procedureReturnsResult).getBytes(); *************** *** 1684,1689 **** --- 1678,1684 ---- // Now form the query StringBuffer sql = new StringBuffer("select relname,oid,relkind from pg_class where ("); + boolean notFirst=false; for(int i=0;i ! r = connection.ExecSQL("select a.oid,c.relname,a.attname,a.atttypid,a.attnum,a.attnotnull,a.attlen,a.atttypmod,d.adsrc from pg_class c,pg_attribute a,pg_attrdef d where a.attrelid=c.oid and c.relname like '"+tableNamePattern.toLowerCase()+"' and a.attname like '"+columnNamePattern.toLowerCase()+"' and a.attnum>0 and c.oid=d.adrelid and d.adnum=a.attnum order by c.relname,a.attnum"); ! byte remarks[]; while(r.next()) { byte[][] tuple = new byte[18][0]; // Fetch the description for the table (if any) ! java.sql.ResultSet dr = connection.ExecSQL("select description from pg_description where objoid="+r.getInt(1)); if(((org.postgresql.ResultSet)dr).getTupleCount()==1) { dr.next(); tuple[11] = dr.getBytes(1); } else ! tuple[11] = defaultRemarks; ! dr.close(); tuple[0] = "".getBytes(); // Catalog name --- 1919,1953 ---- if (columnNamePattern == null) columnNamePattern="%"; // Now form the query ! String query = ! "select " + ! (connection.haveMinimumServerVersion("7.2") ? "a.attrelid" : "a.oid") + ! ",c.relname,a.attname,a.atttypid," + ! "a.attnum,a.attnotnull,a.attlen,a.atttypmod,d.adsrc from pg_class c," + ! "pg_attribute a,pg_attrdef d where a.attrelid=c.oid and " + ! "c.relname like '"+tableNamePattern.toLowerCase()+"' and " + ! "a.attname like '"+columnNamePattern.toLowerCase()+"' and " + ! "a.attnum>0 and c.oid=d.adrelid and d.adnum=a.attnum " + ! "order by c.relname,a.attnum"; ! r = connection.ExecSQL(query); while(r.next()) { byte[][] tuple = new byte[18][0]; // Fetch the description for the table (if any) ! String getDescriptionStatement = ! connection.haveMinimumServerVersion("7.2") ? ! "select col_description(" + r.getInt(1) + "," + r.getInt(5) + ")" : ! "select description from pg_description where objoid=" + r.getInt(1); ! ! java.sql.ResultSet dr = connection.ExecSQL(getDescriptionStatement); ! if(((org.postgresql.ResultSet)dr).getTupleCount()==1) { dr.next(); tuple[11] = dr.getBytes(1); } else ! tuple[11] = null; dr.close(); tuple[0] = "".getBytes(); // Catalog name *************** *** 1985,1991 **** r.close(); return new ResultSet(connection, f, v, "OK", 1); } - /** * Get a description of the access rights for a table's columns. * --- 1998,2003 ---- Index: src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java,v retrieving revision 1.27 diff -c -r1.27 DatabaseMetaData.java *** src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java 2001/08/04 19:32:04 1.27 --- src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java 2001/08/13 17:31:51 *************** *** 43,52 **** static final int iInt4Oid = 23; // OID for int4 static final int VARHDRSZ = 4; // length for int4 - // This is a default value for remarks - private static final byte defaultRemarks[]="no remarks".getBytes(); - - public DatabaseMetaData(Connection conn) { this.connection = conn; --- 43,48 ---- *************** *** 1517,1524 **** java.sql.ResultSet r; // ResultSet for the SQL query that we need to do Vector v = new Vector(); // The new ResultSet tuple stuff - byte remarks[] = defaultRemarks; - f[0] = new Field(connection, "PROCEDURE_CAT", iVarcharOid, 32); f[1] = new Field(connection, "PROCEDURE_SCHEM", iVarcharOid, 32); f[2] = new Field(connection, "PROCEDURE_NAME", iVarcharOid, 32); --- 1513,1518 ---- *************** *** 1540,1546 **** tuple[1] = null; // Schema name tuple[2] = r.getBytes(1); // Procedure name tuple[3] = tuple[4] = tuple[5] = null; // Reserved ! tuple[6] = remarks; // Remarks if (r.getBoolean(2)) tuple[7] = Integer.toString(java.sql.DatabaseMetaData.procedureReturnsResult).getBytes(); --- 1534,1540 ---- tuple[1] = null; // Schema name tuple[2] = r.getBytes(1); // Procedure name tuple[3] = tuple[4] = tuple[5] = null; // Reserved ! tuple[6] = null; if (r.getBoolean(2)) tuple[7] = Integer.toString(java.sql.DatabaseMetaData.procedureReturnsResult).getBytes(); *************** *** 1684,1689 **** --- 1678,1684 ---- // Now form the query StringBuffer sql = new StringBuffer("select relname,oid,relkind from pg_class where ("); + boolean notFirst=false; for(int i=0;i ! r = connection.ExecSQL("select a.oid,c.relname,a.attname,a.atttypid,a.attnum,a.attnotnull,a.attlen,a.atttypmod,d.adsrc from pg_class c,pg_attribute a,pg_attrdef d where a.attrelid=c.oid and c.relname like '"+tableNamePattern.toLowerCase()+"' and a.attname like '"+columnNamePattern.toLowerCase()+"' and a.attnum>0 and c.oid=d.adrelid and d.adnum=a.attnum order by c.relname,a.attnum"); ! byte remarks[]; while(r.next()) { byte[][] tuple = new byte[18][0]; // Fetch the description for the table (if any) ! java.sql.ResultSet dr = connection.ExecSQL("select description from pg_description where objoid="+r.getInt(1)); if(((org.postgresql.ResultSet)dr).getTupleCount()==1) { dr.next(); tuple[11] = dr.getBytes(1); } else ! tuple[11] = defaultRemarks; ! dr.close(); tuple[0] = "".getBytes(); // Catalog name --- 1919,1953 ---- if (columnNamePattern == null) columnNamePattern="%"; // Now form the query ! String query = ! "select " + ! (connection.haveMinimumServerVersion("7.2") ? "a.attrelid" : "a.oid") + ! ",c.relname,a.attname,a.atttypid," + ! "a.attnum,a.attnotnull,a.attlen,a.atttypmod,d.adsrc from pg_class c," + ! "pg_attribute a,pg_attrdef d where a.attrelid=c.oid and " + ! "c.relname like '"+tableNamePattern.toLowerCase()+"' and " + ! "a.attname like '"+columnNamePattern.toLowerCase()+"' and " + ! "a.attnum>0 and c.oid=d.adrelid and d.adnum=a.attnum " + ! "order by c.relname,a.attnum"; ! r = connection.ExecSQL(query); while(r.next()) { byte[][] tuple = new byte[18][0]; // Fetch the description for the table (if any) ! String getDescriptionStatement = ! connection.haveMinimumServerVersion("7.2") ? ! "select col_description(" + r.getInt(1) + "," + r.getInt(5) + ")" : ! "select description from pg_description where objoid=" + r.getInt(1); ! ! java.sql.ResultSet dr = connection.ExecSQL(getDescriptionStatement); ! if(((org.postgresql.ResultSet)dr).getTupleCount()==1) { dr.next(); tuple[11] = dr.getBytes(1); } else ! tuple[11] = null; dr.close(); tuple[0] = "".getBytes(); // Catalog name