RE: [gnome-db] [PATCH] libgda/gda-connection.c



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:rodrigo gnome-db org]
> Sent: Wednesday, November 02, 2005 10:23 AM
> To: Bob Ham
> Cc: gnome-db-list gnome org
> 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 <rodrigo gnome-db org>
> 





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