[Pkg-owncloud-commits] [owncloud-client] 95/211: ownSql: create an null value of an empty string in bindValue.

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:30 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit e51c2999375cf2d136301d387ec194e47a6941c0
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Thu Oct 16 11:20:50 2014 +0200

    ownSql: create an null value of an empty string in bindValue.
---
 src/mirall/ownsql.cpp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/mirall/ownsql.cpp b/src/mirall/ownsql.cpp
index 25735ad..415e77b 100644
--- a/src/mirall/ownsql.cpp
+++ b/src/mirall/ownsql.cpp
@@ -188,10 +188,15 @@ void SqlQuery::bindValue(int pos, const QVariant& value)
             break;
         }
         case QVariant::String: {
-            // lifetime of string == lifetime of its qvariant
-            const QString *str = static_cast<const QString*>(value.constData());
-            res = sqlite3_bind_text16(_stmt, pos, str->utf16(),
-                                      (str->size()) * sizeof(QChar), SQLITE_STATIC);
+            if( !value.toString().isNull() ) {
+                // lifetime of string == lifetime of its qvariant
+                const QString *str = static_cast<const QString*>(value.constData());
+                res = sqlite3_bind_text16(_stmt, pos, str->utf16(),
+                                          (str->size()) * sizeof(QChar), SQLITE_STATIC);
+            } else {
+                // unbound value create a null entry.
+                res = SQLITE_OK;
+            }
             break; }
         default: {
             QString str = value.toString();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list