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_odbc_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_ODBC_H
5#define QSQL_ODBC_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#if defined (Q_OS_WIN32)
21#include <QtCore/qt_windows.h>
22#endif
23
24#ifdef QT_PLUGIN
25#define Q_EXPORT_SQLDRIVER_ODBC
26#else
27#define Q_EXPORT_SQLDRIVER_ODBC Q_SQL_EXPORT
28#endif
29
30#ifdef Q_OS_UNIX
31#define HAVE_LONG_LONG 1 // force UnixODBC NOT to fall back to a struct for BIGINTs
32#endif
33
34#if defined(Q_CC_BOR)
35// workaround for Borland to make sure that SQLBIGINT is defined
36# define _MSC_VER 900
37#endif
38#include <sql.h>
39#if defined(Q_CC_BOR)
40# undef _MSC_VER
41#endif
42
43#include <sqlext.h>
44
46
48
50{
51 Q_DECLARE_PRIVATE(QODBCDriver)
53 friend class QODBCResultPrivate;
54
55public:
56 explicit QODBCDriver(QObject *parent=nullptr);
57 QODBCDriver(SQLHANDLE env, SQLHANDLE con, QObject * parent=nullptr);
58 virtual ~QODBCDriver();
59 bool hasFeature(DriverFeature f) const override;
60 void close() override;
61 QSqlResult *createResult() const override;
62 QStringList tables(QSql::TableType) const override;
63 QSqlRecord record(const QString &tablename) const override;
64 QSqlIndex primaryIndex(const QString &tablename) const override;
65 QVariant handle() const override;
66 QString formatValue(const QSqlField &field,
67 bool trimStrings) 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
75 QString escapeIdentifier(const QString &identifier, IdentifierType type) const override;
76
77 bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const override;
78
79protected:
80 bool beginTransaction() override;
81 bool commitTransaction() override;
82 bool rollbackTransaction() override;
83
84private:
85 bool endTrans();
86 void cleanup();
87};
88
90
91#endif // QSQL_ODBC_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.
IdentifierType
This enum contains a list of SQL identifier types.
Definition qsqldriver.h:41
virtual QSqlResult * createResult() const =0
Creates an empty SQL result on 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.
DriverFeature
This enum contains a list of features a driver might support.
Definition qsqldriver.h:33
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 isIdentifierEscaped(const QString &identifier, IdentifierType type) const
Returns whether identifier is escaped according to the database rules.
virtual bool hasFeature(DriverFeature f) const =0
Returns true if the driver supports feature feature; otherwise returns false.
virtual QStringList tables(QSql::TableType tableType) const
Returns a list of the names of the tables in the database.
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
#define Q_EXPORT_SQLDRIVER_ODBC
Definition qsql_odbc_p.h:27
#define Q_OBJECT
QMimeDatabase db
[0]