Important: The information in this document is obsolete and should not be used for new development.
DBGetQueryResults
You can use theDBGetQueryResultsfunction 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
DBGetQueryResultsfunction uses for thetimeoutparameter each time it calls theDBGetItemfunction. Thetimeoutparameter specifies the maximum amount of time that the database extension should wait to receive results from the data server before canceling theDBGetItemfunction. Specify thetimeoutparameter in sixtieths of a second. To disable the timeout feature, set thetimeoutparameter to thekDBWaitForeverconstant. Some database extensions ignore thetimeoutparameter when you specify a nonzero value for theasyncPBparameter.statusProc- A pointer to a status routine that you provide. The
DBGetQueryResultsfunction calls your status routine after it calls theDBGetItemfunction to retrieve a data item. When it calls the status routine, theDBGetQueryResultsfunction provides the result of theDBGetItemfunction, 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
DBGetQueryResultsfunction calls theDBGetItemfunction asynchronously for each data item. As soon as theDBGetItemfunction has started execution, it returns control to your application. Your application must then call the Event Manager'sWaitNextEventfunction 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
TheDBGetQueryResultsfunction 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 theDBGetQueryResultsfunction 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 theDBGetQueryResultsfunction again to retrieve more data.You must allocate the results record and pass this record to the
DBGetQueryResultsfunction. 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
DBGetQueryResultsfunction can be used to retrieve the results of any query, not only queries sent and executed by theDBStartQueryfunction.SPECIAL CONSIDERATIONS
TheDBGetQueryResultsfunction 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 theDBGetQueryResultsfunction are
Trap macro Selector _DBGetQueryResults $0A12RESULT 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 InitDBPackfunction has not yet been calledSEE ALSO
See Listing 12-1 beginning on page 12-18 for an example of the use of theDBGetQueryResultsfunction. See page 12-56 for a description of the asynchronous parameter block. Descriptions of theDBStartQueryandDBGetItemfunctions 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.