Important: The information in this document is obsolete and should not be used for new development.
DBGetQueryResults
You can use theDBGetQueryResults
function to retrieve the results of a query.
FUNCTION DBGetQueryResults (sessID: LongInt; VAR results: ResultsRecord; timeout: LongInt; statusProc: ProcPtr; asyncPB: DBAsyncParmBlkPtr): OSErr;
sessID
- The session ID of the session from which you wish to retrieve results.
results
- The results record, which contains handles to the retrieved data.
timeout
- The value that the
DBGetQueryResults
function uses for thetimeout
parameter each time it calls theDBGetItem
function. Thetimeout
parameter specifies the maximum amount of time that the database extension should wait to receive results from the data server before canceling theDBGetItem
function. Specify thetimeout
parameter in sixtieths of a second. To disable the timeout feature, set thetimeout
parameter to thekDBWaitForever
constant. Some database extensions ignore thetimeout
parameter when you specify a nonzero value for theasyncPB
parameter.statusProc
- A pointer to a status routine that you provide. The
DBGetQueryResults
function calls your status routine after it calls theDBGetItem
function to retrieve a data item. When it calls the status routine, theDBGetQueryResults
function provides the result of theDBGetItem
function, the data type, the data length, the number of decimal places, the flags associated with the data item, and a pointer to the data item.asyncPB
- A pointer to an asynchronous parameter block. If specified, the
DBGetQueryResults
function calls theDBGetItem
function asynchronously for each data item. As soon as theDBGetItem
function has started execution, it returns control to your application. Your application must then call the Event Manager'sWaitNextEvent
function periodically to allow this asynchronous routine to run, and it must check the result field of the asynchronous parameter block to determine when the routine has completed execution.DESCRIPTION
TheDBGetQueryResults
function retrieves the results returned by a query and places them in memory. If there is sufficient memory available, this function retrieves all of the results at once. If theDBGetQueryResults
function runs out of memory, it places as much data as possible in memory, up to the last whole row. You can then make more memory available and call theDBGetQueryResults
function again to retrieve more data.You must allocate the results record and pass this record to the
DBGetQueryResults
function. The Data Access Manager allocates the handles inside the results record. When your application is finished using the results record, you must deallocate both the results record and the handles inside the results record.The
DBGetQueryResults
function can be used to retrieve the results of any query, not only queries sent and executed by theDBStartQuery
function.SPECIAL CONSIDERATIONS
TheDBGetQueryResults
function may move or purge memory. You should not call this routine from within an interrupt, such as in a completion routine or a VBL task.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theDBGetQueryResults
function are
Trap macro Selector _DBGetQueryResults $0A12
RESULT CODES
noErr 0 No error userCanceledErr -128 Function canceled by status routine rcDBValue -801 Data available rcDBError -802 Query execution ended in an error rcDBBreak -804 Function timed out rcDBExec -805 Query currently executing rcDBBadSessID -806 Session ID is invalid rcDBAsyncNotSupp -809 The database extension does not support asynchronous calls rcDBPackNotInited -813 The InitDBPack
function has not yet been calledSEE ALSO
See Listing 12-1 beginning on page 12-18 for an example of the use of theDBGetQueryResults
function. See page 12-56 for a description of the asynchronous parameter block. Descriptions of theDBStartQuery
andDBGetItem
functions begin on page 12-64 and page 12-84, respectively. For more information on results records, see "The Results Record" beginning on page 12-59 and "Getting Query Results" beginning on page 12-37. For more information on status routines, see "Writing a Status Routine for High-Level Functions" beginning on page 12-22.