10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Handling Database ErrorsIf a database operation was successful, the value of the returned status andDataStream's ErrorNo attribute is ER_OK. If the operation was unsuccessful,the ErrorNo attribute contains the triggering error number. Because theErrorNo attribute can be set by operations that fail in the client as well as theDBMS, use the value in the IsDBError attribute to determine whether the erroroccurred in the DBMS.In addition to the ErrorNo and IsDBError attributes available to all DataStreamobjects, the QueryObject subclass provides the ZeroRowIsError parameter tothe methods that access the DBMS (DBInsert, DBUpdate, and DBDelete).By default, not finding any rows that satisfy an insert, update, or delete query(and therefore not changing the queried table) does not cause an error. If youwant this situation to be considered an error, set the ZeroRowIsErrorparameter to TRUE.For an example of error-checking while opening a DataStream object, see HowYou Can Run the SQLSelect Query (see page 170). For an example using theZeroRowIsError parameter, see How You Can Update Data with a Query Object(see page 181).How You Can Use BitmapObject and StringObject MethodsThe BitmapObject and StringObject system class methods that access thedatabase (InsertIntoDB, DeleteFromDB, and UpdateInDB) indicate errors intwo ways:• The return value is set to a nonzero error code if the method does notexecute successfully.• The DBSessionObject attributes ErrorNumber and DBMSError are set to theappropriate error number if a DBMS error occurs during the execution ofthe method.How You Can Use LongByteObject and LongVCharObject MethodsThe LongByteObject and LongVCharObject system class methods that accessthe database (FetchFromDB and UpdateInDB) indicate errors in the followingways:• The return value is set to a nonzero error code if the method does notexecute successfully.• The DBSessionObject attributes ErrorNumber and DBMSError are set to theappropriate error number if a DBMS error occurs during the execution ofthe method.200 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!