C-API and mysql connection
Derek Atkins
warlord at MIT.EDU
Tue Jun 17 14:07:58 EDT 2014
Hi,
Kristoffel De Geest <kdg1955 at gmail.com> writes:
> As an experienced C programmer, I tried to delve into the C-API of GnuCash.
> Everything seems very straightforward. But I sucker on one important point:
> how do I link the mysql data to the QofBook structure.
> Presumably "gnc_sql_init" and "gnc_sql_load" are the appropriate functions.
> But here I can not find any parameter for the connection string (eg
> mysql://myName@myhost/myDB). Or I find nowhere a function that initializes
> all this via configuration files.
> Is there a template available that can solve my problem or is there a
> sample source file? The sample programs found at "
> http://wiki.gnucash.org/wiki/C_API" give no clarity. Even Google could not
> help me.
In short, you need to initialize the qof_session with the URI.
> BTW: the purpose of the C-API application is to import several hundred
> commodities (one shot) and the latest prices (daily run).
Any reason not to use the existing Quote Grabber for this latter piece?
> Maybe the import of the prices can be done inside GnuCash via the import of
> a QIF file (not yet tried) but I prefer to automate this. However the
No, it cannot -- the QIF importer doesn't know about prices. However we
already have a quote grabber (through Finance::Quote) that you can
automate -- you could even run "gnucash --add-price-quotes" from cron.
> import of new commodities failed with a QIF file because GnuCash try to
> create directly the accounts, and propose me to enter the missing
> commodities one by one. Version of GnuCash: 2.4.15 (Fedora package)
Yes, the QIF importer specifically exists to import transactions.
> It is not clear to me whether this is the right mailing list for my C-API
> problem. If "gnucash-devel" is more appropriate, I will also ask my
> question there.
>
>
> Thanks in advance for your help.
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.
-derek
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord at MIT.EDU PGP key available
More information about the gnucash-user
mailing list