summaryrefslogtreecommitdiff
path: root/include/mbgl/storage
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-04-07 18:04:23 +0200
committerKonstantin Käfer <mail@kkaefer.com>2015-04-07 18:04:23 +0200
commit7d58a41de5dbf1b24b8bad9a2a98c21a7bf75382 (patch)
tree1a5c75d39d6772346dbceb33129dfb5650d65ef6 /include/mbgl/storage
parentd424c09f038fdcd0a070e3d04684dc1511cd1732 (diff)
downloadqtlocation-mapboxgl-7d58a41de5dbf1b24b8bad9a2a98c21a7bf75382.tar.gz
make sqlite storage more resilient to sporadic errors
- catch SQLite exceptions and report them - failed statements are ignored, we're really just caching here, so if it fails we're handling it gracefully elsewhere - handle cases where the database file goes away after we opened it - handle cases where the schema wasn't created after the database file was opened successfully - add tests
Diffstat (limited to 'include/mbgl/storage')
-rw-r--r--include/mbgl/storage/default/sqlite_cache.hpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/mbgl/storage/default/sqlite_cache.hpp b/include/mbgl/storage/default/sqlite_cache.hpp
index 8f2746561c..fe80a41b52 100644
--- a/include/mbgl/storage/default/sqlite_cache.hpp
+++ b/include/mbgl/storage/default/sqlite_cache.hpp
@@ -38,6 +38,7 @@ private:
void process(StopAction &action);
void createDatabase();
+ void createSchema();
const std::string path;
uv_loop_t *loop = nullptr;
@@ -45,6 +46,7 @@ private:
std::thread thread;
std::unique_ptr<::mapbox::sqlite::Database> db;
std::unique_ptr<::mapbox::sqlite::Statement> getStmt, putStmt, refreshStmt;
+ bool schema = false;
};
}