[Development] Proposing QSqlQuery syntax sugar

Thiago A. CorrĂȘa thiago.correa at gmail.com
Tue Sep 18 05:24:45 CEST 2012


Hi,

      I'd like to propose a templated QSqlQuery::value in the same way
QVariant::value works. This syntax suggar allows one to write:

      QSqlQuery query;
      ...
      int myvalue = query.value<int>(0);

      Instead of the current:
      int myvalue = query.value(0).toInt();

      And also QSqlQuery::value( const QString& ) overload to obtain
column values by name instead of column index.
      Writting code that relies on column names is more robust to
changes than indexes, yet in current API it's very clumbersome:

      int myvalue = query.record().value("MyColumn").toInt();

      I'm not very experienced with Qt workflow, how would one go
about proposing those changes? Should it be for 5.0.0 or 5.1.0? Can
such a change be pushed somewhere or should wait for Qt5 release?

Kind Regards,
     Thiago A. Correa



More information about the Development mailing list