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 663357 - SQLite: GdaBinary (escaped) values are not quoted
SQLite: GdaBinary (escaped) values are not quoted
Status: RESOLVED FIXED
Product: libgda
Classification: Other
Component: Client library
5.0.x
Other Linux
: Normal normal
: ---
Assigned To: malerba
gnome-db Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-11-03 21:37 UTC by Murray Cumming
Modified: 2011-11-04 21:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test_libgda_sqlite_binary.tar.gz (2.30 KB, application/x-gzip)
2011-11-03 21:37 UTC, Murray Cumming
Details

Description Murray Cumming 2011-11-03 21:37:39 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.
Comment 1 malerba 2011-11-04 17:08:14 UTC
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).
Comment 2 malerba 2011-11-04 17:12:44 UTC
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);
Comment 3 Murray Cumming 2011-11-04 21:33:20 UTC
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.