kexi
mysqlconnection.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 2002 Lucijan Busch <lucijan@gmx.at> 00003 Copyright (C) 2003 Joseph Wenninger<jowenn@kde.org> 00004 Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl> 00005 00006 This program is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this program; see the file COPYING. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef MYSQLCONNECTION_H 00023 #define MYSQLCONNECTION_H 00024 00025 #include <qstringlist.h> 00026 00027 #include <kexidb/connection.h> 00028 #include "mysqlcursor.h" 00029 #include <qdict.h> 00030 00031 namespace KexiDB { 00032 00033 class MySqlConnectionInternal; 00034 00040 class MySqlConnection : public Connection 00041 { 00042 Q_OBJECT 00043 00044 public: 00045 virtual ~MySqlConnection(); 00046 00047 virtual Cursor* prepareQuery( const QString& statement = QString::null, uint cursor_options = 0 ); 00048 virtual Cursor* prepareQuery( QuerySchema& query, uint cursor_options = 0 ); 00049 00050 virtual PreparedStatement::Ptr prepareStatement(PreparedStatement::StatementType type, 00051 FieldList& fields); 00052 00053 protected: 00054 00056 MySqlConnection( Driver *driver, ConnectionData &conn_data ); 00057 00058 virtual bool drv_connect(KexiDB::ServerVersionInfo& version); 00059 virtual bool drv_disconnect(); 00060 virtual bool drv_getDatabasesList( QStringList &list ); 00061 virtual bool drv_createDatabase( const QString &dbName = QString::null ); 00062 virtual bool drv_useDatabase( const QString &dbName = QString::null, bool *cancelled = 0, 00063 MessageHandler* msgHandler = 0 ); 00064 virtual bool drv_closeDatabase(); 00065 virtual bool drv_dropDatabase( const QString &dbName = QString::null ); 00066 virtual bool drv_executeSQL( const QString& statement ); 00067 virtual Q_ULLONG drv_lastInsertRowID(); 00068 00069 virtual int serverResult(); 00070 virtual QString serverResultName(); 00071 virtual QString serverErrorMsg(); 00072 virtual void drv_clearServerResult(); 00073 00074 //TODO: move this somewhere to low level class (MIGRATION?) 00075 virtual bool drv_getTablesList( QStringList &list ); 00076 //TODO: move this somewhere to low level class (MIGRATION?) 00077 virtual bool drv_containsTable( const QString &tableName ); 00078 00079 MySqlConnectionInternal* d; 00080 00081 friend class MySqlDriver; 00082 friend class MySqlCursor; 00083 }; 00084 00085 } 00086 00087 #endif