GNOME Bugzilla – Bug 663357
SQLite: GdaBinary (escaped) values are not quoted
Last modified: 2011-11-04 21:33:20 UTC
Created attachment 200647 [details] test_libgda_sqlite_binary.tar.gz This test case shows that GdaSqlBuilder generates invalid SQL when using a GdaBinary value. This does work with PostgreSQL.
This has been corrected in commit http://git.gnome.org/browse/libgda/commit/?id=c58ba73cf64c338a7cab664fab42f6aba48ac097 Can you check? (I'll make a 5.0.1 this WE).
As a side note about the test case, please note that in order to get a GdaBinary value, you need to request it as SQLite will otherwise give you a GdaBlob, see the following PATCH for your test.c file: --- test.c.orig 2011-11-03 22:33:38.000000000 +0100 +++ test.c 2011-11-04 18:10:53.844673925 +0100 @@ -93,8 +93,11 @@ } g_assert(stmt); - GdaDataModel* model = gda_connection_statement_execute_select( - conn, stmt, NULL, &error); + GType types[2]; + types[0] = GDA_TYPE_BINARY; + types[1] = G_TYPE_NONE; + GdaDataModel* model = gda_connection_statement_execute_select_full( + conn, stmt, NULL, GDA_STATEMENT_MODEL_RANDOM_ACCESS, types, &error); if (error) { g_warning("gda_connection_statement_execute_select() failed: %s\n", error->message); g_clear_error(&error);
Thanks again. Yes, that fixed it. I had noticed recently, while reading the libgda documentation, that sqlite returns a GdaBlob so I took this chance to deal with that too. For me, it's easier to deal with that possible type than to request all types. Thanks for the reminder.