summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2018-02-23 11:16:41 +0100
committerBruno de Oliveira Abinader <bruno@mapbox.com>2018-02-26 14:43:32 +0200
commitba019b025681fc6f623ab07f62488b509f10bb4a (patch)
treeb0363998284127ac834bbf1f3a345adf0b974ffa
parent17334c74a0c56feaecf3493861bccddaa01c3801 (diff)
downloadqtlocation-mapboxgl-ba019b025681fc6f623ab07f62488b509f10bb4a.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);
}