Query Object Framework

Introduction

QOF, the Query Object Framework, provides a set of C Language utilities for performing generic structured complex queries on a set of data held by a set of C/C++ objects. This framework is unique in that it does NOT require SQL or any database at all to perform the query. Thus, it allows programmers to add query support to their applications without having to hook into an SQL Database.

Typically, if you have an app, and you want to add the ability to show a set of reports, you will need the ability to perform queries in order to get the data you need to show a report. Of course, you can always write a set of ad-hoc subroutines to return the data that you need. But this kind of a programming style is not extensible: just wait till you get a user who wants a slightly different report.

The idea behind QOF is to provide a generic framework so that any query can be executed, including queries designed by the end-user. Normally, this is possible only if you use a database that supports SQL, and then only if you deeply embed the database into your application. QOF provides simpler, more natural way to work with objects.

 

Examples

Generating examples of your own

qof-gen at SourceForge

Writing new QOF objects and examples can be a tad repetitive so QOF generator automates the process using HTML forms and PHP. The generator is still new but it does create usable C code and an example program that can be compiled against current QOF CVS.

Using qof-generator with common front-end code

A second role for qof-generator involves providing a central repository for common front-end code that cannot go into QOF itself. Unlike backends, it seems strange to make a front-end into a GModule (although it can probably be done) and front-ends require dependencies that simply do not fit with the wider remit of the libqof1 library. So qof-main.c|h and qof-shell.c|h will be updated from qof-generator so that each project can benefit from improvements made elsewhere.


Documentation

The API documentation is embedded in the header files and can be viewed as HMTL.


Support

Support should be obtained by subscribing to the mailing list: http://lists.sourceforge.net/lists/listinfo/qof-devel.


Origins

QOF is an offshoot from the GnuCash Project, where this framework is a deep, central component. QOF is basically the GnuCash "engine" with all of the financial objects removed. As such, QOF is "tried and true", and has proven its worth.


Function

Besides the query framework, QOF also provides a number of other base functions from GnuCash and a few extensions of its own:


Project Goals

Below are some concrete project goals. See "Why QOF?" for the more abstract ideas behind QOF, including the relationships between "database-driven", "program-driven" and "data-centric" programming explored at Data-Freedom.org.


Downloads

SourceForge

The source code release for v0.7.5 is available from SourceForge.

Debian

Packages are available in unstable, testing and stable.

Ubuntu

RPM packages

There is a sample .spec file available in QOF CVS, available via SourceForge. RPM packages have been prepared for v0.6.4 in Fedora 4 and 5 as well as OpenSuSE Factory.

Mac OSX & Fink

Packages are also possible for Fink and DarwinPorts (Mac OSX) - a sample Finkinfo file is provided in QOF CVS via SourceForge.

Project Status

This code is in active, daily use in several projects and is 'stable' code. See the roadmap for the current development direction.

Some projects currently using QOF are:


Written by Linas Vepstas <linas@linas.org> April 2004
Last updated by Neil Williams <linux@codehelp.co.uk> December 2007.


The copyright licensing notice below applies to this text.

Copyright © 2004 Linas Vepstas

Copyright © 2005-2007 Neil Williams

Permission is granted to copy, distribute, and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. In installed versions, the licence can be found in the copyright file.