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 ErrorsHow You Can Use the ErrorStatus AttributeThe ErrorStatus attribute of the BitmapObject and StringObject system classesis set to a nonzero value if an error occurs when you explicitly set theFileHandle or DBHandle attribute of either object. The following are ways to dothis in a program:• In an assignment statement• In the target list of a statement, such as a select statement• By passing the attribute by reference to a procedureIndirectly setting either attribute by executing one of the methods associatedwith BitmapObjects or StringObjects (InsertIntoDB, UpdateInDB,DeleteFromDB) does not affect the ErrorStatus attribute. For example, assumethat your application uses the InsertIntoDB method to add bitmap images tothe database. This method constructs a DBHandle for each image that itinserts into the database. If an error occurs and the DBHandle is incorrectlyset, the ErrorStatus attribute is not set; instead, an error message isgenerated, the ErrorNumber and DBMSError attributes of the DBSessionObjectsystem class are set, and the DBHandle is set to null.For more information about using these attributes, see How You Can Use theErrorNumber and DBMSError Attributes (see page 198).How You Can Use the Inquire_sql StatementThe inquire_sql statement returns runtime diagnostic and status informationabout database statements in an application. In OpenROAD, this statementcan be most useful for retrieving error text or determining the transactionstate. The syntax of this statement is:inquire_sql (:variable_name = constant{, :variable_name = constant})To retrieve error text, specify the errortext constant; to determine thetransaction state, use the transaction constant. Errortext returns a varcharstring and transaction returns an integer (TRUE or FALSE).Working with a Database 201

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

Saved successfully!

Ooh no, something went wrong!