[kmymoney] [Bug 462833] New: For database tables created with generated SQL, database storage layer doesn't correctly save and retrieve base currency
Bob Pesner
bugzilla_noreply at kde.org
Sat Dec 10 02:01:47 GMT 2022
https://bugs.kde.org/show_bug.cgi?id=462833
Bug ID: 462833
Summary: For database tables created with generated SQL,
database storage layer doesn't correctly save and
retrieve base currency
Classification: Applications
Product: kmymoney
Version: 5.1.2
Platform: Fedora RPMs
OS: Linux
Status: REPORTED
Severity: minor
Priority: NOR
Component: database
Assignee: kmymoney-devel at kde.org
Reporter: bpesner at pcdialogs.com
Target Milestone: ---
SUMMARY
When working with database tables created by manually issuing the generated
SQL, as opposed to letting kmymoney itself create the tables, the database
storage layer doesn't correctly save and retrieve base currency, so that
whenever such an SQL-based kmymoney file is opened, the user is prompted to
re-choose the base currency.
STEPS TO REPRODUCE
1. Start kmymoney with the -n option
2. Choose Tools->Generate Database SQL
3. Save the generated SQL into a file
4. Creating a new database or using an existing one, run the commands in the
generated SQL file
5. In kmymoney, open the database
6. In the Currencies dialog that appears, add a currency and select it as the
base currency
7. Save the kmymoney data to the database
8. Re-open the database by either closing and restarting kmymoney or choosing
File->Open database
OBSERVED RESULT
kmymoney again prompts for selecting the base currency.
There is no row in the kmmKeyValuePairs table with kvpType='STORAGE',
kvpKey='kmm-baseCurrency' and kvpData= <the 3 character base currency id>
The baseCurrency column in the single row in the kmmFileInfo table is empty
EXPECTED RESULT
File should open without prompt for base currency.
A row should be present in the kmmKeyValuePairs table with kvpType='STORAGE',
kvpKey='kmm-baseCurrency' and kvpData= <the 3 character base currency id>
The baseCurrency column in the single row in the kmmFileInfo table should have
the 3 character base currency id
SOFTWARE/OS VERSIONS
Windows:
macOS:
Linux/KDE Plasma:
(available in About System)
KDE Plasma Version:
KDE Frameworks Version:
Qt Version:
ADDITIONAL INFORMATION
Reading the MyMoneyStorageSqlPrivate::readFileInfo method indicates that while
there is a column called baseCurrency in the kmmFileInfo table, that's not
where the base currency is retrieved from. Instead, it is retrieved from the
kmmKeyValuePairs table, from a row with kvpType='STORAGE' and kvpId=''. If you
manually issue the command 'insert into kmmkeyvaluepairs
values('STORAGE','','kmm-baseCurrency','USD');' (or some other currency id),
the problem goes away.
However, in the scenario described above,
MyMoneyStorageSqlPrivate::writeFileInfo doesn't write such a record after
choosing a base currency and saving to the database in the GUI. There is a call
to writeKeyValuePairs("STORAGE", kvpList, pairs); around line 683 of
kmymoney/plugins/sql/mymoneystoragesql_p.h, but at that point the pairs
parameter has no entry with the key "kmm-baseCurrency". I haven't been able to
determine why.
I'm running kmymoney on Fedora 35 (close to EOL) and I have seen that Qt
library updates do break some things, including kmymoney. I know nothing about
Qt, but I am wondering if this is a Qt problem.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the KMyMoney-devel
mailing list