Neil Williams <linux@codehelp.co.uk>
Created: 2002-10-07 Updated: 2005-05-22
A new object is declared using the base QOF types and zero or more references to other QOF objects. Each QOF backend must handle each base QOF type and references to other objects - usually by storing the type of the referenced object and the GUID of the referenced object as the value and the GUID of the original object as the key in a GHashTable or other lookup mechanism within the backend. See QofEntityReference.
gpointer (*query_compile)(QofBackend* be, QofQuery* query);
void (*query_free)(Backend* be, gpointer query);
void (*query_run)(Backend* be, gpointer query);
In this manner, a Backend (e.g. the Postgres backend) can compile the Query into its own format (e.g. a SQL expression) and then use the pre-compiled expression every run instead of rebuilding the expression.
There is an implementation issue in the case of Queries across multiple Books. Each book could theoretically be in a different backend, which means we need to tie the compiled query to the book's Backend for which it was compiled. This is an implementation detail, and not even a challenging one, but it needs to be clearly acknowledged up front.
void session_load(QofBackend*, QofBook*);
This one API loads all the necessary "start-time" data, There is no need to have multiple APIs for each of the data types loaded at start-time.