1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the sql module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
32
#include <QtSql/qsqldriver.h>
33
#include <QtSql/qsqlresult.h>
35
#if defined (Q_OS_WIN32)
36
#include <QtCore/qt_windows.h>
42
#define Q_EXPORT_SQLDRIVER_MYSQL
44
#define Q_EXPORT_SQLDRIVER_MYSQL Q_SQL_EXPORT
47
class QMYSQLDriverPrivate;
48
class QMYSQLResultPrivate;
52
class QMYSQLResult : public QSqlResult
54
friend class QMYSQLDriver;
56
explicit QMYSQLResult(const QMYSQLDriver* db);
59
QVariant handle() const;
66
QVariant data(int field);
67
bool isNull(int field);
68
bool reset (const QString& query);
70
int numRowsAffected();
71
QVariant lastInsertId() const;
72
QSqlRecord record() const;
74
#if MYSQL_VERSION_ID >= 40108
75
bool prepare(const QString& stmt);
79
QMYSQLResultPrivate* d;
82
class Q_EXPORT_SQLDRIVER_MYSQL QMYSQLDriver : public QSqlDriver
84
friend class QMYSQLResult;
86
explicit QMYSQLDriver(QObject *parent=0);
87
explicit QMYSQLDriver(MYSQL *con, QObject * parent=0);
89
bool hasFeature(DriverFeature f) const;
90
bool open(const QString & db,
92
const QString & password,
95
const QString& connOpts);
97
QSqlResult *createResult() const;
98
QStringList tables(QSql::TableType) const;
99
QSqlIndex primaryIndex(const QString& tablename) const;
100
QSqlRecord record(const QString& tablename) const;
101
QString formatValue(const QSqlField &field,
102
bool trimStrings) const;
103
QVariant handle() const;
106
bool beginTransaction();
107
bool commitTransaction();
108
bool rollbackTransaction();
111
QMYSQLDriverPrivate* d;
114
#endif // QSQL_MYSQL_H