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 <mabrand@mabrand.nl>
bb10
Thiago A. Correa 2012-10-04 13:11:23 -03:00 committed by The Qt Project
parent bdd3521f83
commit b742dbdc3f
1 changed files with 1 additions and 1 deletions

View 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();