qsql: move Q<driver>Result out of header

Leaf result classes do not need to be exposed in the headers. The
implementations were inconsistent on this point.

Change-Id: I5bd41ae9e77b932f6232218a014400a59f2ef5a0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This commit is contained in:
Mark Brand 2015-11-23 12:19:25 +01:00
parent 6333edfdf3
commit d6ecdb4344
8 changed files with 134 additions and 142 deletions

View File

@ -32,7 +32,6 @@
****************************************************************************/
#include "qsql_db2_p.h"
#include <QtSql/private/qsqldriver_p.h>
#include <qcoreapplication.h>
#include <qdatetime.h>
#include <qsqlfield.h>
@ -43,6 +42,8 @@
#include <qvarlengtharray.h>
#include <qvector.h>
#include <QDebug>
#include <QtSql/private/qsqldriver_p.h>
#include <QtSql/private/qsqlresult_p.h>
#if defined(Q_CC_BOR)
// DB2's sqlsystm.h (included through sqlcli1.h) defines the SQL_BIGINT_TYPE
@ -72,6 +73,36 @@ public:
QString user;
};
class QDB2ResultPrivate;
class QDB2Result: public QSqlResult
{
public:
QDB2Result(const QDB2Driver *dr, const QDB2DriverPrivate *dp);
~QDB2Result();
bool prepare(const QString &query);
bool exec();
QVariant handle() const;
protected:
QVariant data(int field);
bool reset (const QString &query);
bool fetch(int i);
bool fetchNext();
bool fetchFirst();
bool fetchLast();
bool isNull(int i);
int size();
int numRowsAffected();
QSqlRecord record() const;
void virtual_hook(int id, void *data);
void detachFromResultSet();
bool nextResult();
private:
QDB2ResultPrivate *d;
};
class QDB2ResultPrivate
{
public:

View File

@ -53,43 +53,11 @@
#define Q_EXPORT_SQLDRIVER_DB2 Q_SQL_EXPORT
#endif
#include <QtSql/qsqlresult.h>
#include <QtSql/qsqldriver.h>
QT_BEGIN_NAMESPACE
class QDB2Driver;
class QDB2DriverPrivate;
class QDB2ResultPrivate;
class QSqlRecord;
class QDB2Result : public QSqlResult
{
public:
QDB2Result(const QDB2Driver* dr, const QDB2DriverPrivate* dp);
~QDB2Result();
bool prepare(const QString& query);
bool exec();
QVariant handle() const;
protected:
QVariant data(int field);
bool reset (const QString& query);
bool fetch(int i);
bool fetchNext();
bool fetchFirst();
bool fetchLast();
bool isNull(int i);
int size();
int numRowsAffected();
QSqlRecord record() const;
void virtual_hook(int id, void *data);
void detachFromResultSet();
bool nextResult();
private:
QDB2ResultPrivate* d;
};
class Q_EXPORT_SQLDRIVER_DB2 QDB2Driver : public QSqlDriver
{

View File

@ -33,7 +33,6 @@
#include "qsql_mysql_p.h"
#include <QtSql/private/qsqldriver_p.h>
#include <qcoreapplication.h>
#include <qvariant.h>
#include <qdatetime.h>
@ -46,8 +45,9 @@
#include <qtextcodec.h>
#include <qvector.h>
#include <qfile.h>
#include <qdebug.h>
#include <QtSql/private/qsqldriver_p.h>
#include <QtSql/private/qsqlresult_p.h>
#ifdef Q_OS_WIN32
// comment the next line out if you want to use MySQL/embedded on Win32 systems.
@ -156,6 +156,41 @@ static inline QVariant qDateTimeFromString(QString &val)
#endif
}
class QMYSQLResultPrivate;
class QMYSQLResult : public QSqlResult
{
friend class QMYSQLDriver;
friend class QMYSQLResultPrivate;
public:
explicit QMYSQLResult(const QMYSQLDriver *db);
~QMYSQLResult();
QVariant handle() const Q_DECL_OVERRIDE;
protected:
void cleanup();
bool fetch(int i) Q_DECL_OVERRIDE;
bool fetchNext() Q_DECL_OVERRIDE;
bool fetchLast() Q_DECL_OVERRIDE;
bool fetchFirst() Q_DECL_OVERRIDE;
QVariant data(int field) Q_DECL_OVERRIDE;
bool isNull(int field) Q_DECL_OVERRIDE;
bool reset (const QString& query) Q_DECL_OVERRIDE;
int size() Q_DECL_OVERRIDE;
int numRowsAffected() Q_DECL_OVERRIDE;
QVariant lastInsertId() const Q_DECL_OVERRIDE;
QSqlRecord record() const Q_DECL_OVERRIDE;
void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
bool nextResult() Q_DECL_OVERRIDE;
#if MYSQL_VERSION_ID >= 40108
bool prepare(const QString &stmt) Q_DECL_OVERRIDE;
bool exec() Q_DECL_OVERRIDE;
#endif
private:
QMYSQLResultPrivate *d;
};
class QMYSQLResultPrivate : public QObject
{
Q_OBJECT

View File

@ -46,7 +46,6 @@
//
#include <QtSql/qsqldriver.h>
#include <QtSql/qsqlresult.h>
#if defined (Q_OS_WIN32)
#include <QtCore/qt_windows.h>
@ -63,42 +62,6 @@
QT_BEGIN_NAMESPACE
class QMYSQLDriverPrivate;
class QMYSQLResultPrivate;
class QMYSQLDriver;
class QSqlRecordInfo;
class QMYSQLResult : public QSqlResult
{
friend class QMYSQLDriver;
friend class QMYSQLResultPrivate;
public:
explicit QMYSQLResult(const QMYSQLDriver* db);
~QMYSQLResult();
QVariant handle() const Q_DECL_OVERRIDE;
protected:
void cleanup();
bool fetch(int i) Q_DECL_OVERRIDE;
bool fetchNext() Q_DECL_OVERRIDE;
bool fetchLast() Q_DECL_OVERRIDE;
bool fetchFirst() Q_DECL_OVERRIDE;
QVariant data(int field) Q_DECL_OVERRIDE;
bool isNull(int field) Q_DECL_OVERRIDE;
bool reset (const QString& query) Q_DECL_OVERRIDE;
int size() Q_DECL_OVERRIDE;
int numRowsAffected() Q_DECL_OVERRIDE;
QVariant lastInsertId() const Q_DECL_OVERRIDE;
QSqlRecord record() const Q_DECL_OVERRIDE;
void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
bool nextResult() Q_DECL_OVERRIDE;
#if MYSQL_VERSION_ID >= 40108
bool prepare(const QString& stmt) Q_DECL_OVERRIDE;
bool exec() Q_DECL_OVERRIDE;
#endif
private:
QMYSQLResultPrivate* d;
};
class Q_EXPORT_SQLDRIVER_MYSQL QMYSQLDriver : public QSqlDriver
{

View File

@ -50,6 +50,7 @@
#include <QDebug>
#include <QSqlQuery>
#include <QtSql/private/qsqldriver_p.h>
#include <QtSql/private/qsqlresult_p.h>
QT_BEGIN_NAMESPACE
@ -143,6 +144,41 @@ private:
QChar quote;
};
class QODBCResultPrivate;
class QODBCResult: public QSqlResult
{
public:
QODBCResult(const QODBCDriver *db, QODBCDriverPrivate *p);
virtual ~QODBCResult();
bool prepare(const QString &query);
bool exec();
QVariant lastInsertId() const;
QVariant handle() const;
virtual void setForwardOnly(bool forward);
protected:
bool fetchNext();
bool fetchFirst();
bool fetchLast();
bool fetchPrevious();
bool fetch(int i);
bool reset (const QString &query);
QVariant data(int field);
bool isNull(int field);
int size();
int numRowsAffected();
QSqlRecord record() const;
void virtual_hook(int id, void *data);
void detachFromResultSet();
bool nextResult();
private:
QODBCResultPrivate *d;
};
class QODBCResultPrivate
{
public:

View File

@ -46,7 +46,6 @@
//
#include <QtSql/qsqldriver.h>
#include <QtSql/qsqlresult.h>
#if defined (Q_OS_WIN32)
#include <QtCore/qt_windows.h>
@ -75,43 +74,7 @@
QT_BEGIN_NAMESPACE
class QODBCResultPrivate;
class QODBCDriverPrivate;
class QODBCDriver;
class QSqlRecordInfo;
class QODBCResult : public QSqlResult
{
public:
QODBCResult(const QODBCDriver * db, QODBCDriverPrivate* p);
virtual ~QODBCResult();
bool prepare(const QString& query);
bool exec();
QVariant lastInsertId() const;
QVariant handle() const;
virtual void setForwardOnly(bool forward);
protected:
bool fetchNext();
bool fetchFirst();
bool fetchLast();
bool fetchPrevious();
bool fetch(int i);
bool reset (const QString& query);
QVariant data(int field);
bool isNull(int field);
int size();
int numRowsAffected();
QSqlRecord record() const;
void virtual_hook(int id, void *data);
void detachFromResultSet();
bool nextResult();
private:
QODBCResultPrivate *d;
};
class Q_EXPORT_SQLDRIVER_ODBC QODBCDriver : public QSqlDriver
{

View File

@ -119,6 +119,35 @@ inline void qPQfreemem(void *buffer)
PQfreemem(buffer);
}
class QPSQLResultPrivate;
class QPSQLResult: public QSqlResult
{
Q_DECLARE_PRIVATE(QPSQLResult)
public:
QPSQLResult(const QPSQLDriver *db);
~QPSQLResult();
QVariant handle() const Q_DECL_OVERRIDE;
void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
protected:
void cleanup();
bool fetch(int i) Q_DECL_OVERRIDE;
bool fetchFirst() Q_DECL_OVERRIDE;
bool fetchLast() Q_DECL_OVERRIDE;
QVariant data(int i) Q_DECL_OVERRIDE;
bool isNull(int field) Q_DECL_OVERRIDE;
bool reset (const QString &query) Q_DECL_OVERRIDE;
int size() Q_DECL_OVERRIDE;
int numRowsAffected() Q_DECL_OVERRIDE;
QSqlRecord record() const Q_DECL_OVERRIDE;
QVariant lastInsertId() const Q_DECL_OVERRIDE;
bool prepare(const QString &query) Q_DECL_OVERRIDE;
bool exec() Q_DECL_OVERRIDE;
};
class QPSQLDriverPrivate : public QSqlDriverPrivate
{
Q_DECLARE_PUBLIC(QPSQLDriver)

View File

@ -45,7 +45,6 @@
// We mean it.
//
#include <QtSql/qsqlresult.h>
#include <QtSql/qsqldriver.h>
#ifdef QT_PLUGIN
@ -59,44 +58,12 @@ typedef struct pg_result PGresult;
QT_BEGIN_NAMESPACE
class QPSQLResultPrivate;
class QPSQLDriver;
class QSqlRecordInfo;
class QPSQLResult : public QSqlResult
{
Q_DECLARE_PRIVATE(QPSQLResult)
public:
QPSQLResult(const QPSQLDriver* db);
~QPSQLResult();
QVariant handle() const Q_DECL_OVERRIDE;
void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
protected:
void cleanup();
bool fetch(int i) Q_DECL_OVERRIDE;
bool fetchFirst() Q_DECL_OVERRIDE;
bool fetchLast() Q_DECL_OVERRIDE;
QVariant data(int i) Q_DECL_OVERRIDE;
bool isNull(int field) Q_DECL_OVERRIDE;
bool reset (const QString& query) Q_DECL_OVERRIDE;
int size() Q_DECL_OVERRIDE;
int numRowsAffected() Q_DECL_OVERRIDE;
QSqlRecord record() const Q_DECL_OVERRIDE;
QVariant lastInsertId() const Q_DECL_OVERRIDE;
bool prepare(const QString& query) Q_DECL_OVERRIDE;
bool exec() Q_DECL_OVERRIDE;
};
class QPSQLDriverPrivate;
class Q_EXPORT_SQLDRIVER_PSQL QPSQLDriver : public QSqlDriver
{
friend class QPSQLResultPrivate;
Q_DECLARE_PRIVATE(QPSQLDriver)
Q_OBJECT
public:
enum Protocol {