GNOME Bugzilla – Bug 131040
can't handle queries that include ';'
Last modified: 2006-05-12 16:28:26 UTC
I'm using the following: libgda 1.0.2, Python 2.3.3, PyGTK 2.0.0, and PostgreSQL 7.3.2. A query that includes a semi-colon in a quoted string does not return any results with the PostgreSQL provider, even with the execute_single_command() method; e.g., select bar from jcw.foo where qux <> ';' This problem does not occur with ODBC provider. I got similar results with MySQL 3.23.55.
*** Bug 326325 has been marked as a duplicate of this bug. ***
The reason is that providers use a simple cut-at-the-semi-columns algorithm to separate the statements from within a single string, which is obviously wrong in cases like the one mentionned. I'm working on a better way of splitting strings to identify all the statements.
So, I guess this is NOTABUG because we should be escaping the ; in strings. I think I do that in Glom already. I think there's libgda API for escaping strings now too. Presumably, when we can build libgda queries without SQL then it will automatically escape string values.
Not really because providers are expected to handle SQL commands which are composed of several SQL statements separated by a semi-column, and run each SQL statement one after the other. It's that splitting of individual SQL statements which is broken at this time.
Commited a correction to CVS. Closing that bug.