summaryrefslogtreecommitdiff
path: root/media
diff options
context:
space:
mode:
authormethodus <methodus@web.de>2012-11-29 00:17:50 +0100
committermethodus <methodus@web.de>2012-11-29 00:17:50 +0100
commite6c28c5209b5508a61affc947179260cec0d2733 (patch)
tree2db88f7fe2d9f55309a267b35c401844cc657a08 /media
parent387d734f97d9b7ad710eb84d2390e1cfe3f56c1d (diff)
downloadvdr-plugin-upnp-e6c28c5209b5508a61affc947179260cec0d2733.tar.gz
vdr-plugin-upnp-e6c28c5209b5508a61affc947179260cec0d2733.tar.bz2
Added some SQLite pragmas which should reduce accesses on the file system for writing
Diffstat (limited to 'media')
-rw-r--r--media/mediaManager.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/media/mediaManager.cpp b/media/mediaManager.cpp
index 670a158..5618817 100644
--- a/media/mediaManager.cpp
+++ b/media/mediaManager.cpp
@@ -112,8 +112,7 @@ cMediaManager::cMediaManager()
cMediaManager::~cMediaManager(){
try {
- tntdb::Statement stmt = connection.prepare("VACUUM");
- stmt.execute();
+ connection.execute("VACUUM");
} catch (const std::exception& e) {
esyslog("UPnP\tFailed to vacuum database '%s': '%s'", databaseFile.c_str(), e.what());
}
@@ -466,6 +465,14 @@ cMediaManager::BrowseFlag cMediaManager::ToBrowseFlag(const std::string& browseF
return NumBrowseFlags;
}
+void cMediaManager::Housekeeping(){
+ try {
+ connection.execute("VACUUM");
+ } catch (const std::exception& e) {
+ esyslog("UPnP\tFailed to vacuum database '%s': '%s'", databaseFile.c_str(), e.what());
+ }
+}
+
bool cMediaManager::Initialise(){
try {
@@ -614,9 +621,12 @@ bool cMediaManager::Initialise(){
bool cMediaManager::CheckIntegrity(){
- tntdb::Statement enableForeignKeys = connection.prepare("PRAGMA foreign_keys = ON");
-
- enableForeignKeys.execute();
+ connection.execute("PRAGMA foreign_keys = ON");
+ connection.execute("PRAGMA page_size = 4096");
+ connection.execute("PRAGMA cache_size = 16384");
+ connection.execute("PRAGMA temp_store = MEMORY");
+ connection.execute("PRAGMA synchronous = OFF");
+ connection.execute("PRAGMA locking_mode = EXCLUSIVE");
tntdb::Statement checkTable = connection.prepare(
"SELECT name FROM sqlite_master WHERE type='table' AND name=:table;"
@@ -747,7 +757,6 @@ bool cMediaManager::ScanURI(const string& uri, cUPnPResourceProvider* provider){
}
}
- isyslog("UPnP\tUnsupported resource: '%s' skipped.", uri.c_str());
return false;
} else {