Subject | Aw: RE: [firebird-support] with wrong sql i get no exception or firebird error |
---|---|
Author | Harald Wolf |
Post date | 2019-11-15T11:45:34Z |
IBPP::Statement st = IBPP::StatementFactory(db, tr);
db->Connect();
tr->Start();
st->Execute("blabla"); // a correct sql statement here works well.
tr->Commit();
Von: "'Paul Beach' pbeach@... [firebird-support]" <firebird-support@yahoogroups.com>
An: firebird-support@yahoogroups.com
Betreff: RE: [firebird-support] with wrong sql i get no exception or firebird error
<<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