5. Working with a Database : How You Can Access a Database with DataStream Objects : How You Can Use Query Objects
 
Share this page                  
How You Can Use Query Objects
To allow users to change, delete, or add data to a database, use a query object rather than an SQLSelect object. Unlike the process for creating an SQLSelect object, which requires you to provide the SQL select statement and the target information, you cannot create the select statement for a query object (QueryObject.Query.Value is read-only).
Creating a query object requires you to specify data to be retrieved and manipulated. The query object builds the select statement for you.
Creating a query object requires setting attributes and invoking methods of the same system classes involved in creating an SQLSelect object. The system classes used in creating both SQLSelect and QueryObject objects are:
DataStream
QueryCol
QueryParm
SQLSelect
In addition, creating a query object involves the following two system classes:
QueryObject
QueryTable
For a description of these system classes, see the Language Reference Guide online help.
Moreover, setting the Targets attribute for a query object is somewhat more complicated than setting it for an SQLSelect object because there are more relevant attributes of the Targets array to be set.
The Targets attribute, which is an array of type QueryParm, contains the following attributes, all of which are required for creating a query object:
Expression
Contains the name of the target field or variable, such as “field1” or “tbl[i].col1”
Default: None
IsFileHandleField
Set to TRUE if the column's value is to be retrieved as a FileHandle and the target expression evaluates to a bitmap object or string object to be loaded using the FileHandle
Default: FALSE
IsDBHandleField
Set to TRUE if the column's value is to be retrieved as a DBHandle and the target expression evaluates to a bitmap object or string object to be loaded using this DBHandle
Default: FALSE
IsInsertTarget
Set to TRUE if the column is used as a target for an insert statement
Default: FALSE
IsSelectTarget
Set to TRUE if the column is used as a target for a select statement
Default: FALSE
IsUpdateTarget
Set to TRUE if the column is used as a target for an update statement
Default: FALSE
IsDeleteWhere
Set to TRUE if the column is used as a where clause element for a delete statement
Default: FALSE
IsUpdateWhere
Set to TRUE if the column is used as a where clause element for an update statement
Default: FALSE