Backend customisation and be->price_lookup

Derek Atkins warlord at MIT.EDU
Thu Sep 22 13:54:46 EDT 2005

Neil Williams <linux at> writes:

> As well as backend configuration options, there is an evident need to remove 
> GnuCash-specific backend handlers from QofBackend in a way that abstracts the 
> functionality and allows other applications to use their own customised 
> handlers in their backends.
> e.g. The GnuCash version of QofBackend includes price_lookup which is 
> evidently unsuitable for a generic library like QOF which knows nothing of 
> prices. Equally, some other QOF application may want similar functionality - 
> although I've no idea what just now.
> be->price_lookup is already highlighted as needing replacement:
>   /** XXX price_lookup should be removed during the redesign
>    * of the SQL backend... prices can now be queried using
>    * the generic query mechanism.
> src/engine/qofbackend-p.h

Um, don't you want this extension to be per-backend?  E.g. the File
Backend and the SQL Backend would want to supply different extensions,

> qof_backend_extension_add("GNCPriceLookupID", pgendPriceFind);

Wouldn't you need this to be per-backend?

> Note that this does mean that the extension is only registered once
> - when the backend GModule is first loaded, usually at application
> startup. Backends can either use more than one extension for
> different circumstances or modify their existing functions (and
> maybe prototypes) to use a status flag of some kind.

That's fine.

> be->price_lookup is only currently available within the GnuCash tree
> be->and will be unusable once QOF is spun out as an external
> be->library, hence the new mechanism.

I think that's fine...

> Alternatively, can price_lookup be dropped and a generic (QofQuery)
> query used already?

I don't know.  The current Query mechanism might not provide the full
requirements for the pricedb searches..  I particular the "closest in
time" type searches don't quite work right.

> Are there any implications for Finance::Quote?


       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL:    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available

More information about the gnucash-devel mailing list