GNOME Bugzilla – Bug 608707
gda_sql_parser_parse_string initializes GdaStatement with UNKNOWN type
Last modified: 2010-02-02 21:09:11 UTC
This function initializes GdaStatement with UNKNOWN type when parsing valid UPDATE query. Query example: UPDATE person SET ## /*name:'metadata_locked' type:gchararray*/, ## /*name:'metadata_locker' type:gchararray*/, ## /*name:'metadata_islocked' type:gboolean*/, ## /*name:'metadata_revisor' type:gchararray*/, ## /*name:'metadata_revised' type:gchararray*/, ## /*name:'metadata_revision' type:guint*/ WHERE person.guid = 'f6b665f1984503790ed91f39b11b5392' Query executed by db provider (MySQL in this case): UPDATE person SET '2010-02-01 17:08:30+0000', 'f6b665f1984503790ed91f39b11b5392', TRUE, 'f6b665f1984503790ed91f39b11b5392', '2010-02-01 17:08:30+0000', 2 WHERE person.guid = 'f6b665f1984503790ed91f39b11b5392' If I understood docs (http://library.gnome.org/devel/libgda/stable/GdaSqlParser.html#GdaSqlParser.description) correctly, UNKNOWN type should not be set for UPDATE query. Reproducable with GDA 4.0.6 and 4.0 branch (4.0.7).
The query is not a valid UPDATE: the columns' names to update is missing. A correct statement would be: UPDATE person SET a = ## /*name:'metadata_locked' type:gchararray*/, b= ## /*name:'metadata_locker' type:gchararray*/, c= ## /*name:'metadata_islocked' type:gboolean*/, d= ## /*name:'metadata_revisor' type:gchararray*/, e= ## /*name:'metadata_revised' type:gchararray*/, f= ## /*name:'metadata_revision' type:guint*/ WHERE person.guid = 'f6b665f1984503790ed91f39b11b5392'
Also note that you'll have more readable SQL if you use the following notation: ##metadata_locked::string instead of: ## /*name:'metadata_locked' type:gchararray*/
I think I used first syntax with libgda 3.0.x. Is it incompatible now? Also, is syntax which you suggests, only valid for update queries? I tried 'a = ##colname::string', but it generates 'a = colname = foo', which is clearly wrong.
The 3.x syntax is still valid, but in version >= 4.0 there is a new more compact version. Can you be more specific with the code which produces the wrong result?
OK. Please close this bug. I have been confused while thinking about GDA3&GDA4 compatibility. Patterns 'colname = ##name::string' and '##name::string' works as expected in UPDATE and WHERE parts of query.
Ok, closing it then.