Fix a bug in QSqlQuery::isNull documentation
the method returns true if there is not such field. Change-Id: I25db8de4561d3e0604f3e64edc1810140ba4aad2 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
parent
2d107c20b9
commit
109bf980b3
@ -309,19 +309,20 @@ QSqlQuery& QSqlQuery::operator=(const QSqlQuery& other)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns \c true if the query is \l{isActive()}{active} and positioned
|
Returns \c true if the query is not \l{isActive()}{active},
|
||||||
on a valid record and the \a field is NULL; otherwise returns
|
the query is not positioned on a valid record,
|
||||||
false. Note that for some drivers, isNull() will not return accurate
|
there is no such field, or the field is null; otherwise \c false.
|
||||||
information until after an attempt is made to retrieve data.
|
Note that for some drivers, isNull() will not return accurate
|
||||||
|
information until after an attempt is made to retrieve data.
|
||||||
|
|
||||||
\sa isActive(), isValid(), value()
|
\sa isActive(), isValid(), value()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QSqlQuery::isNull(int field) const
|
bool QSqlQuery::isNull(int field) const
|
||||||
{
|
{
|
||||||
if (d->sqlResult->isActive() && d->sqlResult->isValid())
|
return !d->sqlResult->isActive()
|
||||||
return d->sqlResult->isNull(field);
|
|| !d->sqlResult->isValid()
|
||||||
return true;
|
|| d->sqlResult->isNull(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -1393,6 +1393,9 @@ void tst_QSqlQuery::isNull()
|
|||||||
QVERIFY( q.next() );
|
QVERIFY( q.next() );
|
||||||
QVERIFY( !q.isNull( 0 ) );
|
QVERIFY( !q.isNull( 0 ) );
|
||||||
QVERIFY( !q.isNull( 1 ) );
|
QVERIFY( !q.isNull( 1 ) );
|
||||||
|
|
||||||
|
// For a non existent field, it should be returning true.
|
||||||
|
QVERIFY(q.isNull(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! TDS specific BIT field test */
|
/*! TDS specific BIT field test */
|
||||||
|
Loading…
Reference in New Issue
Block a user