From: | "Ed Yu" <ekyu(at)sc(dot)rr(dot)com> |
---|---|
To: | "pgsql-jdbc" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | DatabaseMetaData.java patch (7.1.3) |
Date: | 2002-01-14 04:04:16 |
Message-ID: | 000b01c19cb0$89270ee0$bf00a8c0@sc.rr.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
This patch fixes the null pointer exception when returning the data row for
a view. Also, this fixes the table schema argument to the getTable() method
to properly recognize the underscore as a wildcard expression.
*** DatabaseMetaData.java.orig Fri Feb 16 11:45:00 2001
--- DatabaseMetaData.java Sun Jan 13 21:19:07 2002
***************
*** 1635,1641 ****
if(types==null)
types = defaultTableTypes;
! if(tableNamePattern==null)
tableNamePattern="%";
// the field descriptors for the new ResultSet
--- 1635,1641 ----
if(types==null)
types = defaultTableTypes;
! if((tableNamePattern==null) || (tableNamePattern.length()==0))
tableNamePattern="%";
// the field descriptors for the new ResultSet
***************
*** 1663,1672 ****
}
// Added by Stefan Andreasen <stefan(at)linux(dot)kapow(dot)dk>
// Now take the pattern into account
! sql.append(") and relname like '");
! sql.append(tableNamePattern.toLowerCase());
! sql.append("'");
// Now run the query
r = connection.ExecSQL(sql.toString());
--- 1663,1677 ----
}
// Added by Stefan Andreasen <stefan(at)linux(dot)kapow(dot)dk>
+ // Modified by Ed Yu <ekyu(at)asgnet(dot)psc(dot)sc(dot)edu>
// Now take the pattern into account
! sql.append(") and relname");
! if ((tableNamePattern.indexOf("%") >= 0) ||
! (tableNamePattern.indexOf("_") >= 0))
! sql.append(" like ");
! else
! sql.append(" = ");
! sql.append("'" + tableNamePattern.toLowerCase() + "'");
// Now run the query
r = connection.ExecSQL(sql.toString());
***************
*** 1686,1691 ****
--- 1691,1698 ----
remarks = defaultRemarks;
dr.close();
+ // JDBC definition for TABLE_TYPE - "TABLE", "VIEW", "SYSTEM TABLE",
+ // "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
String relKind;
switch (r.getBytes(3)[0]) {
case 'r':
***************
*** 1697,1702 ****
--- 1704,1712 ----
case 'S':
relKind = "SEQUENCE";
break;
+ case 'v':
+ relKind = "VIEW";
+ break;
default:
relKind = null;
}
***************
*** 1704,1710 ****
tuple[0] = null; // Catalog name
tuple[1] = null; // Schema name
tuple[2] = r.getBytes(1); // Table name
! tuple[3] = relKind.getBytes(); // Table type
tuple[4] = remarks; // Remarks
v.addElement(tuple);
}
--- 1714,1728 ----
tuple[0] = null; // Catalog name
tuple[1] = null; // Schema name
tuple[2] = r.getBytes(1); // Table name
!
! // Added by Ed Yu <ekyu(at)asgnet(dot)psc(dot)sc(dot)edu>
! // Fix NullPointerException if return type is not handled in the
! // above switch statement.
! if (relKind==null)
! tuple[3] = null;
! else
! tuple[3] = relKind.getBytes(); // Table type
!
tuple[4] = remarks; // Remarks
v.addElement(tuple);
}
From | Date | Subject | |
---|---|---|---|
Next Message | Vianen, Jeroen van | 2002-01-14 13:05:52 | Problem with getImportedKeys / getExportedKeys |
Previous Message | Frank Joerdens | 2002-01-13 15:44:58 | Re: Does pg_dumpall do BLOBs too? |