Upon a successful execution, the return code is only set if a non-NULL data
model is returned:
if (GDA_IS_DATA_MODEL (model))
result = gda_data_model_get_n_rows (model);
The MySQL provider will never return a data model for non-queries:
if (! g_ascii_strncasecmp (tststr, "SELECT", 6) ||
! g_ascii_strncasecmp (tststr, "SHOW", 4) ||
! g_ascii_strncasecmp (tststr, "DESCRIBE", 6) ||
! g_ascii_strncasecmp (tststr, "EXPLAIN", 7)) {
mysql_res = mysql_store_result (mysql);
recset = gda_mysql_recordset_new (cnc,
mysql_res,mysql);
...
}
else {
...
/* don't return a data model */
reclist = g_list_append (reclist, NULL);
Also, from what I can tell from a quick look at the Oracle provider, it too will
possibly not return a data model.
This all means that the return code will never be 0 for successful calls that
return a NULL data model. Setting it explicitly is necessary.
Bob
--
Bob Ham
> -----Original Message-----
> From: Rodrigo Moya [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 02, 2005 10:23 AM
> To: Bob Ham
> Cc: [email protected]
> Subject: Re: [gnome-db] [PATCH] libgda/gda-connection.c
>
> On Mon, 2005-10-31 at 18:26 +0000, Bob Ham wrote:
> > Fixes the return code in gda_connection_execute_non_query.
> >
> result is already being initialized to -1 when declared, so why do you
> need to set it to 0 there?
> --
> Rodrigo Moya <[EMAIL PROTECTED]>
>
_______________________________________________
gnome-db-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-db-list