Re: [gnome-db] gda_connection_execute_non_select_command ()
- From: Bas Driessen <bas driessen xobas com>
- To: Vivien Malerba <vmalerba gmail com>
- Cc: GNOME-DB List <gnome-db-list gnome org>
- Subject: Re: [gnome-db] gda_connection_execute_non_select_command ()
- Date: Tue, 12 Sep 2006 10:58:53 +1000
On Mon, 2006-09-11 at 16:11 +0200, Vivien Malerba wrote:
On 9/11/06, Bas Driessen <bas driessen xobas com> wrote:
>
> Hi Vivien,
>
> Testing the new gda_connection_execute_non_select_command
> () function at the moment, but this function always returns -2. I have
> tested for both MySQL as PostgreSQL. The data is updated correctly in the
> database, but the return value is -2. Is this function still under
> construction?
>
> Example use:
>
> GdaCommand *command = NULL;
> gint number = 0;
>
> const gchar *sql = "update parts set price = 1.23 where part_id = '12345'"
>
> command = gda_command_new (buffer, GDA_COMMAND_TYPE_SQL,
> GDA_COMMAND_OPTION_STOP_ON_ERRORS);
>
> number = gda_connection_execute_non_select_command
> (connection, command, NULL, NULL);
>
> printf("NUMBER !! %d\n", number)
>
> gda_command_free (command);
>
> Let me know if you see something obvious that I do wrong?
No, you did nothing wrong. I did some code and as I was in a hurry I
did not test it properly. Anyway, the problem is in the new
gda_parameter_list_new_inline() function. Please apply the attached
patch and it should be better.
Hi Vivien,
Did some initial testing for both PostgreSQL and MySQL. PostgreSQL works as expected. If I update 3 rows, I get the value 3 back. However, MySQL behaves differently. If I update 3 rows, it gives me back the number 3, which is correct. If I then execute the same command again, it returns 0. Reason is that even though I update the same 3 rows again, it really does not change the data in the end. Theoretically this is correct, but if I execute the same UPDATE statement in the mysql console multiple times, I always get the number 3 back.
So, both PostgreSQL as MySQL should behave the same I reckon. Since both the psql as mysql console always report the number of rows affected (even though data may physically not been changed), I believe we should go with that approach and get MySQL results in line with PostgreSQL results.
Thanks,
Bas.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]