Subject RE: [firebird-support] with wrong sql i get no exception or firebird error
Author Paul Beach
<<i use the ibpp.org c++ lib. How can i get the firebird sql error in my c++ code?

for example the ISQL line:
SQL> INSERT INTO LOG(WAS) VALUES ('blabla');
causes the error:
Statement failed, SQLSTATE = 23000
validation error for column "LOG"."ID", value "*** null ***"

if postet with the c++ code:
IBPP::Transaction _tr = IBPP::TransactionFactory(db);
IBPP::Statement st = IBPP::StatementFactory(db, _tr);
_tr->Start();
st->Prepare("INSERT INTO LOG(WAS) VALUES (?)");
st->Set(1, "blabla");
st->Execute();
_tr->Commit();

i get no error...nothing! No Record is created.
In other error cases i get an ibpp message with try catch IBPP::Exception& e
somethin like.

*** IBPP::LogicException ***
Context: Statement::Set[char*]
Message: The statement does not take parameters.

but never the real firebird error.

How can get this errors?>>

Probably by using
Class::SQLException

http://www.ibpp.org/reference/exceptions

Paul