From b742dbdc3fe85062cfe133de9db9e81703203ac0 Mon Sep 17 00:00:00 2001 From: "Thiago A. Correa" Date: Thu, 4 Oct 2012 13:11:23 -0300 Subject: Fix QSqlQuery::value to use proper index check 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 --- src/sql/kernel/qsqlquery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sql') diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index 8cba7623be..eff211cc37 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -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(); -- cgit v1.2.3