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,22 +1556,26 @@ 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);
|
||||
|
||||
sqlite_bind_stdstring(d->writePropertyQuery, 1, key);
|
||||
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);
|
||||
|
||||
sqlite_bind_stdstring(d->writePropertyQuery, 1, key);
|
||||
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);
|
||||
|
||||
|
@ -1594,6 +1601,7 @@ void NavDataCache::writeStringListProperty(const string& key, const string_list&
|
|||
sqlite_bind_stdstring(d->writePropertyMulti, 2, value);
|
||||
d->execInsert(d->writePropertyMulti);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string_list NavDataCache::readOrderedStringListProperty(const string& key,
|
||||
|
@ -1635,9 +1643,11 @@ 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