Re: [gnome-db] gda_connection_statement_to_sql() without a connection

On Wed, 2011-11-09 at 22:46 +0100, Vivien Malerba wrote:

> It's now in commit
Thanks. I made a small correction:

However, there is now a crash when calling 

I could probably create a C test case, but this is what valgrind tells
me when I use it in Glom:

==7157== Process terminating with default action of signal 11 (SIGSEGV)
==7157==  Access not within mapped region at address 0x0
==7157==    at 0x67D1FB6: _gda_postgres_meta__btypes
==7157==    by 0x4863AA2: local_meta_update (gda-connection.c:4339)
==7157==    by 0x4866332: gda_connection_update_meta_store
==7157==    by 0x42B6EBF:

That crash can be fixed with the attached patch but then
gda_connection_statement_to_sql() warns like so:
  sys:1: Warning: g_string_append: assertion `val != NULL' failed
at this point because gda_sql_identifier_quote() returns NULL:

#1  0x00d4a470 in g_return_if_fail_warning (log_domain=0xdcdda3 "GLib",
pretty_function=0xdcdf8a "g_string_append", 
    expression=0xdcddf2 "val != NULL") at gmessages.c:800
#2  0x00d64e29 in g_string_append (string=0x84dd870, val=0x0) at
#3  0x009a8064 in default_render_expr (expr=0x84b27c8,
context=0xbfffe894, is_default=0x0, is_null=0x0, error=0xbfffe9dc)
    at gda-statement.c:1505
#4  0x009a9756 in default_render_select_field (field=0x8425e98,
context=0xbfffe894, error=0xbfffe9dc) at gda-statement.c:2007
#5  0x009a71fa in default_render_select (stmt=0x832bd30,
context=0xbfffe894, error=0xbfffe9dc) at gda-statement.c:1176
#6  0x009a5ece in gda_statement_to_sql_real (stmt=0x84e1600,
context=0xbfffe894, error=0xbfffe9dc) at gda-statement.c:751
#7  0x009a62fa in gda_statement_to_sql_extended (stmt=0x84e1600,
cnc=0x8224470, params=0x0, flags=GDA_STATEMENT_SQL_PRETTY, 
    params_used=0x0, error=0xbfffe9dc) at gda-statement.c:845
#8  0x0093ca4f in gda_connection_statement_to_sql (cnc=0x8224470,
stmt=0x84e1600, params=0x0, flags=GDA_STATEMENT_SQL_PRETTY, 
    params_used=0x0, error=0xbfffe9dc) at gda-connection.c:2811

So the resulting query looks like this:
WHERE . = 'Born To Run'


murrayc murrayc com
diff --git a/providers/reuseable/postgres/gda-postgres-meta.c b/providers/reuseable/postgres/gda-postgres-meta.c
index 1a46a36..df0a78a 100644
--- a/providers/reuseable/postgres/gda-postgres-meta.c
+++ b/providers/reuseable/postgres/gda-postgres-meta.c
@@ -311,7 +311,7 @@ _gda_postgres_provider_meta_init (GdaServerProvider *provider)
-#define GDA_POSTGRES_GET_REUSEABLE_DATA(cdata) (* ((GdaPostgresReuseable**) (cdata)))
+#define GDA_POSTGRES_GET_REUSEABLE_DATA(cdata) ( cdata ? * ((GdaPostgresReuseable**) (cdata)) : NULL )
 _gda_postgres_meta__info (G_GNUC_UNUSED GdaServerProvider *prov, GdaConnection *cnc,

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]