NavDataCache: do not write to db in read-only mode
This commit is contained in:
parent
3889af3170
commit
4eaeb594ab
1 changed files with 34 additions and 24 deletions
|
@ -628,6 +628,7 @@ public:
|
|||
|
||||
void writeIntProperty(const string& key, int value)
|
||||
{
|
||||
if (!readOnly){
|
||||
sqlite_bind_stdstring(clearProperty, 1, key);
|
||||
execUpdate(clearProperty);
|
||||
|
||||
|
@ -635,6 +636,7 @@ public:
|
|||
sqlite3_bind_int(writePropertyQuery, 2, value);
|
||||
execUpdate(writePropertyQuery);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FGPositioned* loadById(sqlite_int64 rowId, sqlite3_int64& aptId);
|
||||
|
@ -1554,6 +1556,7 @@ void NavDataCache::writeIntProperty(const string& key, int value)
|
|||
|
||||
void NavDataCache::writeStringProperty(const string& key, const string& value)
|
||||
{
|
||||
if (!isReadOnly()) {
|
||||
sqlite_bind_stdstring(d->clearProperty, 1, key);
|
||||
d->execUpdate(d->clearProperty);
|
||||
|
||||
|
@ -1561,9 +1564,11 @@ void NavDataCache::writeStringProperty(const string& key, const string& value)
|
|||
sqlite_bind_stdstring(d->writePropertyQuery, 2, value);
|
||||
d->execUpdate(d->writePropertyQuery);
|
||||
}
|
||||
}
|
||||
|
||||
void NavDataCache::writeDoubleProperty(const string& key, const double& value)
|
||||
{
|
||||
if (!isReadOnly()) {
|
||||
sqlite_bind_stdstring(d->clearProperty, 1, key);
|
||||
d->execUpdate(d->clearProperty);
|
||||
|
||||
|
@ -1571,6 +1576,7 @@ void NavDataCache::writeDoubleProperty(const string& key, const double& value)
|
|||
sqlite3_bind_double(d->writePropertyQuery, 2, value);
|
||||
d->execUpdate(d->writePropertyQuery);
|
||||
}
|
||||
}
|
||||
|
||||
string_list NavDataCache::readStringListProperty(const string& key)
|
||||
{
|
||||
|
@ -1586,6 +1592,7 @@ string_list NavDataCache::readStringListProperty(const string& key)
|
|||
|
||||
void NavDataCache::writeStringListProperty(const string& key, const string_list& values)
|
||||
{
|
||||
if (!isReadOnly()) {
|
||||
sqlite_bind_stdstring(d->clearProperty, 1, key);
|
||||
d->execUpdate(d->clearProperty);
|
||||
|
||||
|
@ -1595,6 +1602,7 @@ void NavDataCache::writeStringListProperty(const string& key, const string_list&
|
|||
d->execInsert(d->writePropertyMulti);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string_list NavDataCache::readOrderedStringListProperty(const string& key,
|
||||
const char* separator)
|
||||
|
@ -1635,10 +1643,12 @@ bool NavDataCache::isCachedFileModified(const SGPath& path) const
|
|||
|
||||
void NavDataCache::stampCacheFile(const SGPath& path)
|
||||
{
|
||||
if (!isReadOnly()){
|
||||
sqlite_bind_temp_stdstring(d->stampFileCache, 1, path.realpath().utf8Str());
|
||||
sqlite3_bind_int64(d->stampFileCache, 2, path.modTime());
|
||||
d->execInsert(d->stampFileCache);
|
||||
}
|
||||
}
|
||||
|
||||
void NavDataCache::beginTransaction()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue