mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 23:20:52 +01:00
Optimizes cache_db_ for faster
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2817 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -39,10 +39,12 @@ ElementsCollectionCache::ElementsCollectionCache(const QString &database_path, Q
|
|||||||
if (!cache_db_.open()) {
|
if (!cache_db_.open()) {
|
||||||
qDebug() << "Unable to open the SQLite database " << database_path << " as " << connection_name << ": " << cache_db_.lastError();
|
qDebug() << "Unable to open the SQLite database " << database_path << " as " << connection_name << ": " << cache_db_.lastError();
|
||||||
} else {
|
} else {
|
||||||
cache_db_.exec("PRAGMA temp_store=MEMORY");
|
cache_db_.exec("PRAGMA temp_store = MEMORY");
|
||||||
cache_db_.exec("PRAGMA journal_mode = MEMORY");
|
cache_db_.exec("PRAGMA journal_mode = MEMORY");
|
||||||
cache_db_.exec("PRAGMA synchronous=OFF");
|
cache_db_.exec("PRAGMA page_size = 4096");
|
||||||
cache_db_.exec("PRAGMA cache_size=10000");
|
cache_db_.exec("PRAGMA cache_size = 16384");
|
||||||
|
cache_db_.exec("PRAGMA locking_mode = EXCLUSIVE");
|
||||||
|
cache_db_.exec("PRAGMA synchronous = OFF");
|
||||||
/// @todo the tables could already exist, handle that case.
|
/// @todo the tables could already exist, handle that case.
|
||||||
cache_db_.exec("CREATE TABLE names (path VARCHAR(512) NOT NULL, locale VARCHAR(2) NOT NULL, mtime DATETIME NOT NULL, name VARCHAR(128), PRIMARY KEY(path, locale));");
|
cache_db_.exec("CREATE TABLE names (path VARCHAR(512) NOT NULL, locale VARCHAR(2) NOT NULL, mtime DATETIME NOT NULL, name VARCHAR(128), PRIMARY KEY(path, locale));");
|
||||||
cache_db_.exec("CREATE TABLE pixmaps (path VARCHAR(512) NOT NULL UNIQUE, mtime DATETIME NOT NULL, pixmap BLOB, PRIMARY KEY(path), FOREIGN KEY(path) REFERENCES names (path) ON DELETE CASCADE);");
|
cache_db_.exec("CREATE TABLE pixmaps (path VARCHAR(512) NOT NULL UNIQUE, mtime DATETIME NOT NULL, pixmap BLOB, PRIMARY KEY(path), FOREIGN KEY(path) REFERENCES names (path) ON DELETE CASCADE);");
|
||||||
|
|||||||
Reference in New Issue
Block a user