mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added automatic upgrade (cipher_migrate) of the sqlite database.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7581 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d0238810b7
commit
1d6bf4190e
@ -66,6 +66,18 @@ RetroDb::RetroDb(const std::string &dbPath, int flags, const std::string& key) :
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char *err = NULL;
|
||||||
|
rc = sqlite3_exec(mDb, "PRAGMA cipher_migrate;", NULL, NULL, &err);
|
||||||
|
if (rc != SQLITE_OK)
|
||||||
|
{
|
||||||
|
std::cerr << "RetroDb::RetroDb(): Error upgrading database, error code: " << rc;
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
std::cerr << ", " << err;
|
||||||
|
}
|
||||||
|
std::cerr << std::endl;
|
||||||
|
sqlite3_free(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -78,7 +90,7 @@ RetroDb::~RetroDb(){
|
|||||||
void RetroDb::closeDb(){
|
void RetroDb::closeDb(){
|
||||||
|
|
||||||
int rc= sqlite3_close(mDb);
|
int rc= sqlite3_close(mDb);
|
||||||
mDb = NULL ;
|
mDb = NULL ;
|
||||||
|
|
||||||
#ifdef RETRODB_DEBUG
|
#ifdef RETRODB_DEBUG
|
||||||
std::cerr << "RetroDb::closeDb(): Error code on close: " << rc << std::endl;
|
std::cerr << "RetroDb::closeDb(): Error code on close: " << rc << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user