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

Поиск
Список
Период
Сортировка
От Kristis Makris
Тема Re: Error messages not always reported through the ODBC driver -STATEMENT ERROR missing
Дата
Msg-id 200108241551.f7OFpUf14728@postgresql.org
обсуждение исходный текст
Ответ на Re: Error messages not always reported through the ODBC driver -STATEMENT ERROR missing  (Hiroshi Inoue <Inoue@tpf.co.jp>)
Ответы Re: Error messages not always reported through the ODBC  (Kristis Makris <kristis.makris@datasoft.com>)
Список 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


В списке pgsql-odbc по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: ODBC include files
Следующее
От: Kristis Makris
Дата:
Сообщение: Re: Error messages not always reported through the ODBC driver -STATEMENT ERROR missing