mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 11:48:56 +03:00
ownSql: create an null value of an empty string in bindValue.
This commit is contained in:
parent
8c7953a47c
commit
e51c299937
1 changed files with 9 additions and 4 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue