From: Barry Lind Date: Mon, 24 Feb 2003 16:38:25 +0000 (+0000) Subject: Backport a fix from 7.4 to 7.3 to better handle case in updateable result sets. X-Git-Tag: REL7_3_3~74 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d47a0f7c76e3db1c4704819d573866e3a1fe1eb5;p=postgresql Backport a fix from 7.4 to 7.3 to better handle case in updateable result sets. This backports part of the fix made in version 1.11. Modified Files: Tag: REL7_3_STABLE jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java --- diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java index 23191b16a6..6ce4ed4b03 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java @@ -15,7 +15,7 @@ import org.postgresql.util.PGbytea; import org.postgresql.util.PSQLException; -/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.10 2002/11/04 06:42:33 barry Exp $ +/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.10.2.1 2003/02/24 16:38:25 barry Exp $ * This class defines methods of the jdbc2 specification. This class extends * org.postgresql.jdbc1.AbstractJdbc1ResultSet which provides the jdbc1 * methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2ResultSet @@ -1328,8 +1328,16 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra else { // otherwise go and get the primary keys and create a hashtable of keys - java.sql.ResultSet rs = ((java.sql.Connection) connection).getMetaData().getPrimaryKeys("", "", tableName); - + // if the user has supplied a quoted table name + // remove the quotes, but preserve the case. + // otherwise fold to lower case. + String quotelessTableName; + if (tableName.startsWith("\"") && tableName.endsWith("\"")) { + quotelessTableName = tableName.substring(1,tableName.length()-1); + } else { + quotelessTableName = tableName.toLowerCase(); + } + java.sql.ResultSet rs = ((java.sql.Connection) connection).getMetaData().getPrimaryKeys("", "", quotelessTableName); for (; rs.next(); i++ ) {