Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Interapplication Communication /
Chapter 12 - Data Access Manager / Creating a Query Document


Contents of a Query Document

The query document must contain

A 'wstr' resource consists of a 2-byte length field followed by a character string. (The w in 'wstr' refers to the length word as opposed to the length byte used in an 'STR ' resource.) Each 'wstr' resource contains one query (or one query template, to be modified by the query definition function before it is sent to the data server). The 'qrsc' resource includes an array that lists the resource ID numbers of all of the 'wstr' resources in the query document and an index into the array that specifies which one of the 'wstr' resources should be sent to the data server.

In addition, the query document may contain

Figure 12-7 illustrates the relationship between the resources in a query document and the query record.

Figure 12-7 The relationship between resources in a query document and the query record

The query document in Figure 12-7 contains a 'qrsc' resource that specifies the resource ID of a 'qdef' resource, the resource IDs of three 'wstr' resources, and the resource ID of an 'STR#' resource. It also specifies which of the three 'wstr' resources represents the current query.

The DBGetNewQuery function creates the query record and partial queries from this information. Your application can use the DBStartQuery function to send a query to a data server. The DBStartQuery function calls the query definition function referred to by the query record (if any). The query definition function can prompt the user for information and modify the query as needed. Figure 12-8 illustrates a query record that contains a handle to an array of queries, a handle to a query definition function, and an index that identifies the current query. The query definition function displays a dialog box and modifies the current query according to the user's input. Once the query definition function modifies the current query and returns, the DBStartQuery function sends the query to the data server.

Figure 12-8 The relationship between a query definition function and queries


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996