prepare QSqlResultPrivate() to allow subclassing

Allow the private class to be instantiated before the public class.
Public subclasses will need to first instantiate the private subclass
and pass the reference to QSqlResult.

Add virtual constructor so QSqlResult can delete private class
polymorphically.

Change-Id: Ide7115dbb4150d6604677b542dbec16e6956a142
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
This commit is contained in:
Mark Brand 2013-02-26 16:40:51 +01:00 committed by The Qt Project
parent d28073d9eb
commit 8434b7ad4a
2 changed files with 7 additions and 6 deletions

View File

@ -218,11 +218,11 @@ QString QSqlResultPrivate::namedToPositionalBinding(const QString &query)
QSqlResult::QSqlResult(const QSqlDriver *db)
{
d = new QSqlResultPrivate(this);
d = new QSqlResultPrivate;
d->q = this;
d->sqldriver = const_cast<QSqlDriver *>(db);
if(db) {
setNumericalPrecisionPolicy(db->numericalPrecisionPolicy());
}
if (d->sqldriver)
setNumericalPrecisionPolicy(d->sqldriver->numericalPrecisionPolicy());
}
/*!

View File

@ -71,8 +71,8 @@ struct QHolder {
class Q_SQL_EXPORT QSqlResultPrivate
{
public:
QSqlResultPrivate(QSqlResult *d)
: q(d),
QSqlResultPrivate()
: q(0),
idx(QSql::BeforeFirstRow),
active(false),
isSel(false),
@ -81,6 +81,7 @@ public:
bindCount(0),
binds(QSqlResult::PositionalBinding)
{ }
virtual ~QSqlResultPrivate() { }
void clearValues()
{