Fix QSqlQuery::value to use proper index check
authorThiago A. Correa <thiago.correa@gmail.com>
Thu, 4 Oct 2012 16:11:23 +0000 (13:11 -0300)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 5 Oct 2012 01:16:37 +0000 (03:16 +0200)
Change the validation of index parameter to use -1 constant
instead of QSql::BeforeFirstRow which is unrelated to field index

Change-Id: I43b42bc7ce717bcd9ddc987d2e716f1672c00775
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
src/sql/kernel/qsqlquery.cpp

index 8cba762..eff211c 100644 (file)
@@ -399,7 +399,7 @@ bool QSqlQuery::exec(const QString& query)
 
 QVariant QSqlQuery::value(int index) const
 {
-    if (isActive() && isValid() && (index > QSql::BeforeFirstRow))
+    if (isActive() && isValid() && (index > -1))
         return d->sqlResult->data(index);
     qWarning("QSqlQuery::value: not positioned on a valid record");
     return QVariant();