10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Handling Database ErrorsIn OpenROAD, you must check for DBMS errors after any database statementor method invocation that issues database statements. Use the tools describedin the following lists to check for errors.Two attributes defined for the DBSessionObject system class provide primaryerror-checking capability:• ErrorNumber• DBMSErrorDataStream objects provide their own error-checking tools:• ErrorNo attribute• IsDBError attribute• Status returned by methods that access the databaseIngres also provides the inquire_sql statement as an alternative tool.Errors that originate in other portions of the application, for example, from acalled procedure, are discussed in Errors Originating in Called 3GL Procedures(see page 151).How You Can Use the ErrorNumber and DBMSError AttributesEvery database session has access to errors that occur during the execution ofa database statement by accessing the values in the ErrorNumber andDBMSError attributes.ErrorNumberContains the generic error number associated with the errorDBMSErrorContains the database-specific error number associated with the errorA generic error represents a class of error, and the database-specific numberidentifies a specific error associated with a specific DBMS within that class.The values in ErrorNumber and DBMSError reflect the status of the lastdatabase statement that the application attempted to execute in the currentsession. If the statement was executed, each of these attributes is set to zero.If the statement did not execute because of an error, then these attributescontain the appropriate error numbers.These attributes are also set when an error occurs setting the DBHandleattribute of a bitmap or string object.198 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!