Applied to jdbc1 and jdbc2.

This is a patch which lets the DatabaseMetaData return the object type
when getTables(....) is called.  It does not really fix any bug, but it
fills in some functionality that should be there anyway.  The diff
included here is off of the CVS as of just now :)

----------------------------------------------------------------
Travis Bauer | CS Grad Student | IU |www.cs.indiana.edu/~trbauer
----------------------------------------------------------------
REL7_1_STABLE
Bruce Momjian 25 years ago
parent 264c068207
commit 4f5cdadf03
  1. 21
      src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java
  2. 21
      src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java

@ -1651,7 +1651,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
f[4] = new Field(connection, new String("REMARKS"), iVarcharOid, 32);
// Now form the query
StringBuffer sql = new StringBuffer("select relname,oid from pg_class where (");
StringBuffer sql = new StringBuffer("select relname,oid,relkind from pg_class where (");
boolean notFirst=false;
for(int i=0;i<types.length;i++) {
for(int j=0;j<getTableTypes.length;j++)
@ -1687,10 +1687,25 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
remarks = defaultRemarks;
dr.close();
String relKind;
switch (r.getBytes(3)[0]) {
case 'r':
relKind = "TABLE";
break;
case 'i':
relKind = "INDEX";
break;
case 'S':
relKind = "SEQUENCE";
break;
default:
relKind = null;
}
tuple[0] = null; // Catalog name
tuple[1] = null; // Schema name
tuple[2] = r.getBytes(1); // Table name
tuple[3] = null; // Table type
tuple[2] = r.getBytes(1); // Table name
tuple[3] = relKind.getBytes(); // Table type
tuple[4] = remarks; // Remarks
v.addElement(tuple);
}

@ -1651,7 +1651,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
f[4] = new Field(connection, new String("REMARKS"), iVarcharOid, 32);
// Now form the query
StringBuffer sql = new StringBuffer("select relname,oid from pg_class where (");
StringBuffer sql = new StringBuffer("select relname,oid,relkind from pg_class where (");
boolean notFirst=false;
for(int i=0;i<types.length;i++) {
for(int j=0;j<getTableTypes.length;j++)
@ -1687,10 +1687,25 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
remarks = defaultRemarks;
dr.close();
String relKind;
switch (r.getBytes(3)[0]) {
case 'r':
relKind = "TABLE";
break;
case 'i':
relKind = "INDEX";
break;
case 'S':
relKind = "SEQUENCE";
break;
default:
relKind = null;
}
tuple[0] = null; // Catalog name
tuple[1] = null; // Schema name
tuple[2] = r.getBytes(1); // Table name
tuple[3] = null; // Table type
tuple[2] = r.getBytes(1); // Table name
tuple[3] = relKind.getBytes(); // Table type
tuple[4] = remarks; // Remarks
v.addElement(tuple);
}

Loading…
Cancel
Save