summaryrefslogtreecommitdiff
path: root/platform/qt/src/sqlite3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/qt/src/sqlite3.cpp')
-rw-r--r--platform/qt/src/sqlite3.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/platform/qt/src/sqlite3.cpp b/platform/qt/src/sqlite3.cpp
index 2ca09fd3ad..96cee5fff8 100644
--- a/platform/qt/src/sqlite3.cpp
+++ b/platform/qt/src/sqlite3.cpp
@@ -23,13 +23,6 @@
namespace mapbox {
namespace sqlite {
-// https://www.sqlite.org/rescode.html#ok
-static_assert(mbgl::underlying_type(ResultCode::OK) == 0, "error");
-// https://www.sqlite.org/rescode.html#cantopen
-static_assert(mbgl::underlying_type(ResultCode::CantOpen) == 14, "error");
-// https://www.sqlite.org/rescode.html#notadb
-static_assert(mbgl::underlying_type(ResultCode::NotADB) == 26, "error");
-
void checkQueryError(const QSqlQuery& query) {
QSqlError lastError = query.lastError();
if (lastError.type() != QSqlError::NoError) {
@@ -114,6 +107,11 @@ mapbox::util::variant<Database, Exception> Database::tryOpen(const std::string &
connectOptions.append("QSQLITE_OPEN_READONLY");
}
+ if (filename.compare(0, 5, "file:") == 0) {
+ if (!connectOptions.isEmpty()) connectOptions.append(';');
+ connectOptions.append("QSQLITE_OPEN_URI");
+ }
+
db.setConnectOptions(connectOptions);
db.setDatabaseName(QString(filename.c_str()));