1// qsqldriver.sip generated by MetaSIP
2//
3// This file is part of the QtSql Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23class QSqlDriver : QObject
24{
25%TypeHeaderCode
26#include <qsqldriver.h>
27%End
28
29%ConvertToSubClassCode
30    static struct class_graph {
31        const char *name;
32        sipTypeDef **type;
33        int yes, no;
34    } graph[] = {
35        {sipName_QSqlQueryModel, &sipType_QSqlQueryModel, 3, 1},
36        {sipName_QSqlRelationalDelegate, &sipType_QSqlRelationalDelegate, -1, 2},
37        {sipName_QSqlDriver, &sipType_QSqlDriver, -1, -1},
38        {sipName_QSqlTableModel, &sipType_QSqlTableModel, 4, -1},
39        {sipName_QSqlRelationalTableModel, &sipType_QSqlRelationalTableModel, -1, -1},
40    };
41
42    int i = 0;
43
44    sipType = NULL;
45
46    do
47    {
48        struct class_graph *cg = &graph[i];
49
50        if (cg->name != NULL && sipCpp->inherits(cg->name))
51        {
52            sipType = *cg->type;
53            i = cg->yes;
54        }
55        else
56            i = cg->no;
57    }
58    while (i >= 0);
59%End
60
61public:
62    enum DriverFeature
63    {
64        Transactions,
65        QuerySize,
66        BLOB,
67        Unicode,
68        PreparedQueries,
69        NamedPlaceholders,
70        PositionalPlaceholders,
71        LastInsertId,
72        BatchOperations,
73        SimpleLocking,
74        LowPrecisionNumbers,
75        EventNotifications,
76        FinishQuery,
77        MultipleResultSets,
78    };
79
80    enum StatementType
81    {
82        WhereStatement,
83        SelectStatement,
84        UpdateStatement,
85        InsertStatement,
86        DeleteStatement,
87    };
88
89    enum IdentifierType
90    {
91        FieldName,
92        TableName,
93    };
94
95    explicit QSqlDriver(QObject *parent /TransferThis/ = 0);
96    virtual ~QSqlDriver();
97    virtual bool isOpen() const;
98    bool isOpenError() const;
99    virtual bool beginTransaction() /ReleaseGIL/;
100    virtual bool commitTransaction() /ReleaseGIL/;
101    virtual bool rollbackTransaction() /ReleaseGIL/;
102    virtual QStringList tables(QSql::TableType tableType) const;
103    virtual QSqlIndex primaryIndex(const QString &tableName) const;
104    virtual QSqlRecord record(const QString &tableName) const;
105    virtual QString formatValue(const QSqlField &field, bool trimStrings = false) const;
106    virtual QString escapeIdentifier(const QString &identifier, QSqlDriver::IdentifierType type) const;
107    virtual QString sqlStatement(QSqlDriver::StatementType type, const QString &tableName, const QSqlRecord &rec, bool preparedStatement) const;
108    QSqlError lastError() const;
109    virtual QVariant handle() const;
110    virtual bool hasFeature(QSqlDriver::DriverFeature f) const = 0;
111    virtual void close() = 0;
112    virtual QSqlResult *createResult() const = 0 /Factory/;
113    virtual bool open(const QString &db, const QString &user = QString(), const QString &password = QString(), const QString &host = QString(), int port = -1, const QString &options = QString()) = 0 /ReleaseGIL/;
114
115protected:
116    virtual void setOpen(bool o);
117    virtual void setOpenError(bool e);
118    virtual void setLastError(const QSqlError &e);
119
120public:
121    virtual bool subscribeToNotification(const QString &name);
122    virtual bool unsubscribeFromNotification(const QString &name);
123    virtual QStringList subscribedToNotifications() const;
124
125    enum NotificationSource
126    {
127        UnknownSource,
128        SelfSource,
129        OtherSource,
130    };
131
132signals:
133    void notification(const QString &name);
134    void notification(const QString &name, QSqlDriver::NotificationSource source, const QVariant &payload);
135
136public:
137    virtual bool isIdentifierEscaped(const QString &identifier, QSqlDriver::IdentifierType type) const;
138    virtual QString stripDelimiters(const QString &identifier, QSqlDriver::IdentifierType type) const;
139    void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy);
140    QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const;
141%If (Qt_5_4_0 -)
142
143    enum DbmsType
144    {
145        UnknownDbms,
146        MSSqlServer,
147        MySqlServer,
148        PostgreSQL,
149        Oracle,
150        Sybase,
151        SQLite,
152        Interbase,
153        DB2,
154    };
155
156%End
157%If (Qt_5_4_0 -)
158    QSqlDriver::DbmsType dbmsType() const;
159%End
160};
161