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

Christian David christian-david at web.de
Mon Jan 19 08:46:34 UTC 2015



On Jan. 19, 2015, 9:38 vorm., Daniel Ring wrote:
> > Well done, this task was difficult! Your code — C++ and SQL — looks very fine.
> > 
> > For all developers: Currently I am writing a test. Then we can replace nearly all ```getRecCount()``` calls with this function and many issues are gone :)

I forgot to mention: The task was to create this function for SQLite. I think ```substr()``` will not work in all database managers. I want to use ```MyMoneyDbDriver``` to handle that issue but is beyond the scope of a GCI task.

"However, I was unsure how best to test the function itself, so please let me know if any issues arise." - You are right, that is really not so easy.
I added this method to ```MyMoneyDatabaseMgrTest``` and called ```make test```:

    void MyMoneyDatabaseMgrTest::testHigestNumId()
    {
      testAttachDb();

      if (!m_canOpen)
        QSKIP("Database test skipped because no database could be opened.", SkipAll);

      testAddTransactions();

      QCOMPARE(m->m_sql->highestIdNum(QLatin1String("kmmTransactions"), QLatin1String("id"), 1), 2ul);
    }


- Christian


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


On Jan. 19, 2015, 6:02 vorm., Daniel Ring wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/122138/
> -----------------------------------------------------------
> 
> (Updated Jan. 19, 2015, 6:02 vorm.)
> 
> 
> 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/mymoneystoragesql.h 469c0f47d61df783f48787660f526fccdf5264a4 
>   kmymoney/mymoney/storage/mymoneystoragesql.cpp fa9fbdf7d77eaa4922302d1f583317212af45ddf 
> 
> 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/20150119/7c473d5a/attachment.html>


More information about the KMyMoney-devel mailing list