kexi
sqliteconnection.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 2003-2006 Jaroslaw Staniek <js@iidea.pl> 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this program; see the file COPYING. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KEXIDB_CONN_SQLITE_H 00021 #define KEXIDB_CONN_SQLITE_H 00022 00023 #include <qstringlist.h> 00024 00025 #include <kexidb/connection.h> 00026 00030 namespace KexiDB 00031 { 00032 00033 class SQLiteConnectionInternal; 00034 class Driver; 00035 00037 class SQLiteConnection : public Connection 00038 { 00039 Q_OBJECT 00040 00041 public: 00042 virtual ~SQLiteConnection(); 00043 00044 virtual Cursor* prepareQuery( const QString& statement, uint cursor_options = 0 ); 00045 virtual Cursor* prepareQuery( QuerySchema& query, uint cursor_options = 0 ); 00046 00047 //#ifndef SQLITE2 //TEMP IFDEF! 00048 virtual PreparedStatement::Ptr prepareStatement(PreparedStatement::StatementType type, 00049 FieldList& fields); 00050 //#endif 00052 virtual bool isReadOnly() const; 00053 00054 protected: 00056 SQLiteConnection( Driver *driver, ConnectionData &conn_data ); 00057 00058 virtual bool drv_connect(); 00059 virtual bool drv_disconnect(); 00060 virtual bool drv_getDatabasesList( QStringList &list ); 00061 00062 //TODO: move this somewhere to low level class (MIGRATION?) 00063 virtual bool drv_getTablesList( QStringList &list ); 00064 00065 //TODO: move this somewhere to low level class (MIGRATION?) 00066 virtual bool drv_containsTable( const QString &tableName ); 00067 00071 virtual bool drv_createDatabase( const QString &dbName = QString::null ); 00072 00077 virtual bool drv_useDatabase( const QString &dbName = QString::null, bool *cancelled = 0, 00078 MessageHandler* msgHandler = 0 ); 00079 00080 virtual bool drv_closeDatabase(); 00081 00085 virtual bool drv_dropDatabase( const QString &dbName = QString::null ); 00086 00087 //virtual bool drv_createTable( const KexiDB::Table& table ); 00088 00089 virtual bool drv_executeSQL( const QString& statement ); 00090 // virtual bool drv_executeQuery( const QString& statement ); 00091 00092 virtual Q_ULLONG drv_lastInsertRowID(); 00093 00094 virtual int serverResult(); 00095 virtual QString serverResultName(); 00096 virtual QString serverErrorMsg(); 00097 virtual void drv_clearServerResult(); 00098 00099 SQLiteConnectionInternal* d; 00100 00101 friend class SQLiteDriver; 00102 friend class SQLiteCursor; 00103 }; 00104 00105 } 00106 00107 #endif