摘要 |
A database query compiler and compilation method has special facilities for compiling a query that includes an Offset sequence function, Offset(argument, index). During execution of the query, while the cursor for a table is pointing to a current row, the Offset function is used to access information from a previously accessed row. The argument of the Offset sequence function is a specified function of information associated with the previously accessed row of the table. The previously accessed row has a position that is index rows before the current row referenced by the cursor for the table. During compilation, the argument of the Offset sequence function is parsed to determine a set of auxiliary fields for each row of the table. Each auxiliary field of a row contains information that may be accessed during execution of the Offset sequence function while the cursor for that table is pointing to a subsequent row. The Offset sequence function is converted into a compiled set of instructions, including instructions for storing and reading the auxiliary fields to and from a buffer that is separate from the table. The buffer is preferably stored in volatile, main memory. As a result, the Offset sequence function is executed, and information from a previous row is accessed, without having to change the cursor position for the table.
|