From e5561bd7abe0da25f2bebd639779b868cbd6d351 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 16 Mar 2018 13:59:04 -0700 Subject: [PATCH] Fix lost Bayesian matches in SQL backend. The import-map-bayes uses a three-part key that uses the same delimiter as a path and the SQL backend was throwing away everything except the account guid. Added more slot types including import-map-bayes ones to the test xml file to help debug this and to catch it in the future. Also don't pass std::string.c_str() to a std::vector constructor, just pass the string. --- libgnucash/backend/dbi/test/test-dbi.xml | 161 +++++++++++++++++++++++ libgnucash/backend/sql/gnc-slots-sql.cpp | 7 +- 2 files changed, 164 insertions(+), 4 deletions(-) diff --git a/libgnucash/backend/dbi/test/test-dbi.xml b/libgnucash/backend/dbi/test/test-dbi.xml index 5ea03f5379..88c951914e 100644 --- a/libgnucash/backend/dbi/test/test-dbi.xml +++ b/libgnucash/backend/dbi/test/test-dbi.xml @@ -104,6 +104,65 @@ 100 Checking Account + + + hbci + + + account-id + 998877665544 + + + account-uid + 4 + + + bank-code + 123456789 + + + trans-retrieval + + 2014-07-29 13:53:22 -0700 + + + + + + import-map-bayes/JOE'S/2fb5eba53d140bc237d8bae2fca3ddee + 2 + + + import-map-bayes/KAISER/2fb5eba53d140bc237d8bae2fca3ddee + 4 + + + reconcile-info + + + include-children + 0 + + + last-date + 1412924399 + + + last-interval + + + days + 26 + + + months + 0 + + + + + + b9e822465cc7e808797aaa51fd6f8d23 @@ -232,6 +291,37 @@ Expenses aa435e75fdee71adc1c51e53ea390638 + + Liabilities + 334baa3103961830eeccf42fe5a0d5de + LIABILITY + + ISO4217 + CAD + + 100 + Liabilities + + + placeholder + true + + + aa435e75fdee71adc1c51e53ea390638 + + + CapOne + fece54740af23814b1ba6f89fb64307d + CREDIT + + ISO4217 + CAD + + 100 + 1801 + Capital One Visa + 334baa3103961830eeccf42fe5a0d5de + Equity 0886d667a89c69aa33a1f99ff68e1348 @@ -613,6 +703,77 @@ + + 86fa5bb1ff0fa546674458823e5920bf + + 2010-12-07 00:00:00 -0800 + + + 2010-12-07 17:10:43 -0800 + + 2c2889c46f3d813ede18cd1a642c48b0 + 0 + 1 + 0 + CASH + + + 2c2889c46f3d813ede18cd1a642c48b0 + 1 + + gncJob + bf58b11a019e7fdb5860af876ed0a870 + + + 2010-12-07 00:00:00 -0800 + + 1 + + ISO4217 + USD + + + + bf58b11a019e7fdb5860af876ed0a870 + 1 + Quality + + gncVendor + aa9051c0623c97b80cbdc14171e532ab + + 1 + + + b6ab3c8f52b8b716415b07aa6c69e8e6 + Alameda, California + 0 + 0 + + + aa435e75fdee71adc1c51e53ea390638 + 975000/100000 + PERCENT + + + + + aa9051c0623c97b80cbdc14171e532ab + YoYoDyne, Inc. + 1 + + YpYoDyne Inc. + 42 Mobius Strip + Fremont, CA 94539 + 510-555-1212 + + USEGLOBAL + 1 + + ISO4217 + USD + + 0 + 367c685aeaef6244170a1f0984665c38 Unnamed Budget diff --git a/libgnucash/backend/sql/gnc-slots-sql.cpp b/libgnucash/backend/sql/gnc-slots-sql.cpp index d29f553900..17d7425176 100644 --- a/libgnucash/backend/sql/gnc-slots-sql.cpp +++ b/libgnucash/backend/sql/gnc-slots-sql.cpp @@ -225,8 +225,7 @@ set_slot_from_value (slot_info_t* pInfo, KvpValue* pValue) { case FRAME: { - auto key = get_key_from_path (pInfo->path); - pInfo->pKvpFrame->set ({key.c_str()}, pValue); + pInfo->pKvpFrame->set ({pInfo->path}, pValue); break; } case LIST: @@ -242,10 +241,10 @@ set_slot_from_value (slot_info_t* pInfo, KvpValue* pValue) auto frame = pInfo->pKvpFrame; if (!path.empty()) { - frame->set_path ({path.c_str(), key.c_str()}, pValue); + frame->set_path ({path, key}, pValue); } else - frame->set ({key.c_str()}, pValue); + frame->set ({key}, pValue); break; } }