Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsql_mysql_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QSQL_MYSQL_H
6#define QSQL_MYSQL_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtSql/qsqldriver.h>
20
21#if defined (Q_OS_WIN32)
22#include <QtCore/qt_windows.h>
23#endif
24
25#include <mysql.h>
26
27#ifdef QT_PLUGIN
28#define Q_EXPORT_SQLDRIVER_MYSQL
29#else
30#define Q_EXPORT_SQLDRIVER_MYSQL Q_SQL_EXPORT
31#endif
32
34
36
37class Q_EXPORT_SQLDRIVER_MYSQL QMYSQLDriver : public QSqlDriver
38{
39 friend class QMYSQLResultPrivate;
40 Q_DECLARE_PRIVATE(QMYSQLDriver)
41 Q_OBJECT
42public:
43 explicit QMYSQLDriver(QObject *parent=nullptr);
44 explicit QMYSQLDriver(MYSQL *con, QObject * parent=nullptr);
45 ~QMYSQLDriver();
46 bool hasFeature(DriverFeature f) const override;
47 bool open(const QString & db,
48 const QString & user,
49 const QString & password,
50 const QString & host,
51 int port,
52 const QString& connOpts) override;
53 void close() override;
54 QSqlResult *createResult() const override;
55 QStringList tables(QSql::TableType) const override;
56 QSqlIndex primaryIndex(const QString& tablename) const override;
57 QSqlRecord record(const QString& tablename) const override;
58 QString formatValue(const QSqlField &field,
59 bool trimStrings) const override;
60 QVariant handle() const override;
61 QString escapeIdentifier(const QString &identifier, IdentifierType type) const override;
62
63 bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const override;
64
65protected:
66 bool beginTransaction() override;
67 bool commitTransaction() override;
68 bool rollbackTransaction() override;
69private:
70 void init();
71};
72
73QT_END_NAMESPACE
74
75#endif // QSQL_MYSQL_H
QSqlDriver * create(const QString &) override
Creates and returns a QSqlDriver object for the driver called key.
Definition main.cpp:29
#define Q_EXPORT_SQLDRIVER_MYSQL