[Qt-interest] Database abstraction with QSqlQueryModel
Andre Somers
andre at familiesomers.nl
Tue Aug 24 20:19:09 CEST 2010
Op 24-8-2010 20:11, Neville Dastur schreef:
> Just checking I've got this right and not missing something.
>
> The QSqlQueryModel doesn't seem to support full database abstraction. So
> what I mean by this is parameters etc. QSqlQuery on which it is based
> has bindValue(), but this is not implemented in QSqlQueryModel and so I
> have to code my own quoting and escaping of of data values? Also can't
> seem to find a way to use QSqlQuery to generate a sql statement that I
> can then pass to QSqlQueryModel.
>
> Is this right, before I post an item on Qt bug tracker.
SQL query construction is unfortunately a bit hidden and not very well
documented. However, it is available. Take a look at
QSqlDriver::sqlStatement(). It allows you to construct (basic) DML
statements. Escaping of values is also available from QSqlDriver, and
automatically done if you use sqlStatement.
HTH,
André
More information about the Qt-interest-old
mailing list