Was this helpful?
How Data Is Retrieved
The following SQL statements are used to retrieve data from a DBMS Server:
singleton select
Retrieves one row from the database. Used when only one result row for the select statement is desirable. If the singleton select tries to retrieve more than one row, an error occurs. This type of select does not use a cursor.
The application issues the following singleton select statement with IIapi_query():
IIAPI_QT_SELECT_SINGLETON
select loop
Retrieves an unlimited number of result rows. Used when the number of rows in the result set is unknown.
This style of select statement is useful for applications that need to read data to load program data sets or to generate reports. This type of select does not use a cursor.
The application issues the following select loop statement with IIapi_query():
IIAPI_QT_SELECT
open cursor
Opens a cursor to retrieve rows. Used when it is desirable to use a cursor.
Updatable cursors retrieve one row at a time, permitting updates or deletion of the row addressed by the cursor. Read-only cursors may retrieve more rows at a time, similar to select loops, but permit database operations between retrieval operations.
The application issues the following open cursor statement with IIapi_query():
IIAPI_QT_OPEN
Regardless of the statement used for retrieving data, the application calls IIapi_getDescriptor() after calling IIapi_query() to obtain information about the format of the data being returned from the server. It then calls IIapi_getColumns() one or more times to retrieve the data. If no long varchar or long byte data types exist in the result set, and it is not an updatable cursor, multiple rows can be returned for each call. IIapi_getColumns() returns the “no more data” status once all rows have been returned. When all available data has been retrieved, the application calls IIapi_close() to end the process.
Last modified date: 08/28/2024