[Kmymoney-devel] Review Request 122138: [GCI2014] Find the maximum in a set of numeric strings.

Daniel Ring dring at g33kworld.net
Sun Feb 1 07:45:54 UTC 2015



> On Jan. 29, 2015, 11:19 a.m., Christian David wrote:
> > Sorry for not answering for such a long time! Your work is really good! Do you want to stay? We could need you!
> > 
> > The queries are more different than I thought and hoped. I hoped to make not one function ```MyMoneyDbDriver::highestIdNumString(...)``` but ```substr(...)```, ```cast(...)``` etc. But this approach seems to be overly complicated.
> > 
> > The missing tests for different database managers are not so good (btw: correcting some things with the test is another task that could be done ;) ). Maybe I take some time to install a virtual machine with several database managers installed and configured…
> > 
> > Anyway I think it is ready to be shipped. I would just rename the functions ```highestIdNumString()``` to ```highestNumberFromIdString()``` (no abbreviations and more precisely - that is the scientist in me ;) ).
> > 
> > The next step is to remove nearly all ```getRecCount()``` calls. After the upgrade progress or after creating the database we should init the higest id vars (```m_{institution,account,…}s```) *once* with the new function. Or simply the first time a new id is requested - then we can drop nearly all columns of the table kmmFileInfo - any comments?

I would like to stay, but unfortunately my studies will require my full-time attention starting next week. I may be able to return once this semester ends. Should I contact you again then?

I had hoped to make the queries more similar as well, but unfortunately not all databases treat text as zero when converting strings to numbers. It may be less computationally expensive to simply retrieve all records from the database with a simple `SELECT` statement and determine the highest number with a `for` loop and `q.value(0).toString().mid(prefixLength).toULong()` (toULong() returns 0 if the conversion fails). It would resolve the test issue as well, since only one query would be necessary for all RDBMSs.

The function is called `highestIdNumString()` because it returns the string used to get the highest id number from the database, though `highestNumberFromIdString()` does sound better.

Once again, thank you for all the help, and I hope we can work together again soon!


- Daniel


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/122138/#review74997
-----------------------------------------------------------


On Jan. 31, 2015, 1:15 p.m., Daniel Ring wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/122138/
> -----------------------------------------------------------
> 
> (Updated Jan. 31, 2015, 1:15 p.m.)
> 
> 
> Review request for KMymoney and Christian David.
> 
> 
> Bugs: 339103
>     http://bugs.kde.org/show_bug.cgi?id=339103
> 
> 
> Repository: kmymoney
> 
> 
> Description
> -------
> 
> This adds a function to retrieve the highest ID number from the database. The IDs are prefixed by a short identifier string, and are stored in the database as strings.
> 
> This review request was created as a part of Google Code-In 2014. The specific task it refers to can be found here: https://www.google-melange.com/gci/task/view/google/gci2014/5774859095244800
> 
> 
> Diffs
> -----
> 
>   kmymoney/mymoney/storage/mymoneydatabasemgrtest.cpp 642fc53d9e220f34e463b2a27ab9a5d4b0c1e3ec 
>   kmymoney/mymoney/storage/mymoneydbdriver.h e5fe0e9a0058dac1573b6b08087c93c74a06d9a6 
>   kmymoney/mymoney/storage/mymoneydbdriver.cpp ab7449238bd55e3f4dc543790cd0f38eaa59d787 
>   kmymoney/mymoney/storage/mymoneystoragesql.h 469c0f47d61df783f48787660f526fccdf5264a4 
>   kmymoney/mymoney/storage/mymoneystoragesql.cpp fa9fbdf7d77eaa4922302d1f583317212af45ddf 
>   kmymoney/mymoney/storage/mymoneydatabasemgrtest.h 07fc175cd9381ef0fc7ad314cf905c22a43fca81 
> 
> Diff: https://git.reviewboard.kde.org/r/122138/diff/
> 
> 
> Testing
> -------
> 
> I created a small sample database with SQLite and verified that the SQL statment worked properly. I was able to successfully build and run KMyMoney with this function included in Debian Stable (using cmake 2.8.11.1 from backports). However, I was unsure how best to test the function itself, so please let me know if any issues arise.
> 
> 
> Thanks,
> 
> Daniel Ring
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20150201/799c4491/attachment.html>


More information about the KMyMoney-devel mailing list