Past Single quote instead of double? But there's more

From: Oguz Imre <maccube(at)comcast(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Cc: maccube(at)comcast(dot)net
Subject: Past Single quote instead of double? But there's more
Date: 2003-03-15 22:26:07
Message-ID: 1D8A4BD6-5735-11D7-94F9-003065A215CC@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Now I get the following error message. I display a table, then edit one
of the cells, so I update the row. Can anyone suggest What I am doing
wrong.
Thanks

=================
before edit
update site_sifre set username = "test this, too. Please! " where
site_sifreid = "realOnePlayer " and username = "test this,
too. Please! " and sifre = "sekizlik " and confirmdate =
"2003-03-14 19:18:50.319598"

after edit
update site_sifre set username = 'test this, too. Please! ' where
site_sifreid = 'realOnePlayer ' and username = 'test this,
too. Please! ' and sifre = 'ssssssss ' and confirmdate =
'2003-03-14 19:18:50.319598'
No results were returned by the query.
at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1St
atement.java:157)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1St
atement.java:141)
at JDBCAdapter.setValueAt(JDBCAdapter.java:240)
at TableSorter.setValueAt(TableSorter.java:278)
at javax.swing.JTable.setValueAt(JTable.java:1783)
at javax.swing.JTable.editingStopped(JTable.java:3129)
at
javax.swing.AbstractCellEditor.fireEditingStopped(AbstractCellEditor.jav
a:124)
at
javax.swing.DefaultCellEditor$EditorDelegate.stopCellEditing(DefaultCell
Editor.java:328)
at
javax.swing.DefaultCellEditor.stopCellEditing(DefaultCellEditor.java:213
)
at javax.swing.JTable$GenericEditor.stopCellEditing(JTable.java:3460)
at
javax.swing.DefaultCellEditor$EditorDelegate.actionPerformed(DefaultCell
Editor.java:345)
at javax.swing.JTextField.fireActionPerformed(JTextField.java:489)
at javax.swing.JTextField.postActionEvent(JTextField.java:670)
at
javax.swing.JTextField$NotifyAction.actionPerformed(JTextField.java:784)
at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1510)
at javax.swing.JComponent.processKeyBinding(JComponent.java:2435)
at javax.swing.JComponent.processKeyBindings(JComponent.java:2470)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2398)
at java.awt.Component.processEvent(Component.java:4902)
at java.awt.Container.processEvent(Container.java:1566)
at java.awt.Component.dispatchEventImpl(Component.java:3598)
at java.awt.Container.dispatchEventImpl(Container.java:1623)
at java.awt.Component.dispatchEvent(Component.java:3439)
at
java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:
1688)
at
java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFoc
usManager.java:593)
at
java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboard
FocusManager.java:765)
at
java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboard
FocusManager.java:698)
at
java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusM
anager.java:559)
at java.awt.Component.dispatchEventImpl(Component.java:3468)
at java.awt.Container.dispatchEventImpl(Container.java:1623)
at java.awt.Window.dispatchEventImpl(Window.java:1585)
at java.awt.Component.dispatchEvent(Component.java:3439)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThrea
d.java:230)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.
java:183)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
Update failed

On Saturday, March 15, 2003, at 01:28 PM, Oguz Imre wrote:

> 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 \
> .
> .

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Michael Paesold 2003-03-15 23:17:38 Re: Past Single quote instead of double? But there's more
Previous Message Oguz Imre 2003-03-15 22:21:57 Re: Single quote instead of double?