From: | Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp> |
---|---|
To: | Kristis Makris <kristis(dot)makris(at)datasoft(dot)com> |
Cc: | pgsql-odbc(at)postgresql(dot)org |
Subject: | Re: Error messages not always reported through the ODBCdriver -STATEMENT ERROR missing |
Date: | 2001-08-28 02:35:17 |
Message-ID: | 3B8B0365.26654CBB@tpf.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Gilles DAROLD | 2001-08-28 17:07:43 | Problem with libpsqlodbc |
Previous Message | Kristis Makris | 2001-08-27 20:20:04 | Re: Error messages not always reported through the ODBCdriver -STATEMENT ERROR missing |