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.

How You Can Access a Database with Standard SQL StatementsFor example, assume that your application uses the SendUserEvent methodand a common error-handling procedure to deal with DBMS errors. Assumealso that your application calls a 3GL procedure that includes the followingEmbedded SQL statements:select ...exec sql inquire_sql (:dbmserror = dbmserror);if (dbmserror != 0)return;exec sql insert ...exec sql inquire_sql (:dbmserror = dbmserror);if (dbmserror != 0)return;...When control is returned to the 4GL, the following code fragment obtains theerror number returned by the 3GL procedure and uses the SendUserEventmethod to send the error number to its 4GL error-handling procedure:if curframe.dbsession.dbmserror != 0 thenerrorproc.SendUserEvent(eventname = '3glerror',messagevarchar = dbmserror);endif;If the 4GL calls a 3GL procedure that produces an error in an exec 4GLstatement (such as using an invalid attribute name or trying to fetch acharacter-valued global variable into an integer-valued host variable), errorhandling must be done in the 3GL procedure. 4GL has no constructs toexamine whether errors occurred.How You Can Use the Insert StatementThe insert statement adds new rows to a database table. The values thatpopulate the new rows can come from any of the following places:• Variables associated with the current frame:– Simple variables– Attributes of reference variables– Columns in a dynamic array• Global variables• A subselect• Constants• Expression results152 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!