[Kmymoney-devel] MyMoneyStorageSql concept
Fernando Vilas
fvilas at iname.com
Tue Jan 28 02:05:37 UTC 2014
On Sunday, January 26, 2014 16:20:54 Christian Dávid wrote:
> Hi,
>
> is there a description of MyMoneyStorageSql? For me it is hard to understand
> (want to add a new MyMoneyObject to be stored).
>
Not that I know of... other than to say that it was designed as a replacement
for the XML backend. That means that it implements the same functions, though
maybe not as efficiently as a backend designed around a database from the
beginning.
If you want to add a new MyMoneyObject to the storage system, it has to work
in both types of backends. To get there, I would recommend adding it to the
XML backend first, then translating it over. You could do it the other way, but
I think it may be harder.
> Am I correct if i say, MyMoneyStorageSql uses only very basic and simple
> sql? E.g. the kmmFileInfo table stores the row count of other tables –
> isn't that a fundamental task of a database to manage that for me? I would
> like to put some more logic in the database, would you like that (e.g.
> using joins)?
>
It uses very simple SQL to get things done. Issuing a "select count(1) from
..." seems trivial until you do it a lot and create multiple round-trips to
the DB to grab the count of each table. It really comes into play with
importing statements when grabbing the next transactionID can be many round-
trips.
What sort of logic did you have in mind to put into the database? The right
set of queries to speed things up could be useful.
> Also there is a high abstraction level to create sql Queries, isn't sql an
> abstraction level itself? It would be a lot easier if I can just enter the
> sql statement to execute (within QSqlQuery of course).
>
There is an additional abstraction layer on top of just writing SQL. It seems
that even though there is a standard, SQL isn't always SQL. In order to
support PostgreSQL, MySQL, and SQLite3 (with provisions for others), an
additional abstraction layer had to be built for the DDL. Once that was built,
it was easy to go to a system where we can bind variables based on
standardized (within KMM) select/insert/update strings.
For certain cases, contained within MMStorageSql or MMDatabaseManager, you
could certainly write your own queries. I tried a few of those for fixing the
balance query, but was not as successful as I had hoped. Maybe you will have
better luck.
My schedule is pretty hectic these days, but I try to keep up on the KMM
mailing list, especially DB related posts, as they pop up. If there is
something more I can clarify/explain/test for you, just let me know.
--
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/20140127/5f3cdc20/attachment-0001.sig>
More information about the KMyMoney-devel
mailing list