summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/qt/config.cmake3
-rw-r--r--test/storage/offline_database.test.cpp46
2 files changed, 2 insertions, 47 deletions
diff --git a/platform/qt/config.cmake b/platform/qt/config.cmake
index 9417963767..d93c6fe197 100644
--- a/platform/qt/config.cmake
+++ b/platform/qt/config.cmake
@@ -1,6 +1,5 @@
include(platform/qt/qt.cmake)
-mason_use(sqlite VERSION 3.14.2)
mason_use(gtest VERSION 1.8.0${MASON_CXXABI_SUFFIX})
if(NOT WITH_QT_DECODERS)
@@ -81,8 +80,6 @@ macro(mbgl_platform_test)
PROPERTIES COMPILE_FLAGS -DWORK_DIRECTORY="${CMAKE_SOURCE_DIR}"
)
- target_add_mason_package(mbgl-test PRIVATE sqlite)
-
target_link_libraries(mbgl-test
PRIVATE qmapboxgl
PRIVATE mbgl-filesource
diff --git a/test/storage/offline_database.test.cpp b/test/storage/offline_database.test.cpp
index d99c1f946f..94daf59c02 100644
--- a/test/storage/offline_database.test.cpp
+++ b/test/storage/offline_database.test.cpp
@@ -9,7 +9,6 @@
#include <gtest/gtest.h>
#include <sqlite3.hpp>
-#include <sqlite3.h>
#include <thread>
#include <random>
@@ -39,45 +38,6 @@ void writeFile(const char* name, const std::string& data) {
mbgl::util::write_file(name, data);
}
-class FileLock {
-public:
- FileLock(const std::string& path) {
- const int err = sqlite3_open_v2(path.c_str(), &db, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, nullptr);
- if (err != SQLITE_OK) {
- throw std::runtime_error("Could not open db");
- }
- lock();
- }
-
- void lock() {
- assert(!locked);
- const int err = sqlite3_exec(db, "begin exclusive transaction", nullptr, nullptr, nullptr);
- if (err != SQLITE_OK) {
- throw std::runtime_error("Could not lock db");
- }
- locked = true;
- }
-
- void unlock() {
- assert(locked);
- const int err = sqlite3_exec(db, "commit", nullptr, nullptr, nullptr);
- if (err != SQLITE_OK) {
- throw std::runtime_error("Could not unlock db");
- }
- locked = false;
- }
-
- ~FileLock() {
- if (locked) {
- unlock();
- }
- }
-
-private:
- sqlite3* db = nullptr;
- bool locked = false;
-};
-
} // namespace
TEST(OfflineDatabase, TEST_REQUIRES_WRITE(Create)) {
@@ -102,10 +62,8 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(SchemaVersion)) {
std::string path("test/fixtures/offline_database/offline.db");
{
- sqlite3* db = nullptr;
- sqlite3_open_v2(path.c_str(), &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr);
- sqlite3_exec(db, "PRAGMA user_version = 1", nullptr, nullptr, nullptr);
- sqlite3_close_v2(db);
+ mapbox::sqlite::Database db(path, mapbox::sqlite::Create | mapbox::sqlite::ReadWrite);
+ db.exec("PRAGMA user_version = 1");
}
Log::setObserver(std::make_unique<FixtureLogObserver>());