source: trunk/src/sql/drivers/sqlite/qsql_sqlite.h

Last change on this file was 196, checked in by rudi, 14 years ago

Add SQL module (currently it isn't build by default, however it's needed for QtDesigner)

File size: 2.6 KB
Line 
1/****************************************************************************
2**
3** Definition of SQLite driver classes.
4**
5** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
6**
7** This file is part of the sql module of the Qt GUI Toolkit.
8** EDITIONS: FREE, ENTERPRISE
9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12**
13****************************************************************************/
14
15#ifndef QSQL_SQLITE_H
16#define QSQL_SQLITE_H
17
18#include <qsqldriver.h>
19#include <qsqlresult.h>
20#include <qsqlrecord.h>
21#include <qsqlindex.h>
22#include "../cache/qsqlcachedresult.h"
23
24#if (QT_VERSION-0 >= 0x030000)
25typedef QVariant QSqlVariant;
26#endif
27
28#if defined (Q_OS_WIN32)
29# include <qt_windows.h>
30#endif
31
32class QSQLiteDriverPrivate;
33class QSQLiteResultPrivate;
34class QSQLiteDriver;
35struct sqlite;
36
37class QSQLiteResult : public QtSqlCachedResult
38{
39 friend class QSQLiteDriver;
40 friend class QSQLiteResultPrivate;
41public:
42 QSQLiteResult(const QSQLiteDriver* db);
43 ~QSQLiteResult();
44
45protected:
46 bool gotoNext(QtSqlCachedResult::RowCache* row);
47 bool reset (const QString& query);
48 int size();
49 int numRowsAffected();
50
51private:
52 QSQLiteResultPrivate* d;
53};
54
55class QSQLiteDriver : public QSqlDriver
56{
57 friend class QSQLiteResult;
58public:
59 QSQLiteDriver(QObject *parent = 0, const char *name = 0);
60 QSQLiteDriver(sqlite *connection, QObject *parent = 0, const char *name = 0);
61 ~QSQLiteDriver();
62 bool hasFeature(DriverFeature f) const;
63 bool open(const QString & db,
64 const QString & user,
65 const QString & password,
66 const QString & host,
67 int port,
68 const QString & connOpts);
69 bool open( const QString & db,
70 const QString & user,
71 const QString & password,
72 const QString & host,
73 int port ) { return open (db, user, password, host, port, QString()); }
74 void close();
75 QSqlQuery createQuery() const;
76 bool beginTransaction();
77 bool commitTransaction();
78 bool rollbackTransaction();
79 QStringList tables(const QString& user) const;
80
81 QSqlRecord record(const QString& tablename) const;
82 QSqlRecordInfo recordInfo(const QString& tablename) const;
83 QSqlIndex primaryIndex(const QString &table) const;
84 QSqlRecord record(const QSqlQuery& query) const;
85 QSqlRecordInfo recordInfo(const QSqlQuery& query) const;
86
87private:
88 QSQLiteDriverPrivate* d;
89};
90#endif
Note: See TracBrowser for help on using the repository browser.