/**************************************************************************** ** ** Definition of STQLite driver classes. ** ** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. ** ** This file is part of the sql module of the TQt GUI Toolkit. ** EDITIONS: FREE, ENTERPRISE ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ #ifndef TQSQL_STQLITE_H #define TQSQL_STQLITE_H #include #include #include #include #include "../cache/tqsqlcachedresult.h" #if (TQT_VERSION-0 >= 0x030000) typedef TQVariant TQSqlVariant; #endif #if defined (TQ_OS_WIN32) # include #endif class TQSTQLiteDriverPrivate; class TQSTQLiteResultPrivate; class TQSTQLiteDriver; struct sqlite; class TQSTQLiteResult : public TQtSqlCachedResult { friend class TQSTQLiteDriver; friend class TQSTQLiteResultPrivate; public: TQSTQLiteResult(const TQSTQLiteDriver* db); ~TQSTQLiteResult(); protected: bool gotoNext(TQtSqlCachedResult::RowCache* row); bool reset (const TQString& query); int size(); int numRowsAffected(); private: TQSTQLiteResultPrivate* d; }; class TQSTQLiteDriver : public TQSqlDriver { friend class TQSTQLiteResult; public: TQSTQLiteDriver(TQObject *parent = 0, const char *name = 0); TQSTQLiteDriver(sqlite *connection, TQObject *parent = 0, const char *name = 0); ~TQSTQLiteDriver(); bool hasFeature(DriverFeature f) const; bool open(const TQString & db, const TQString & user, const TQString & password, const TQString & host, int port, const TQString & connOpts); bool open( const TQString & db, const TQString & user, const TQString & password, const TQString & host, int port ) { return open (db, user, password, host, port, TQString()); } void close(); TQSqlQuery createQuery() const; bool beginTransaction(); bool commitTransaction(); bool rollbackTransaction(); TQStringList tables(const TQString& user) const; TQSqlRecord record(const TQString& tablename) const; TQSqlRecordInfo recordInfo(const TQString& tablename) const; TQSqlIndex primaryIndex(const TQString &table) const; TQSqlRecord record(const TQSqlQuery& query) const; TQSqlRecordInfo recordInfo(const TQSqlQuery& query) const; private: TQSTQLiteDriverPrivate* d; }; #endif