Bug 791848 - GC 2.6.x does not handle ISO dates introduced with GC 2.7.

Set a feature to prevent versions older that 2.6.20 from loading a
database from which they cannot read the dates. Ideally we would do this
only if the database is written to, but the current persistence design
includes committing back to the database during the load so the net
effect is that the flag would be set anyway.
This commit is contained in:
John Ralls 2017-12-23 14:27:04 -08:00
parent 91727525b9
commit bbd2df6a3b
3 changed files with 7 additions and 2 deletions

View File

@ -59,7 +59,7 @@ extern "C"
#include "gnc-engine.h"
#include "SX-book.h"
#include "Recurrence.h"
#include <gnc-features.h>
#include "gnc-uri-utils.h"
#include "gnc-filepath-utils.h"
#include <gnc-path.h>
@ -76,6 +76,7 @@ extern "C"
#include <string>
#include <iomanip>
#include <qofsession.hpp>
#include <gnc-backend-prov.hpp>
#include "gnc-backend-dbi.h"
#include "gnc-backend-dbi.hpp"
@ -470,7 +471,6 @@ GncDbiBackend<DbType::DBI_SQLITE>::session_begin(QofSession* session,
* Let's start logging */
xaccLogSetBaseName (filepath.c_str());
PINFO ("logpath=%s", filepath.c_str() ? filepath.c_str() : "(null)");
LEAVE ("");
}
@ -830,6 +830,9 @@ GncDbiBackend<Type>::load (QofBook* book, QofBackendLoadType loadType)
GncSqlBackend::load(book, loadType);
if (Type == DbType::DBI_SQLITE)
gnc_features_set_used(book, GNC_FEATURE_SQLITE3_ISO_DATES);
if (GNUCASH_RESAVE_VERSION > get_table_version("Gnucash"))
{
/* The database was loaded with an older database schema or

View File

@ -47,6 +47,7 @@ static gncFeature known_features[] =
{ GNC_FEATURE_BOOK_CURRENCY, "User specifies a 'book-currency'; costs of other currencies/commodities tracked in terms of book-currency (requires at least GnuCash 2.7.0)" },
{ GNC_FEATURE_GUID_BAYESIAN, "Use account GUID as key for Bayesian data (requires at least GnuCash 2.6.12)" },
{ GNC_FEATURE_GUID_FLAT_BAYESIAN, "Use account GUID as key for bayesian data and store KVP flat (requires at least Gnucash 2.6.19)" },
{ GNC_FEATURE_SQLITE3_ISO_DATES, "Use ISO formatted date-time strings in SQLite3 databases (requires at least GnuCash 2.6.20)"},
{ NULL },
};

View File

@ -51,6 +51,7 @@ extern "C" {
#define GNC_FEATURE_BOOK_CURRENCY "Use a Book-Currency"
#define GNC_FEATURE_GUID_BAYESIAN "Account GUID based Bayesian data"
#define GNC_FEATURE_GUID_FLAT_BAYESIAN "Account GUID based bayesian with flat KVP"
#define GNC_FEATURE_SQLITE3_ISO_DATES "ISO-8601 formatted date strings in SQLite3 databases."
/** @} */