diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-09-18 17:39:44 +0200 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2018-09-26 13:47:28 +0200 |
commit | 4004a85a79fc9e7a390f30012d32c39d01292e7a (patch) | |
tree | 2dcb388dc1f342100577a7f7760a2924f9a1347e /platform | |
parent | 4148a5a91aefef20f28e520d1c0d4b6485cf0234 (diff) | |
download | qtlocation-mapboxgl-4004a85a79fc9e7a390f30012d32c39d01292e7a.tar.gz |
[android] explicitly set temp directory for SQLite3
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/src/file_source.cpp | 4 | ||||
-rw-r--r-- | platform/default/sqlite3.cpp | 4 | ||||
-rw-r--r-- | platform/default/sqlite3.hpp | 2 |
3 files changed, 10 insertions, 0 deletions
diff --git a/platform/android/src/file_source.cpp b/platform/android/src/file_source.cpp index d9b8e12dc4..9b639d2610 100644 --- a/platform/android/src/file_source.cpp +++ b/platform/android/src/file_source.cpp @@ -6,6 +6,8 @@ #include <mbgl/storage/resource_transform.hpp> #include <mbgl/util/logging.hpp> +#include <sqlite3.hpp> + #include "asset_manager_file_source.hpp" namespace mbgl { @@ -17,6 +19,8 @@ FileSource::FileSource(jni::JNIEnv& _env, const jni::String& accessToken, const jni::String& _cachePath, const jni::Object<AssetManager>& assetManager) { + mapbox::sqlite::setTempPath(jni::Make<std::string>(_env, _cachePath)); + // Create a core default file source fileSource = std::make_unique<mbgl::DefaultFileSource>( jni::Make<std::string>(_env, _cachePath) + "/mbgl-offline.db", diff --git a/platform/default/sqlite3.cpp b/platform/default/sqlite3.cpp index f7c6efc10d..f8a7daefe6 100644 --- a/platform/default/sqlite3.cpp +++ b/platform/default/sqlite3.cpp @@ -40,6 +40,10 @@ static_assert(mbgl::underlying_type(ResultCode::Auth) == SQLITE_AUTH, "error"); static_assert(mbgl::underlying_type(ResultCode::Range) == SQLITE_RANGE, "error"); static_assert(mbgl::underlying_type(ResultCode::NotADB) == SQLITE_NOTADB, "error"); +void setTempPath(const std::string& path) { + sqlite3_temp_directory = sqlite3_mprintf("%s", path.c_str()); +} + class DatabaseImpl { public: DatabaseImpl(sqlite3* db_) diff --git a/platform/default/sqlite3.hpp b/platform/default/sqlite3.hpp index 16f76a0d1a..33f735d904 100644 --- a/platform/default/sqlite3.hpp +++ b/platform/default/sqlite3.hpp @@ -67,6 +67,8 @@ class StatementImpl; class Query; class Transaction; +void setTempPath(const std::string&); + class Database { private: Database(std::unique_ptr<DatabaseImpl>); |