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 ErrorsAs an example, the 4GL procedure dbms_error_message demonstrates oneway to use these variables. This procedure displays an error message to theuser when a DBMS error occurs:procedure dbms_error_message () =beginif CurFrame.DBSession.ErrorNumber != 0 thenreturn 'Error code is' +varchar(CurFrame.DBSession.ErrorNumber)+'. DBMS specific error number is' +varchar(CurFrame.DBSession.DBMSError) +'.';elsereturn '';endif;end;How You Can Handle DataStream ErrorsAll DataStream methods that access the database return status information.These methods are:MethodOpenSetColsCloseNextRowDBInsertDBUpdateDBDeleteObjects Returning Status InformationSQLSelect and QueryObject objectsSQLSelect objectsSQLSelect and QueryObject objects (this methodaccesses the database only when the object was openedin QY_CURSOR or QY_DIRECT mode)SQLSelect and QueryObject objects (this methodaccesses the database only when the object was openedin QY_CURSOR or QY_DIRECT mode)QueryObject objectsQueryObject objectsQueryObject objectsTwo methods are exceptions to the general descriptions of return status. Oneis the Close method, which does not return a status. The other is the NextRowmethod, which returns either ER_OK when successful, if no breaks have beenset, or a number that represents the break level if breaks have been added tothe DataStream. If the NextRow method is unsuccessful, it returns -1 and setsthe ErrorNo attribute either to the error that was encountered, or 0 if there isno next row to retrieve.Working with a Database 199

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

Saved successfully!

Ooh no, something went wrong!