summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/mysql
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/mysql
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/mysql')
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp59
1 files changed, 22 insertions, 37 deletions
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index 90a810d516..70b9e7e729 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -78,17 +78,14 @@ class QMYSQLDriverPrivate : public QSqlDriverPrivate
Q_DECLARE_PUBLIC(QMYSQLDriver)
public:
- QMYSQLDriverPrivate() : QSqlDriverPrivate(), mysql(0),
+ QMYSQLDriverPrivate() : QSqlDriverPrivate(QSqlDriver::MySqlServer)
#if QT_CONFIG(textcodec)
- tc(QTextCodec::codecForLocale()),
-#else
- tc(0),
+ , tc(QTextCodec::codecForLocale())
#endif
- preparedQuerysEnabled(false) { dbmsType = QSqlDriver::MySqlServer; }
- MYSQL *mysql;
- QTextCodec *tc;
-
- bool preparedQuerysEnabled;
+ {}
+ MYSQL *mysql = nullptr;
+ QTextCodec *tc = nullptr;
+ bool preparedQuerysEnabled = false;
};
static inline QString toUnicode(QTextCodec *tc, const char *str)
@@ -201,46 +198,34 @@ class QMYSQLResultPrivate: public QSqlResultPrivate
public:
Q_DECLARE_SQLDRIVER_PRIVATE(QMYSQLDriver)
- QMYSQLResultPrivate(QMYSQLResult *q, const QMYSQLDriver *drv)
- : QSqlResultPrivate(q, drv),
- result(0),
- rowsAffected(0),
- hasBlobs(false)
- , stmt(0), meta(0), inBinds(0), outBinds(0)
- , preparedQuery(false)
- { }
-
- MYSQL_RES *result;
- MYSQL_ROW row;
-
- int rowsAffected;
+ using QSqlResultPrivate::QSqlResultPrivate;
bool bindInValues();
void bindBlobs();
- bool hasBlobs;
+ MYSQL_RES *result = nullptr;
+ MYSQL_ROW row;
+
struct QMyField
{
- QMyField()
- : outField(0), nullIndicator(false), bufLength(0ul),
- myField(0), type(QMetaType::UnknownType)
- {}
- char *outField;
- my_bool nullIndicator;
- ulong bufLength;
- MYSQL_FIELD *myField;
- QMetaType::Type type;
+ char *outField = nullptr;
+ MYSQL_FIELD *myField = nullptr;
+ QMetaType::Type type = QMetaType::UnknownType;
+ my_bool nullIndicator = false;
+ ulong bufLength = 0ul;
};
QVector<QMyField> fields;
- MYSQL_STMT* stmt;
- MYSQL_RES* meta;
+ MYSQL_STMT *stmt = nullptr;
+ MYSQL_RES *meta = nullptr;
- MYSQL_BIND *inBinds;
- MYSQL_BIND *outBinds;
+ MYSQL_BIND *inBinds = nullptr;
+ MYSQL_BIND *outBinds = nullptr;
- bool preparedQuery;
+ int rowsAffected = 0;
+ bool hasBlobs = false;
+ bool preparedQuery = false;
};
#if QT_CONFIG(textcodec)