From: | "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk> |
---|---|
To: | "Tim Woodall" <tim(at)woodall(dot)me(dot)uk> |
Cc: | <pgsql-odbc(at)postgresql(dot)org> |
Subject: | Re: Bug in ODBC driver doing UPDATES and DELETES (fwd) |
Date: | 2003-06-19 16:11:13 |
Message-ID: | 03AF4E498C591348A42FC93DEA9661B844B0C4@mail.vale-housing.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
Thanks Tim, patch applied.
Regards, Dave
> -----Original Message-----
> From: Tim Woodall [mailto:tim(at)woodall(dot)me(dot)uk]
> Sent: 19 June 2003 16:59
> To: Dave Page
> Subject: RE: [ODBC] Bug in ODBC driver doing UPDATES and DELETES (fwd)
>
>
> Hi Dave,
>
> >
> >
> > > -----Original Message-----
> > > From: Tim Woodall [mailto:tim(at)woodall(dot)me(dot)uk]
> > > Sent: 18 June 2003 14:55
> > > To: Dave Page
> > > Subject: Re: [ODBC] Bug in ODBC driver doing UPDATES and
> DELETES (fwd)
> > >
> > >
> > > Including supplying a patch that
> > > applies cleanly against CVS.
> >
> > Hi Tim,
> >
> > If you could please, that would be good. That file's
> changed a bit and
> > I don't have much time to do it myself right now.
> >
>
> I've included it below. Applies cleanly against 1.78 of statement.c
>
> Is the comment right at the top of the patch about
> was_rows_affected OK or do you want me to remove it?
>
> I've also corrected the formatting of the two if() statements
> from the previous patch that I have added. (I don't usually
> put a space between
> the "if" and the "(" )
>
> Regards,
>
> Tim.
>
>
> Index: statement.c
> ===================================================================
> RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/statement.c,v
> retrieving revision 1.78
> diff -u -r1.78 statement.c
> --- statement.c 27 May 2003 05:20:09 -0000 1.78
> +++ statement.c 19 Jun 2003 15:52:41 -0000
> @@ -1022,7 +1022,12 @@
> static char *func = "SC_execute";
> ConnectionClass *conn;
> APDFields *apdopts;
> - char was_ok, was_nonfatal;
> + char was_ok, was_nonfatal, was_rows_affected = 1;
> + /* was_rows_affected is set to 0 iff an UPDATE or
> DELETE affects
> + * no rows. In this instance the driver should return
> + * SQL_NO_DATA_FOUND instead of SQL_SUCCESS.
> + */
> +
> QResultClass *res = NULL;
> Int2 oldstatus,
> numcols;
> @@ -1142,6 +1147,13 @@
> {
> was_ok = QR_command_successful(res);
> was_nonfatal = QR_command_nonfatal(res);
> + if (res->command &&
> + (strncmp(res->command, "UPDATE", 6) == 0 ||
> + strncmp(res->command, "DELETE", 6) == 0) &&
> + strtoul(res->command + 7, NULL, 0) == 0)
> + {
> + was_rows_affected = 0;
> + }
>
> if (was_ok)
> SC_set_errornumber(self, STMT_OK);
> @@ -1244,7 +1256,10 @@
> }
> }
> if (SC_get_errornumber(self) == STMT_OK)
> - return SQL_SUCCESS;
> + if (was_rows_affected)
> + return SQL_SUCCESS;
> + else
> + return SQL_NO_DATA_FOUND;
> else if (SC_get_errornumber(self) == STMT_INFO_ONLY)
> return SQL_SUCCESS_WITH_INFO;
> else
>
> --
> God said, "div D = rho, div B = 0, curl E = - @B/@t, curl H =
> J + @D/@t,"
> and there was light.
>
http://tjw.hn.org/ http://www.locofungus.btinternet.co.uk/
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Gamache | 2003-06-19 20:09:53 | Re: version considerations |
Previous Message | Chris Gamache | 2003-06-19 15:40:27 | Getting intermittent 800a01fb errors - repost... |