4. System Classes : DataStream Class : Open Method
 
Share this page                  
Open Method
The Open method opens the query with the semantics implied by the specified mode. All expressions are bound to a particular set of actual runtime variables or fields.
This method has the following syntax:
integer = DataStream.Open(querymode = integer,
          [scope = Scope ][, checkcols = integer,
          isrepeated = integer][, maxrows = integer])
Besides checking the query for syntax errors, this method sets the AsName attribute of the Columns array. It also sets those attributes pertaining to data type information if these attributes have not already been set (for example, by invoking the SetCols method).
This method has the following parameters:
querymode
Specifies the mode of the query:
QY_CACHE
QY_ARRAY
QY_DIRECT
QY_CURSOR
Descriptions of system constant values and their numeric equivalents are listed in Query Modes (see Query Modes).
scope
Specifies the scope for evaluation of expressions in the target list. If unspecified, the DataStream uses the last scope specified, and expressions are not recompiled. You can also set the scope by explicitly setting the Scope attribute. For example:
datastream_obj.Scope = Curframe.Scope
checkcols
Specifies whether to verify the number of columns in the Columns array with the number of columns specified in the Query attribute. Valid values are:
TRUE
Specifies that the method verifies the number of columns in the Columns array
FALSE
Specifies that the method does not verify the number of columns in the Columns array
This parameter is useful only with SQLSelect objects.
isrepeated
Specifies whether the method specifies a repeat query. Valid values are:
TRUE
Specifies a repeat query
Note:  If you set the isrepeated parameter to TRUE or the querymode parameter to QY_CURSOR, you must also assign a name to the SQLSelect attribute, QueryName.
Setting the isrepeated parameter to TRUE changes the behavior of the checkcols parameter: even if checkcols evaluates to TRUE, the database is not checked. If checkcols evaluates to FALSE, the Columns array is populated with the correct data types, but column names are unknown.
FALSE
Specifies no repeat query
Default: FALSE
This parameter is irrelevant if querymode is set to QY_CURSOR.
maxrows
Specifies the maximum number of rows to be loaded.
Default: 0
Limits: unlimited
This parameter is useful only with the QY_ARRAY mode.
Note:  If the value of maxrows is exceeded, the query is interrupted and an error status (12386517) is returned to the application. Rows selected up to the limit set by the maxrows parameter are valid and are used by the application.
If the Open method is successful, it returns ER_OK. If it is not successful, it returns an error status. Descriptions of system constant values and their numeric equivalents are listed in Error Codes (see Error Codes).