diff options
author | Tasuku Suzuki <stasuku@gmail.com> | 2013-09-21 15:23:16 +0900 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-22 17:05:47 +0200 |
commit | 109bf980b37fed405c6c1eb14cb9c83ff897e389 (patch) | |
tree | c0c1c006770524dbb98436f4f04cfc16890c310e /src/sql/kernel | |
parent | 2d107c20b9670976e0d4a22edc6c3b235e225fa4 (diff) |
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>
Diffstat (limited to 'src/sql/kernel')
-rw-r--r-- | src/sql/kernel/qsqlquery.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index 661a582afe..e5f4c5fc56 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -309,19 +309,20 @@ QSqlQuery& QSqlQuery::operator=(const QSqlQuery& other) } /*! - Returns \c true if the query is \l{isActive()}{active} and positioned - on a valid record and the \a field is NULL; otherwise returns - false. Note that for some drivers, isNull() will not return accurate - information until after an attempt is made to retrieve data. + Returns \c true if the query is not \l{isActive()}{active}, + the query is not positioned on a valid record, + there is no such field, or the field is null; otherwise \c false. + 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 { - if (d->sqlResult->isActive() && d->sqlResult->isValid()) - return d->sqlResult->isNull(field); - return true; + return !d->sqlResult->isActive() + || !d->sqlResult->isValid() + || d->sqlResult->isNull(field); } /*! |