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_firebird_driver_p.h
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// Copyright (C) 2026 Andreas Bacher
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5#ifndef QSQL_FIREBIRD_DRIVER_P_H
6#define QSQL_FIREBIRD_DRIVER_P_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
21
22#include <QtCore/qhash.h>
23#include <QtCore/qlist.h>
24#include <QtSql/qsqlerror.h>
25#include <QtSql/private/qsqldriver_p.h>
26
27#include <firebird/Interface.h>
28
29#include <mutex>
30
31QT_BEGIN_NAMESPACE
32
33class QFirebirdEventSubscription;
34
35// Private driver state
36
38{
39 Q_DECLARE_PUBLIC(QFirebirdDriver)
40public:
47
49 {
50 if (iStatus)
52 }
53
54 Firebird::IMaster *master = nullptr;
57 Firebird::ITransaction *iTrans = nullptr; // explicit user-managed transaction
58
59 /*! \internal
60 Guards the iAtt lifecycle (published in open(), withdrawn in close())
61 against cancelQuery(), which reads and uses the attachment from a
62 foreign thread. All other iAtt access is owner-thread-only.
63 */
64 std::mutex attMutex;
65
66 /*! \internal
67 Opt-in (connection option FB_SCROLLABLE_CACHE=1): when set, scrollable
68 (non-forward-only) SELECT results buffer their rows client-side as they
69 are first read, so random seek()s become in-memory lookups instead of a
70 server fetchAbsolute round-trip each. Trades memory for random-access
71 speed; off by default to preserve the driver's low-memory streaming model.
72 */
74
76
77 /*! \internal
78 Results created from this driver. Tracked so they can be neutralised if
79 the driver object is destroyed while a QSqlQuery is still alive — see
80 ~QFirebirdDriver and QFirebirdResultPrivate::cleanup().
81 */
83
84 void setError(const QString &msg,
85 QSqlError::ErrorType type, const QString &code = {})
86 {
87 Q_Q(QFirebirdDriver);
88 q->setLastError(QSqlError(msg, {}, type, code));
89 }
90
91 void setFbError(const QString &context,
92 QSqlError::ErrorType type = QSqlError::UnknownError);
93
94 /*! \internal
95 Finish the active user transaction by committing or rolling back. On a
96 failed commit/rollback the handle is released and the member cleared so
97 no caller sees a stale pointer. Shared by commitTransaction()/
98 rollbackTransaction(), which differ only in the verb.
99 */
100 bool finishTransaction(TxnEnd end);
101};
102
103QT_END_NAMESPACE
104
105#endif // QSQL_FIREBIRD_DRIVER_P_H
void setError(const QString &msg, QSqlError::ErrorType type, const QString &code={})
QHash< QString, QFirebirdEventSubscription * > eventSubscriptions
Firebird::ITransaction * iTrans
Firebird::IAttachment * iAtt
QList< QFirebirdResultPrivate * > activeResults
bool finishTransaction(TxnEnd end)
void setFbError(const QString &context, QSqlError::ErrorType type=QSqlError::UnknownError)
bool commitTransaction() override
This function is called to commit a transaction.
QSqlResult * createResult() const override
Creates an empty SQL result on the database.
bool cancelQuery() override
bool hasFeature(DriverFeature feature) const override
Returns true if the driver supports feature feature; otherwise returns false.
QString escapeIdentifier(const QString &identifier, IdentifierType type) const override
Returns the identifier escaped according to the database rules.
QSqlRecord record(const QString &tableName) const override
Returns a QSqlRecord populated with the names of the fields in table tableName.
QFirebirdDriver(QObject *parent=nullptr)
bool rollbackTransaction() override
This function is called to rollback a transaction.
QSqlIndex primaryIndex(const QString &tableName) const override
Returns the primary index for table tableName.
int maximumIdentifierLength(IdentifierType type) const override
QVariant handle() const override
Returns the low-level database handle wrapped in a QVariant or an invalid variant if there is no hand...
bool open(const QString &db, const QString &user, const QString &password, const QString &host, int port, const QString &connOpts) override
Derived classes must reimplement this pure virtual function to open a database connection on database...
QStringList subscribedToNotifications() const override
Returns a list of the names of the event notifications that are currently subscribed to.
bool unsubscribeFromNotification(const QString &name) override
This function is called to unsubscribe from event notifications from the database.
QString formatValue(const QSqlField &field, bool trimStrings) const override
Returns a string representation of the field value for the database.
bool beginTransaction() override
This function is called to begin a transaction.
bool subscribeToNotification(const QString &name) override
This function is called to subscribe to event notifications from the database.
~QFirebirdDriver() override
void close() override
Derived classes must reimplement this pure virtual function in order to close the database connection...
void eventCallbackFunction(unsigned length, const unsigned char *data) override
QFirebirdEventSubscription(QFirebirdDriver *drv, IAttachment *att, const QString &eventName)
QFirebirdResult(const QFirebirdDriver *driver)