From 2adeefc85f05565f4c1583e35dbed838aa5569cf Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Tue, 26 Feb 2013 18:18:39 +0100 Subject: [PATCH] add QSqlResult constructor suitable for inheritance The new constructor accepts reference to the private class provided by a subclass. Change-Id: I568e31727bb90de12ee8bb7bf0ed442737056470 Reviewed-by: Andy Shaw --- src/sql/kernel/qsqlresult.cpp | 11 +++++++++++ src/sql/kernel/qsqlresult.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp index 9d33f38188..51faf7007f 100644 --- a/src/sql/kernel/qsqlresult.cpp +++ b/src/sql/kernel/qsqlresult.cpp @@ -225,6 +225,17 @@ QSqlResult::QSqlResult(const QSqlDriver *db) setNumericalPrecisionPolicy(d->sqldriver->numericalPrecisionPolicy()); } +/*! \internal +*/ +QSqlResult::QSqlResult(QSqlResultPrivate &dd, const QSqlDriver *db) +{ + d = ⅆ + d->q_ptr = this; + d->sqldriver = const_cast(db); + if (d->sqldriver) + setNumericalPrecisionPolicy(d->sqldriver->numericalPrecisionPolicy()); +} + /*! Destroys the object and frees any allocated resources. */ diff --git a/src/sql/kernel/qsqlresult.h b/src/sql/kernel/qsqlresult.h index 649e3587ab..7252d69460 100644 --- a/src/sql/kernel/qsqlresult.h +++ b/src/sql/kernel/qsqlresult.h @@ -74,6 +74,7 @@ protected: }; explicit QSqlResult(const QSqlDriver * db); + QSqlResult(QSqlResultPrivate &dd, const QSqlDriver *db); int at() const; QString lastQuery() const; QSqlError lastError() const;