From: | Gayathri Manoj <gayathri(dot)annur(at)gmail(dot)com> |
---|---|
To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #9894: SQLError() is not returns SQL_NO_DATA_FOUND |
Date: | 2014-04-08 04:36:19 |
Message-ID: | CAKqy4TPgp8pVxTHoF61UrpTE3U4GoBcRnPAc4VS0pw1yZaVNeg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hi Michel,
Thanks for your response.
I changed SQLRETURN instead of RETCODE.
My postgress driver version is psqlodbc-09.01.0100.
my code is mentioned below and its worked fine for old version. For
missing table first i will get rc as HY000 and then next iteration i will
get 00000.
But in later version I am getting 42P01 and its looping. If i add an if
condition to to break the loop for the error case 42P01 then its working.
So please let me know do we have to handle each case separately or any
behavior change happens to the SQLError() API in later versions.
bool ODBCConn: errors(()
{
SQLRETURN rc = SQL_SUCCESS;
while (rc !=SQL_NO_DATA_FOUND) {
rc = SQLError(henv, hdbc, hstmt, sqlstate, &nativeerr, errmsg,
SQL_MAX_MESSAGE_LENGTH
- 1, &actualmsglen);
if (rc != SQL_NO_DATA_FOUND) {
if(strcmp(state,"01004")==0)
return true;
else {
code to compare some general error (
"08S01", "08001""08004",.."S1T00")
discoonect db;
}
}
}
return true;
}
Please let me know how can post this same mail thread to
pgsql-odbc<http://www.postgresql.org/mailpref/pgsql-odbc>
.
Thanks,
Gayathri
On Tue, Apr 8, 2014 at 7:05 AM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com>wrote:
> On Mon, Apr 7, 2014 at 8:36 PM, <gayathri(dot)annur(at)gmail(dot)com> wrote:
> > The following bug has been logged on the website:
> > PostgreSQL version: 9.1.1
> You are missing years of bug fixing, some of them being critical from
> security viewpoint. you should try to update to 9.1.13, the latest
> minor release of Postgres 9.1 asap.
>
> > SQLError() is not returning SQL_NO_DATA_FOUND after driver upgrade from
> 7 to
> > 9.
> >
> > my code looks like
> >
> > RETCODE rc = SQL_SUCCESS;
> > while ( rc != SQL_NO_DATA_FOUND)
> > {
> > rc = SQLError(henv, hdbc, hstmt, sqlstate, &nativeerr, errmsg,
> > SQL_MAX_MESSAGE_LENGTH - 1, &actualmsglen);
> >
> > }
> > And whenever I try to access an missing table, I am getting sqlstate as
> > 42P01 and rc as SQL_SUCCESS and it is not coming out of the loop. The
> same
> > code worked fine for earlier version.
> A couple of things:
> - SQLError is an API of the ODBC driver, this has directly nothing to
> do with Postgres itself, so this bug report should be sent to
> pgsql-odbc
> - You should avoid RETCODE here, SQLRETURN should be used with
> SQLError, even if intrinsically both are signed short integers...
>
> > Please let me know how can I proceed further. Shall I need to handle each
> > state separately?
> It is hard to guess what you are doing wrong here without knowing the
> version of the Postgres ODBC driver you are using. The settings of
> your driver would also help. The code you cite here is incomplete as
> well. It is not possible to guess what you are doing wrong with this
> statement handle.
> Regards,
> --
> Michael
>
From | Date | Subject | |
---|---|---|---|
Next Message | Niels Kristian Schjødt | 2014-04-08 08:02:46 | Re: BUG #9895: Duplicate pkey |
Previous Message | Michael Paquier | 2014-04-08 01:35:27 | Re: BUG #9894: SQLError() is not returns SQL_NO_DATA_FOUND |