From: | Oguz Imre <maccube(at)comcast(dot)net> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Single quote instead of double? |
Date: | 2003-03-15 18:28:10 |
Message-ID: | E0002D36-5713-11D7-94F9-003065A215CC@comcast.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Gentle people,
When I run the following code, I get the resulting output which
PostgreSQL balks at. Is there a switch or something to yield single
quote? Kindly advise.
Code snippet: (from TableExample)
String query =
"update site_sifre"+
//hard coded the tablename as String tableName =
" set "+columnName+" = "+dbRepresentation(column,
value)+ // metaData.getTableName(column+1); returns "null"
" where ";
// We don't have a model of the schema so we don't know the
// primary keys or which columns to lock on. To demonstrate
// that editing is possible, we'll just lock on everything.
for(int col = 0; col<getColumnCount(); col++) {
String colName = getColumnName(col);
if (colName.equals("")) {
continue;
}
if (col != 0) {
query = query + " and ";
}
query = query + colName +" = "+
dbRepresentation(col, getValueAt(row, col));
}
System.out.println(query);
//System.out.println("Not sending update to database");
statement.executeQuery(query);
}
catch (SQLException e) {
e.printStackTrace();
System.err.println("Update failed");
}
Vector dataRow = (Vector)rows.elementAt(row);
dataRow.setElementAt(value, column);
}
===== OUTPUT ===
update site_sifre set username = "test this, too,again "
where site_sifreid = "realOnePlayer " and username = "test
this, too " and sifre = "ssssssss " and confirmdate =
"2003-03-14 19:18:50.319598"
java.sql.SQLException: ERROR: Attribute "test this, too,again
" not found
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
.
.
.
If I replace the double quote with single and run this update in the
SQL Commander window of DbVisualizer, it works fine.
Table is:
create table site_sifre(
site_sifreid char(25),
userName char(25),
sifre char(15),
confirmDate timestamp
);
Using:
JDK 1.4.1
Mac OSX, 10.2.4
PostgreSQL 7.3
PostgreSQL Native Driver
PostgreSQL 7.3.1 JDBC2 jdbc driver build 107
DbVisualizer gives in depth info regarding Database, and what setting
are. Too lengthy to include here, but here are a few:
Attribute
----------------------------------- --------
.
.
storesUpperCaseQuotedIdentifiers false
storesLowerCaseQuotedIdentifiers false
storesMixedCaseQuotedIdentifiers false
getIdentifierQuoteString "
getSearchStringEscape \
.
.
From | Date | Subject | |
---|---|---|---|
Next Message | Vernon Wu | 2003-03-15 18:35:08 | Re: Single quote instead of double? |
Previous Message | Barry Lind | 2003-03-15 04:16:03 | Re: CallableStatement, functions and ResultSets |