After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 608707 - gda_sql_parser_parse_string initializes GdaStatement with UNKNOWN type
gda_sql_parser_parse_string initializes GdaStatement with UNKNOWN type
Status: RESOLVED NOTABUG
Product: libgda
Classification: Other
Component: general
4.0.x
Other Linux
: Normal blocker
: ---
Assigned To: malerba
gnome-db Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-02-01 18:27 UTC by Piotr Pokora
Modified: 2010-02-02 21:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Piotr Pokora 2010-02-01 18:27:09 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).
Comment 1 malerba 2010-02-02 12:26:33 UTC
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'
Comment 2 malerba 2010-02-02 12:37:37 UTC
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*/
Comment 3 Piotr Pokora 2010-02-02 15:10:42 UTC
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.
Comment 4 malerba 2010-02-02 19:41:02 UTC
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?
Comment 5 Piotr Pokora 2010-02-02 20:21:18 UTC
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.
Comment 6 malerba 2010-02-02 21:09:11 UTC
Ok, closing it then.