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 <andy.shaw@digia.com>
This commit is contained in:
Mark Brand 2013-02-26 18:18:39 +01:00 committed by The Qt Project
parent fd6821aa19
commit 2adeefc85f
2 changed files with 12 additions and 0 deletions

View File

@ -225,6 +225,17 @@ QSqlResult::QSqlResult(const QSqlDriver *db)
setNumericalPrecisionPolicy(d->sqldriver->numericalPrecisionPolicy()); setNumericalPrecisionPolicy(d->sqldriver->numericalPrecisionPolicy());
} }
/*! \internal
*/
QSqlResult::QSqlResult(QSqlResultPrivate &dd, const QSqlDriver *db)
{
d = &dd;
d->q_ptr = this;
d->sqldriver = const_cast<QSqlDriver *>(db);
if (d->sqldriver)
setNumericalPrecisionPolicy(d->sqldriver->numericalPrecisionPolicy());
}
/*! /*!
Destroys the object and frees any allocated resources. Destroys the object and frees any allocated resources.
*/ */

View File

@ -74,6 +74,7 @@ protected:
}; };
explicit QSqlResult(const QSqlDriver * db); explicit QSqlResult(const QSqlDriver * db);
QSqlResult(QSqlResultPrivate &dd, const QSqlDriver *db);
int at() const; int at() const;
QString lastQuery() const; QString lastQuery() const;
QSqlError lastError() const; QSqlError lastError() const;