Re: Error messages not always reported through the ODBC driver -STATEMENT ERROR missing

From: Kristis Makris <kristis(dot)makris(at)datasoft(dot)com>
To: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: Error messages not always reported through the ODBC driver -STATEMENT ERROR missing
Date: 2001-08-24 15:51:26
Message-ID: 200108241551.f7OFpUf14728@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi Hiroshi,

Thanks for looking into this.

> > conn=33461048, query='BEGIN'
> > conn=33461048, query='SELECT Vendor_Remove(1)'
> > [ fetched 1 rows ]
> > conn=33461048, query='COMMIT'
> > ERROR from backend during send_query: 'ERROR: <unnamed> referential
> > integrity violation - key in vendor still referenced from
> > vendorforwellagreement'
> > CONN ERROR: func=SQLTransact, desc='', errnum=110, errmsg='ERROR:
>
> The error seems to have occured at SQLTransact().
> Probbably you should catch the error at CommitTrans() not at
> ExecuteSQL().

Good observation, that makes perfect sense. I now modified my source so
that the CommitTrans() is called within the try block. Here's the exact
source:

******************************************************************************************
try
{
if (db.CanTransact())
db.BeginTrans();

strStmt = "SELECT Vendor_Remove(";
strStmt += LongToString(lID);
strStmt += ")";

db.ExecuteSQL(strStmt);

if (db.CanTransact())
db.CommitTrans();

}
catch (CDBException* pEx)
{
if (db.CanTransact())
db.Rollback();

pEx->ReportError();
pEx->Delete();

AfxMessageBox(_T("Record (Vendor) Delete Failed!"));
return FALSE;
}

return TRUE;

******************************************************************************************

However, I'm still unable to capture an exception. Program execution
goes past the ExecuteSQL(), past the CommitTrans(), and skips over the
catch block. Isn't that bizzare?

Here's the error message I'm now getting in the logs (still no STATEMENT ERROR):

******************************************************************************************
conn=33460928, query='BEGIN'
conn=33460928, query='SELECT Vendor_Remove(1)'
[ fetched 1 rows ]
conn=33460928, query='COMMIT'
ERROR from backend during send_query: 'ERROR: <unnamed> referential
integrity violation - key in vendor still referenced from
vendorforwellagreement'
CONN ERROR: func=SQLTransact, desc='', errnum=110, errmsg='ERROR:
<unnamed> referential integrity violation - key in vendor still
referenced from vendorforwellagreement'
------------------------------------------------------------
henv=33479888, conn=33460928, status=1, num_stmts=16
sock=33479928, stmts=33475656, lobj_type=-999
---------------- Socket Info -------------------------------
socket=512, reverse=0, errornumber=0, errormsg='(NULL)'
buffer_in=33467416, buffer_out=33471536
buffer_filled_in=162, buffer_filled_out=0,
buffer_read_in=162
conn=33460928, SQLDisconnect

******************************************************************************************

> >
> > Incidentally, I have a couple more questions about the driver in
> > general:
> >
> > 1) I've noticed that the 7.01.00.06 driver reports in the logs that it
> > is a 7.01.0005 driver. Is this nomral? Is this a known bug?
> >
> > "Global Options: Version='07.01.0005'"
>
> Hmm strange, what does Control Panel show ?

The Control Panel reports that I'm using the 7.01.00.06 version of the
driver. I'm sure that I'm not using the 7.01.00.05 version, since the
.05 had a problem with reporting correctly the NOTICEs reported by the
backend. I do not have that problem with the current driver I'm using
(.06?). I had installed the .06 version using the installation utility
provided.

What version do you guys get reported in your log files?

Thanks,
-Kristis

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Hiroshi Inoue 2001-08-24 16:40:53 RE: ODBC include files
Previous Message Jeff Eckermann 2001-08-24 14:56:06 Re: problems transfering databases