Re: [gnome-db] GdaConnectionEvent and GdaDataModel issues



On 3/14/07, Piotr Pokora <piotrek pokora gmail com> wrote:

Hi!

What is the way to get SQL query from GdaConnectionEvent?

gda_connection_event_get_description works while
gda_connection_event_get_source and gda_connection_event_get_sqlstate
returns NULL.

Example code is:

g_signal_connect(G_OBJECT(connection), "error",
                        G_CALLBACK(_connect_cnc_callback), NULL);

static void _connect_cnc_callback(GdaConnection *cnc,
                GdaConnectionEvent *event, gpointer ud)
{
g_warning("Connection error: %s, No:(%li), src:%s \n\n SQL: %s",
                        gda_connection_event_get_description(event),
                        (long) gda_connection_event_get_code(event),
                        gda_connection_event_get_source(event),
                        gda_connection_event_get_sqlstate (event));
}

Output ( SQLite ):

Connection error: no such table: person, No:(0), src:(null)

 SQL: (null)

Output ( MySQL ):

Connection error: Unknown column 'hashtype' in 'field list', No:(1054), src:gda-mysql

 SQL: Not available

Is there anything I do wrong here?

No, it's correct. What each GdaConnectionEvent contains is decided by
each provider, so if you don't get what you expected, the providers
are the ones to blame, and of course it's possible to improve them and
make them set the correct properties in the GdaConnectionEvent.


Also is bug for gda_data_model_get_column_index_by_name created or reported?
I didn't check libgda issue tracker recently and I have no account there , but this function
simply can not work.

Not that I'm aware of. Could you provide some code to reproduce the
problem? Also you can fill a bugzilla report (I don't think you need
an account to do that).

Regards,

Vivien



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