QIbaseResult: qWarning, when disallowed null parameter becomes zero

QIbaseResult turns null into zero when database field doesn't
accept a null argument.

This patch adds a warning in that case. It would be better to return
with an error, but that breaks existing behavior with code relying on
it.

Fixes: QTBUG-114683
Pick-to: 6.6 6.5
Change-Id: Ib50b7b6b4dd6c51489ba8b355f7baa8b1b14dc15
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
bb10
Axel Spoerl 2023-07-03 16:01:25 +02:00
parent 3748b194d4
commit a7deddba51
1 changed files with 3 additions and 0 deletions

View File

@ -1051,6 +1051,9 @@ bool QIBaseResult::exec()
}
// a value of 0 means non-null.
*(d->inda->sqlvar[para].sqlind) = 0;
} else {
qWarning() << "QIBaseResult::exec: Null value replaced by zero for"_L1
<< d->inda->sqlvar[para].ownname;
}
switch(d->inda->sqlvar[para].sqltype & ~1) {
case SQL_INT64: