Programming Guide : Working with a Database : How You Can Access a Database with Standard SQL Statements : How You Can Use Methods That Access the Database
 
Share this page          
How You Can Use Methods That Access the Database
Three system classes, BitmapObject, StringObject, and DataStream have methods that access the database. The BitmapObject and StringObject methods are:
InsertIntoDB
Places the associated object in the database
UpdateInDB
Replaces the object in the database
DeleteFromDB
Removes the object from the database
Note:  None of the BitmapObject and StringObject methods should be issued with autocommit set to ON.
The DataStream system class defines the following methods that access the database:
Open
Opens the query for SQLSelect and query objects
SetCols
Sets up the Columns array for an SQLSelect object
Close
Closes the query (only when the DataStream object was opened in QY_CURSOR or QY_DIRECT modes)
NextRow
Retrieves the next row of data (only when the DataStream object was opened in QY_CURSOR or QY_DIRECT modes)
The QueryObject system class, which is a subclass of DataStream, has the following additional database access methods:
DBInsert
Places a new row into the database
DBUpdate
Replaces a specified row in the database
DBDelete
Removes a specified row from the database
Because they access the database directly, these methods participate in transactions. Not only can using one of these methods initiate a transaction, but the methods are affected also by commit or rollback statements. Because the transaction semantics are not handled directly by these methods, you must write the transaction management code. For more information about handling transactions opened by system class methods, see How You Can Manage Transactions.
For a discussion of using BitmapObject objects and StringObject objects, see the chapter Working with Images and Text Strings. For a discussion of using DataStream objects, see How You Can Access a Database with DataStream Objects and How You Can Use Query Objects.