How You Can Access a Database with DataStream Objects
OpenROAD provides the DataStream system class to enable applications to retrieve data from the database when you do not know the target fields or variables until runtime. In addition to allowing dynamic changes to the query, DataStream objects allow movement backward and forward through the retrieved data set.
The DataStream system class, in particular its SQLSelect and QueryObject subclasses, provide the only means in OpenROAD to make dynamic changes to a query or allow backwards movement in a data set. Standard select statements or those built using the execute immediate statement cannot be used to retrieve data when the columns are unknown until runtime.
The primary difference between the SQLSelect and QueryObject system classes is that the QueryObject class provides methods for adding, changing, and removing data in the tables underlying the query. SQLSelect objects are used only for retrieving data from the database.
These two system classes also differ in the way you create them:
• You provide an arbitrary SQL select statement as the query for an SQLSelect object.
• You provide a decomposed view of the query for a QueryObject object by setting various attributes; OpenROAD builds the SQL select statement.
Both the SQLSelect and QueryObject classes have many attributes, but the OpenROAD programmer uses only a subset of these attributes, as described in the following sections.
Using either of these classes requires the following steps:
1. Create the SQLSelect or QueryObject object.
2. Provide the query or set the necessary attributes to build the query.
3. Specify target fields or variables.
4. Invoke the Open method to retrieve the data.
5. Invoke additional methods to display the data.
6. Invoke the Close method to close the SQLSelect or QueryObject object.
The following subsections explain using statically created SQLSelect objects and QueryObject objects. For a discussion and example of using a query object, see
How You Can Use Query Objects (see
How You Can Use Query Objects).