diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-02-06 23:27:33 +0200 |
---|---|---|
committer | kevin <kevin.li@mapbox.com> | 2020-07-21 14:35:48 +0800 |
commit | 3c1647273644a8a68100faa702a52e89a691425d (patch) | |
tree | e1dbeaa5663207ce75b2c1271b69231884cf98d8 /platform/default/include/mbgl/storage/offline_database.hpp | |
parent | 1159d99089b7ea6d45cca3aa469a98922f8c096a (diff) | |
download | qtlocation-mapboxgl-3c1647273644a8a68100faa702a52e89a691425d.tar.gz |
Expose READ_ONLY_MODE_KEY property for DatabaseFileSource
Diffstat (limited to 'platform/default/include/mbgl/storage/offline_database.hpp')
-rw-r--r-- | platform/default/include/mbgl/storage/offline_database.hpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/platform/default/include/mbgl/storage/offline_database.hpp b/platform/default/include/mbgl/storage/offline_database.hpp index 67a19fcf26..62a82f3a25 100644 --- a/platform/default/include/mbgl/storage/offline_database.hpp +++ b/platform/default/include/mbgl/storage/offline_database.hpp @@ -9,10 +9,10 @@ #include <mbgl/util/mapbox.hpp> #include <mbgl/util/expected.hpp> -#include <unordered_map> +#include <list> +#include <map> #include <memory> #include <string> -#include <list> namespace mapbox { namespace sqlite { @@ -38,8 +38,6 @@ struct MapboxTileLimitExceededException : util::Exception { class OfflineDatabase : private util::noncopyable { public: - // Limits affect ambient caching (put) only; resources required by offline - // regions are exempt. OfflineDatabase(std::string path); ~OfflineDatabase(); @@ -96,6 +94,8 @@ public: std::exception_ptr pack(); void runPackDatabaseAutomatically(bool autopack_) { autopack = autopack_; } + void reopenDatabaseReadOnly(bool readOnly); + private: void initialize(); void handleError(const mapbox::sqlite::Exception&, const char* action); @@ -112,6 +112,7 @@ private: void cleanup(); bool disabled(); void vacuum(); + void checkFlags(); mapbox::sqlite::Statement& getStatement(const char *); @@ -139,7 +140,7 @@ private: std::string path; std::unique_ptr<mapbox::sqlite::Database> db; - std::unordered_map<const char *, const std::unique_ptr<mapbox::sqlite::Statement>> statements; + std::map<const char*, const std::unique_ptr<mapbox::sqlite::Statement>> statements; template <class T> T getPragma(const char *); @@ -151,6 +152,7 @@ private: bool evict(uint64_t neededFreeSize); bool autopack = true; + bool readOnly = false; }; } // namespace mbgl |