summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2018-02-23 11:16:41 +0100
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2018-02-25 11:04:30 +0200
commit831d51ef23a3d8dee67378d613a1c185e14abd8c (patch)
tree984979684b712df554583091ee810b94a524783b
parent5de373fff0e71496b6aa11ecb6556f958a28d80b (diff)
downloadqtlocation-mapboxgl-831d51ef23a3d8dee67378d613a1c185e14abd8c.tar.gz
[qt] Fix issue if resources not being found on the database
Once again QVariant getting confused about its contents datatype. With this patch we use QString directly and copy the contents, which should be cheap with Qt implicity sharing.
-rw-r--r--platform/qt/src/sqlite3.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/platform/qt/src/sqlite3.cpp b/platform/qt/src/sqlite3.cpp
index 80efd6a326..eb4a798043 100644
--- a/platform/qt/src/sqlite3.cpp
+++ b/platform/qt/src/sqlite3.cpp
@@ -270,20 +270,15 @@ void Statement::bind(int offset, optional<mbgl::Timestamp> value) {
}
}
-void Statement::bind(int offset, const char* value, std::size_t length, bool retain) {
+void Statement::bind(int offset, const char* value, std::size_t length, bool /* retain */) {
assert(impl);
if (length > std::numeric_limits<int>::max()) {
// Kept for consistence with the default implementation.
throw std::range_error("value too long");
}
- // Qt SQLite driver treats QByteArray as blob: we need to explicitly
- // declare the variant type as string.
- QVariant text(QVariant::Type::String);
- text.setValue(retain ? QByteArray(value, length) : QByteArray::fromRawData(value, length));
-
// Field numbering starts at 0.
- impl->query.bindValue(offset - 1, std::move(text), QSql::In);
+ impl->query.bindValue(offset - 1, QString(QByteArray(value, length)), QSql::In);
checkQueryError(impl->query);
}