1515import org .postgresql .util .PSQLException ;
1616
1717
18- /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.10 2002/11/04 06:42:33 barry Exp $
18+ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.11 2002/12/23 16:12:36 davec Exp $
1919 * This class defines methods of the jdbc2 specification. This class extends
2020 * org.postgresql.jdbc1.AbstractJdbc1ResultSet which provides the jdbc1
2121 * methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2ResultSet
@@ -1009,7 +1009,9 @@ public synchronized void updateRow()
10091009{
10101010
10111011String column = (String )columns .nextElement ();
1012- updateSQL .append (column +"= ?" );
1012+ updateSQL .append ("\" " );
1013+ updateSQL .append (column );
1014+ updateSQL .append ("\" = ?" );
10131015
10141016if (i <numColumns -1 )
10151017{
@@ -1026,7 +1028,9 @@ public synchronized void updateRow()
10261028{
10271029
10281030PrimaryKey primaryKey = ((PrimaryKey )primaryKeys .get (i ));
1029- updateSQL .append (primaryKey .name ).append ("= ?" );
1031+ updateSQL .append ("\" " );
1032+ updateSQL .append (primaryKey .name );
1033+ updateSQL .append ("\" = ?" );
10301034
10311035if (i <numKeys -1 )
10321036{
@@ -1328,7 +1332,16 @@ boolean isUpdateable() throws SQLException
13281332else
13291333{
13301334// otherwise go and get the primary keys and create a hashtable of keys
1331- java .sql .ResultSet rs = ((java .sql .Connection )connection ).getMetaData ().getPrimaryKeys ("" ,"" ,tableName );
1335+ // if the user has supplied a quoted table name
1336+ // remove the quotes, but preserve the case.
1337+ // otherwise fold to lower case.
1338+ String quotelessTableName ;
1339+ if (tableName .startsWith ("\" " ) &&tableName .endsWith ("\" " )) {
1340+ quotelessTableName =tableName .substring (1 ,tableName .length ()-1 );
1341+ }else {
1342+ quotelessTableName =tableName .toLowerCase ();
1343+ }
1344+ java .sql .ResultSet rs = ((java .sql .Connection )connection ).getMetaData ().getPrimaryKeys ("" ,"" ,quotelessTableName );
13321345
13331346
13341347for (;rs .next ();i ++ )