Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsql_psql_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
4#ifndef QSQL_PSQL_H
5#define QSQL_PSQL_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtSql/qsqldriver.h>
19
20#ifdef QT_PLUGIN
21#define Q_EXPORT_SQLDRIVER_PSQL
22#else
23#define Q_EXPORT_SQLDRIVER_PSQL Q_SQL_EXPORT
24#endif
25
26typedef struct pg_conn PGconn;
27typedef struct pg_result PGresult;
28
30
32
34{
35 friend class QPSQLResultPrivate;
36 Q_DECLARE_PRIVATE(QPSQLDriver)
38public:
39 enum Protocol {
40 VersionUnknown = -1,
41 Version6 = 6,
42 Version7 = 7,
43 Version7_1 = 8,
44 Version7_3 = 9,
45 Version7_4 = 10,
46 Version8 = 11,
47 Version8_1 = 12,
48 Version8_2 = 13,
49 Version8_3 = 14,
50 Version8_4 = 15,
51 Version9 = 16,
52 Version9_1 = 17,
53 Version9_2 = 18,
54 Version9_3 = 19,
55 Version9_4 = 20,
56 Version9_5 = 21,
57 Version9_6 = 22,
58 Version10 = 23,
59 Version11 = 24,
60 Version12 = 25,
61 UnknownLaterVersion = 100000
62 };
63
64 explicit QPSQLDriver(QObject *parent = nullptr);
65 explicit QPSQLDriver(PGconn *conn, QObject *parent = nullptr);
67 bool hasFeature(DriverFeature f) const override;
68 bool open(const QString &db,
69 const QString &user,
70 const QString &password,
71 const QString &host,
72 int port,
73 const QString &connOpts) override;
74 bool isOpen() const override;
75 void close() override;
76 QSqlResult *createResult() const override;
77 QStringList tables(QSql::TableType) const override;
78 QSqlIndex primaryIndex(const QString &tablename) const override;
79 QSqlRecord record(const QString &tablename) const override;
80
81 Protocol protocol() const;
82 QVariant handle() const override;
83
84 QString escapeIdentifier(const QString &identifier, IdentifierType type) const override;
85 QString formatValue(const QSqlField &field, bool trimStrings) const override;
86
87 bool subscribeToNotification(const QString &name) override;
88 bool unsubscribeFromNotification(const QString &name) override;
90
91protected:
92 bool beginTransaction() override;
93 bool commitTransaction() override;
94 bool rollbackTransaction() override;
95
96private Q_SLOTS:
97 void _q_handleNotification();
98};
99
101
102#endif // QSQL_PSQL_H
\inmodule QtCore
Definition qobject.h:103
The QSqlDriver class is an abstract base class for accessing specific SQL databases.
Definition qsqldriver.h:26
virtual QString formatValue(const QSqlField &field, bool trimStrings=false) const
Returns a string representation of the field value for the database.
virtual bool commitTransaction()
This function is called to commit a transaction.
virtual QSqlResult * createResult() const =0
Creates an empty SQL result on the database.
virtual bool unsubscribeFromNotification(const QString &name)
This function is called to unsubscribe from event notifications from the database.
virtual QSqlIndex primaryIndex(const QString &tableName) const
Returns the primary index for table tableName.
virtual bool beginTransaction()
This function is called to begin a transaction.
virtual QSqlRecord record(const QString &tableName) const
Returns a QSqlRecord populated with the names of the fields in table tableName.
virtual bool rollbackTransaction()
This function is called to rollback a transaction.
virtual void close()=0
Derived classes must reimplement this pure virtual function in order to close the database connection...
virtual QString escapeIdentifier(const QString &identifier, IdentifierType type) const
Returns the identifier escaped according to the database rules.
virtual QVariant handle() const
Returns the low-level database handle wrapped in a QVariant or an invalid variant if there is no hand...
virtual bool open(const QString &db, const QString &user=QString(), const QString &password=QString(), const QString &host=QString(), int port=-1, const QString &connOpts=QString())=0
Derived classes must reimplement this pure virtual function to open a database connection on database...
virtual bool isOpen() const
Returns true if the database connection is open; otherwise returns false.
virtual bool hasFeature(DriverFeature f) const =0
Returns true if the driver supports feature feature; otherwise returns false.
virtual bool subscribeToNotification(const QString &name)
This function is called to subscribe to event notifications from the database.
virtual QStringList tables(QSql::TableType tableType) const
Returns a list of the names of the tables in the database.
virtual QStringList subscribedToNotifications() const
Returns a list of the names of the event notifications that are currently subscribed to.
The QSqlField class manipulates the fields in SQL database tables and views.
Definition qsqlfield.h:19
The QSqlIndex class provides functions to manipulate and describe database indexes.
Definition qsqlindex.h:18
The QSqlRecord class encapsulates a database record.
Definition qsqlrecord.h:20
The QSqlResult class provides an abstract interface for accessing data from specific SQL databases.
Definition qsqlresult.h:22
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
EGLOutputPortEXT port
GLfloat GLfloat f
GLenum type
GLuint name
#define Q_EXPORT_SQLDRIVER_PSQL
Definition qsql_psql_p.h:23
struct pg_conn PGconn
Definition qsql_psql_p.h:26
struct pg_result PGresult
Definition qsql_psql_p.h:27
#define Q_OBJECT
#define Q_SLOTS
QMimeDatabase db
[0]