Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4f5cdad

Browse files
committed
Applied to jdbc1 and jdbc2.
This is a patch which lets the DatabaseMetaData return the object typewhen getTables(....) is called. It does not really fix any bug, but itfills in some functionality that should be there anyway. The diffincluded here is off of the CVS as of just now :)----------------------------------------------------------------Travis Bauer | CS Grad Student | IU |www.cs.indiana.edu/~trbauer----------------------------------------------------------------
1 parent264c068 commit4f5cdad

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

‎src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,7 @@ public java.sql.ResultSet getTables(String catalog, String schemaPattern, String
16511651
f[4] =newField(connection,newString("REMARKS"),iVarcharOid,32);
16521652

16531653
// Now form the query
1654-
StringBuffersql =newStringBuffer("select relname,oid from pg_class where (");
1654+
StringBuffersql =newStringBuffer("select relname,oid,relkind from pg_class where (");
16551655
booleannotFirst=false;
16561656
for(inti=0;i<types.length;i++) {
16571657
for(intj=0;j<getTableTypes.length;j++)
@@ -1687,10 +1687,25 @@ public java.sql.ResultSet getTables(String catalog, String schemaPattern, String
16871687
remarks =defaultRemarks;
16881688
dr.close();
16891689

1690+
StringrelKind;
1691+
switch (r.getBytes(3)[0]) {
1692+
case'r':
1693+
relKind ="TABLE";
1694+
break;
1695+
case'i':
1696+
relKind ="INDEX";
1697+
break;
1698+
case'S':
1699+
relKind ="SEQUENCE";
1700+
break;
1701+
default:
1702+
relKind =null;
1703+
}
1704+
16901705
tuple[0] =null;// Catalog name
16911706
tuple[1] =null;// Schema name
1692-
tuple[2] =r.getBytes(1);// Table name
1693-
tuple[3] =null;// Table type
1707+
tuple[2] =r.getBytes(1);// Table name
1708+
tuple[3] =relKind.getBytes();// Table type
16941709
tuple[4] =remarks;// Remarks
16951710
v.addElement(tuple);
16961711
}

‎src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,7 @@ public java.sql.ResultSet getTables(String catalog, String schemaPattern, String
16511651
f[4] =newField(connection,newString("REMARKS"),iVarcharOid,32);
16521652

16531653
// Now form the query
1654-
StringBuffersql =newStringBuffer("select relname,oid from pg_class where (");
1654+
StringBuffersql =newStringBuffer("select relname,oid,relkind from pg_class where (");
16551655
booleannotFirst=false;
16561656
for(inti=0;i<types.length;i++) {
16571657
for(intj=0;j<getTableTypes.length;j++)
@@ -1687,10 +1687,25 @@ public java.sql.ResultSet getTables(String catalog, String schemaPattern, String
16871687
remarks =defaultRemarks;
16881688
dr.close();
16891689

1690+
StringrelKind;
1691+
switch (r.getBytes(3)[0]) {
1692+
case'r':
1693+
relKind ="TABLE";
1694+
break;
1695+
case'i':
1696+
relKind ="INDEX";
1697+
break;
1698+
case'S':
1699+
relKind ="SEQUENCE";
1700+
break;
1701+
default:
1702+
relKind =null;
1703+
}
1704+
16901705
tuple[0] =null;// Catalog name
16911706
tuple[1] =null;// Schema name
1692-
tuple[2] =r.getBytes(1);// Table name
1693-
tuple[3] =null;// Table type
1707+
tuple[2] =r.getBytes(1);// Table name
1708+
tuple[3] =relKind.getBytes();// Table type
16941709
tuple[4] =remarks;// Remarks
16951710
v.addElement(tuple);
16961711
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp