On Wed, Sep 19, 2012 at 6:32 AM, Andras Mantia <[email protected]> wrote:
>
> As adding a new non-virtual function is binary compatible, there should be
> no problem to add a QSqlQuery::value(const QString&) method in 5.1.
>
Ah, cool. I wasn't sure about that. I shall then send a patch for 5.1
branch when it's ready and ask Mark Brand, Thanks.
Currently I'm using this aproach with my own class that inherits from
QSqlQuery. I guess showing the code helps understand:
template<typename T>
inline T value(const QString& fieldName) const
{ return value(fieldName).value<T>(); }
template<typename T>
inline T value(int field) const
{ return value(field).value<T>(); }
QVariant value( const QString& fieldName ) const
{
int index = record().indexOf(fieldName);
if ( index < 0 )
qWarning( QString("Unknown field %1").arg(fieldName) );
return QSqlQuery::value( index );
}
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development