[Kmymoney-devel] Allow plugins to access the database

Fernando Vilas fvilas at iname.com
Sat Feb 15 22:44:04 UTC 2014


On Wednesday, February 12, 2014 14:13:09 Christian Dávid wrote:
> Hello,
> hello Fernando,
> 
> this is for the online banking function I am currently working on. But it is
> useful for other plugins as well and would be a major change to KMyMoney:
> 
> I want to enable plugins to store information (probably a lot of
> information). For XML files I solved this by adding a MyMoneyObject with
> general information. The data from the plugin is attached as a pointer. To
> write/read the data a virtual method is used.
> 
> Obviously this is not that easy with the database, as a table has to be
> created first. So I want plugins to be allowed to check if the storage can
> process SQL (e.g. with bool MyMoneyFile::isSqlDatabase() ) and allow them to
> directly execute SQL queries. If they want, they can use KMyMoney's
> database abstraction.
> 

The simple answer is to add the table, as you saw. That addresses the initial 
concern for getting the data integrated.

You want the plugins to be able to execute SQL queries directly. That is a 
little counter to the idea of abstracting the storage layer through the MMFile 
object. If it has to violate that, it can possibly be addressed, but there may 
be a way to add features to the storage layer or MMFile to continue the 
abstraction. 

> Also the plugin should tell KMyMoney an SQL query which reverts the changes.
> It is stored as a string (in the database). Then KMyMoney can offer the
> user to remove all data from a plugin — even if it is no longer available.
> 

Interesting. If the idea is to allow reverting commands, maybe the original 
writes to the database can be delayed until complete. That way, the 
transaction is still atomic.

> I thought about using the Key-Value-Container. But this *could* create
> performance issues (a credit-transfer exists of ~13 fields, in the long run
> I expect every transaction to be based on such a credit-transfer, for
> online banking users). There would be many, many joins. Personally I find
> this would be a bad hack anyway.
> 
> Do you like my idea?

Maybe...  I don't really have enough information to have an opinion yet. You 
seem motivated on this, which is fantastic.

Could you share some of the code or more in-depth thoughts on the design? That 
would help. I do not know if reviewboard is the right place for a work-in-
progress, but something like that could help me (and others) see a prototype 
of what you are thinking.

> 
> Greetings
> Christian
> 
> P.S.: Take your time for answers, I won't be able to work on this in the
> next weeks anyway.
> 

-- 
Thanks,
Fernando Vilas
fvilas at iname.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20140215/9986a718/attachment.sig>


More information about the KMyMoney-devel mailing list