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
----------------------------------------------------------------
This commit is contained in:
Bruce Momjian 2000-09-12 04:51:43 +00:00
parent 264c068207
commit 4f5cdadf03
2 changed files with 36 additions and 6 deletions

View File

@ -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);
}

View File

@ -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);
}