}
/*!
+ \overload
+
+ Returns the value of the field called \a name in the current record.
+ If field \a name does not exist an invalid variant is returned.
+
+ This overload is less efficient than \l{QSqlQuery::}{value()}
+*/
+
+QVariant QSqlQuery::value(const QString& name) const
+{
+ int index = d->sqlResult->record().indexOf(name);
+ if (index > -1)
+ return value(index);
+ qWarning("QSqlQuery::value: unknown field name '%s'", qPrintable(name));
+ return QVariant();
+}
+
+/*!
Returns the current internal position of the query. The first
record is at position zero. If the position is invalid, the
function returns QSql::BeforeFirstRow or
void setForwardOnly(bool forward);
bool exec(const QString& query);
QVariant value(int i) const;
+ QVariant value(const QString& name) const;
void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy);
QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const;
while ( q.next() ) {
QCOMPARE( q.value( 0 ).toInt(), i );
+ QCOMPARE( q.value( "id" ).toInt(), i );
if ( db.driverName().startsWith( "QIBASE" ) )
QVERIFY( q.value( 1 ).toString().startsWith( "VarChar" + QString::number( i ) ) );