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

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

I found that CommitTrans() doesn't throw an exception.
You may have to check the return code of CommitTrans().

Too late detection of an error is another issue.
I'm examining it.

regards,
Hiroshi Inoue

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

Предыдущее
От: Kristis Makris
Дата:
Сообщение: Re: Error messages not always reported through the ODBCdriver -STATEMENT ERROR missing
Следующее
От: Gilles DAROLD
Дата:
Сообщение: Problem with libpsqlodbc