RWDBInserter.isValid() always returns OK even the SQL generated is incorrect

Article ID: 908
Last updated: 05 Feb, 2008
Article ID: 908
Last updated: 05 Feb, 2008
Revision: 1
Views: 2938
Posted: 17 Dec, 1997
by Dean J.
Updated: 05 Feb, 2008
by Dean J.
Problem


I have an RWDBInserter object and executed. I know there is a semantic error. But when I check my inserter object status with the isValid() function, it shows ok. Why?


Cause


RWDBInserter is one of big objects which can be re-used. For instance, it can be executed many times. That's why a particular execution should not been bounded with its object.


Action


 

DBTools uses RWDBResult to reflect each execution. So the RWDBResult object
should be checked to see if this time the execution has succeeded or not.
Here is an example:

RWDBInserter ins= myTable.inserter();
ins << 10;
RWDBResult res= ins.execute(myConnection);
if( res.isValid() )
{
//...
}
else
{
//...
}

Or the user can use error call back function to catch errors.
Similar classes are RWDBSelector, RWDBUpdater, RWDBStoredProc, etc.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 908
Last updated: 05 Feb, 2008
Revision: 1
Views: 2938
Posted: 17 Dec, 1997 by Dean J.
Updated: 05 Feb, 2008 by Dean J.

Others in this category