diff options
author | Mark Brand <mabrand@mabrand.nl> | 2013-03-21 22:32:40 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-02 14:31:47 +0200 |
commit | 4131bfb2c28d0554805bbfcf009b422bda820c09 (patch) | |
tree | 9b01fe9d0cbef800243982e8874d772a6f7221e8 /src/sql/kernel/qsqlresult_p.h | |
parent | db6190d6fe261712236b61a208f821c1c0fd7f00 (diff) |
make QSqlResultPrivate::fieldSerial() virtual
The Qt psql driver has its own implementation of fieldSerial() it uses
when it invokes positionalToNamedBinding() to generate a query using
its native naming style. Now that QPSQLResultPrivate is derived from
QSqlResultPrivate this can be implemented more conventionally using
a virtual function instead of pointers to static functions.
Note that this change preserves the current behavior of
executedQuery() which will continue to return the query with
positional syntax that is presented to virtual prepare() by
QSqlResult::savePrepare(). Since the driver does not have the
NamedPlaceholders feature, QSqlResult::savePrepare() will not use
positionaltoNamedBinding() to set executedQuery. Although
QPSQLResult::prepare() calls positionaltoNamedBinding(),
it does not put the result into executedQuery.
Change-Id: I7740f386cbfec9eadd9e4d6a7df3e590294655a5
Reviewed-by: Israel Lins Albuquerque <israelins85@yahoo.com.br>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Diffstat (limited to 'src/sql/kernel/qsqlresult_p.h')
-rw-r--r-- | src/sql/kernel/qsqlresult_p.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/sql/kernel/qsqlresult_p.h b/src/sql/kernel/qsqlresult_p.h index 46ee6ce195..7f0459f3a8 100644 --- a/src/sql/kernel/qsqlresult_p.h +++ b/src/sql/kernel/qsqlresult_p.h @@ -108,13 +108,8 @@ public: clearIndex();; } - // positionalToNamedBinding uses fieldSerial() by default, which converts to Oracle-style names, - // because this style is used in the API. A driver can reuse positionalToNamedBinding() - // internally for its own naming style by supplying its own fieldSerialFunc. We cannot make - // fieldSerial() virtual because it would allow a driver to impose its naming style on - // executedQuery when set by QSqlResult::savePrepare(). - static QString fieldSerial(int); - static QString positionalToNamedBinding(const QString &query, QString (fieldSerialFunc)(int idx) = fieldSerial); + virtual QString fieldSerial(int) const; + QString positionalToNamedBinding(const QString &query) const; QString namedToPositionalBinding(const QString &query); QString holderAt(int index) const; |