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.

How You Can Access a Database with Standard SQL StatementsFor example, the following code updates the customer record on which thecursor is currently positioned:on click update_button =begin/* Actually update the customer in the database */if menu.get_menu.initial_account > 2 thenupdate customerset acctno = :customer.acctnocphone = :customer.cphone,cname = :customer.cname,caddr = :customer.caddr,ccity = :customer.ccity,cstate = :customer.cstate,czip = :customer.czip,cdistrict = :customer.cdistrict,cstatus = :customer.cstatus,cacctbal = :customer.cacctbalwhere current of cust_cursor;...The following code provides an example of deleting the row on which thecursor is positioned:on click delete_button =beginif menu.get_menu.initial_account > 2 thendelete from customerwhere current of cust_cursor;...How You Can Close a CursorFor more information about the cursor version of the update and deletestatements, see the Language Reference <strong>Guide</strong> online help.When the program has processed all the required rows in the result table,close the cursor. Closing a cursor:• Sets the cursor's State attribute to CS_CLOSED• Makes changes visible to the rest of the program (if the cursor was adeferred update cursor)• Releases any locks held by the select statement associated with the cursor(if autocommit is on)For a description of autocommit, see How Running with Autocommit OnWorks (see page 187).If you reopen a closed cursor, the cursor is repositioned at the top of the resulttable.162 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!