Using QOF as a framework around GPE
[Query Object Framework]


Detailed Description

gpe-expenses provides an executable interface to the QOF external framework. It supports writing the QSF XML offline storage and SQL-type queries.

The types of SQL queries that are allowed at this point are a little limited. In general, only the following types of queries are supported:
SELECT * FROM SomeObj WHERE (param_a < 10.0) AND (param_b = "asdf") SORT BY param_c DESC;
INSERT INTO SomeObj (param_a, param_b, param_c) VALUES ("value_a", true, "0/1");

Joins are not supported directly.
SELECT * FROM ObjA,ObjB WHERE (ObjA.param_id = ObjB.param_other_id);
The problem with the above is that the search requires a nested search loop, aka a 'join', which is not currently supported in the underlying QofQuery code.

However, by repeating queries and adding the entities to a new session using qof_entity_copy_list, a series of queries can be added to a single book. e.g. You can insert multiple entities and save out as a QSF XML file or use multiple SELECT queries to build a precise list - this can be used to replicate most of the functionality of a SQL join.

SELECT * from ObjA where param_id = value; SELECT * from ObjB where param_other_id = value;

Equivalent to:
SELECT * from ObjA,ObjB where param_id = param_other_id and param_id = value;

When combined with a foreach callback on the value of param_id for each entity in the QofBook, you can produce the effect of a join from running the two SELECT queries for each value of param_id held in 'value'.

See QofEntityForeachCB and qof_object_foreach.

SELECT a,b,c FROM ...

Used to convert QOF objects between applications by using the returned parameter values to create a second object. One application using QOF could register objects from two applications and convert data from one to the other by using
SELECT a,b,c FROM ObjA; SELECT d,f,k FROM ObjB; qof_object_new_instance(); ObjC_set_a(value_c); ObjC_set_b(value_k) etc.

What's needed is for the SELECT to return a complete object that only contains the parameters selected.

Unsupported: UPDATE, DELETE.

It will not be possible to support CREATE, AMEND or DROP for understandable reasons.


Files

file  gpe-expenses.h
 Executable interface to the QOF external framework.

Data Structures

struct  GpeExpenseData

Defines

#define GPE_MOD_CLI   "gpe-cli"

Functions

void gpe_expense_close (GpeExpenseData *context)
 Shutdown the QOF framework.
GpeExpenseDatagpe_expense_init (void)
 Register all QOF objects.
void gpe_expense_error (QofSession *session)


Function Documentation

void gpe_expense_error ( QofSession *  session  ) 

Pass a QOF error to a GPE error box.

Definition at line 95 of file gpe-expenses.c.

00096 {
00097         if (qof_error_check (session))
00098                 gpe_error_box (qof_error_get_message (session));
00099 }

GpeExpenseData* gpe_expense_init ( void   ) 

Register all QOF objects.

If new objects are added, call the register func() here. Ensure you have the pack routines for your object.

Follow the template of other objects to create your own callbacks.

gpe_expense_init must be called by any program wanting to use the QOF framework with gpe-expense objects.

Returns:
A usable gpe_expense_data* context.

Definition at line 74 of file gpe-expenses.c.

References ExpensesRegister().

00075 {
00076         GpeExpenseData *context;
00077 
00078         qof_init();
00079         g_return_val_if_fail(ExpensesRegister (), NULL);
00080         context = g_new0(GpeExpenseData, 1);
00081         return context;
00082 }


Generated on Mon Jun 4 11:24:16 2007 for gpe-expenses by  doxygen 1.5.2