summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/psql
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2020-01-26 20:07:50 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2020-02-19 06:50:21 +0100
commit3dd5caaaec7c4c0d209b0327b647bfb5d46ac001 (patch)
tree9312131e6ef4f0c0466de63501ddd7c45d1843ea /src/plugins/sqldrivers/psql
parentfd49b4a2b935362fa76ce3297576addf459bf120 (diff)
QtSql: cleanup QSqlDriverPrivate and QSqlResultPrivate
Cleanup QSqlDriverPrivate/QSqlResultPrivate and their derived classes in ODBC, MySql, PostgreSQL and SQLite. Change-Id: I52e69c00cf981b81dde7c3a0370f86f06ef756bb Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins/sqldrivers/psql')
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp48
1 files changed, 16 insertions, 32 deletions
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index d735d29fc7..38bf355856 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -149,26 +149,17 @@ class QPSQLDriverPrivate final : public QSqlDriverPrivate
{
Q_DECLARE_PUBLIC(QPSQLDriver)
public:
- QPSQLDriverPrivate() : QSqlDriverPrivate(),
- connection(nullptr),
- isUtf8(false),
- pro(QPSQLDriver::Version6),
- sn(nullptr),
- pendingNotifyCheck(false),
- hasBackslashEscape(false),
- stmtCount(0),
- currentStmtId(InvalidStatementId)
- { dbmsType = QSqlDriver::PostgreSQL; }
-
- PGconn *connection;
- bool isUtf8;
- QPSQLDriver::Protocol pro;
- QSocketNotifier *sn;
+ QPSQLDriverPrivate() : QSqlDriverPrivate(QSqlDriver::PostgreSQL) {}
+
QStringList seid;
- mutable bool pendingNotifyCheck;
- bool hasBackslashEscape;
- int stmtCount;
- StatementId currentStmtId;
+ PGconn *connection = nullptr;
+ QSocketNotifier *sn = nullptr;
+ QPSQLDriver::Protocol pro = QPSQLDriver::Version6;
+ StatementId currentStmtId = InvalidStatementId;
+ int stmtCount = 0;
+ mutable bool pendingNotifyCheck = false;
+ bool hasBackslashEscape = false;
+ bool isUtf8 = false;
void appendTables(QStringList &tl, QSqlQuery &t, QChar type);
PGresult *exec(const char *stmt);
@@ -297,25 +288,18 @@ class QPSQLResultPrivate : public QSqlResultPrivate
Q_DECLARE_PUBLIC(QPSQLResult)
public:
Q_DECLARE_SQLDRIVER_PRIVATE(QPSQLDriver)
- QPSQLResultPrivate(QPSQLResult *q, const QPSQLDriver *drv)
- : QSqlResultPrivate(q, drv),
- result(nullptr),
- stmtId(InvalidStatementId),
- currentSize(-1),
- canFetchMoreRows(false),
- preparedQueriesEnabled(false)
- { }
+ using QSqlResultPrivate::QSqlResultPrivate;
QString fieldSerial(int i) const override { return QLatin1Char('$') + QString::number(i + 1); }
void deallocatePreparedStmt();
- PGresult *result;
std::queue<PGresult*> nextResultSets;
QString preparedStmtId;
- StatementId stmtId;
- int currentSize;
- bool canFetchMoreRows;
- bool preparedQueriesEnabled;
+ PGresult *result = nullptr;
+ StatementId stmtId = InvalidStatementId;
+ int currentSize = -1;
+ bool canFetchMoreRows = false;
+ bool preparedQueriesEnabled = false;
bool processResults();
};