kexi

kexidbdriver.cpp

00001 /***************************************************************************
00002  * kexidbdriver.cpp
00003  * This file is part of the KDE project
00004  * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org)
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  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
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 #include "kexidbdriver.h"
00021 #include "kexidbdrivermanager.h"
00022 
00023 #include <qvaluelist.h>
00024 #include <qptrlist.h>
00025 #include <kdebug.h>
00026 
00027 #include <kexidb/connection.h>
00028 
00029 using namespace Kross::KexiDB;
00030 
00031 KexiDBDriver::KexiDBDriver(::KexiDB::Driver* driver)
00032     : Kross::Api::Class<KexiDBDriver>("KexiDBDriver")
00033     , m_driver(driver)
00034 {
00035     this->addFunction0<Kross::Api::Variant>("isValid", this, &KexiDBDriver::isValid );
00036     this->addFunction0<Kross::Api::Variant>("versionMajor", this, &KexiDBDriver::versionMajor );
00037     this->addFunction0<Kross::Api::Variant>("versionMinor", this, &KexiDBDriver::versionMinor );
00038     this->addFunction1<Kross::Api::Variant, Kross::Api::Variant>("escapeString", this, &KexiDBDriver::escapeString);
00039     this->addFunction0<Kross::Api::Variant>("isFileDriver", this, &KexiDBDriver::isFileDriver );
00040     this->addFunction0<Kross::Api::Variant>("fileDBDriverMimeType", this, &KexiDBDriver::fileDBDriverMimeType );
00041     this->addFunction1<Kross::Api::Variant, Kross::Api::Variant>("isSystemObjectName", this, &KexiDBDriver::isSystemObjectName );
00042     this->addFunction1<Kross::Api::Variant, Kross::Api::Variant>("isSystemDatabaseName", this, &KexiDBDriver::isSystemDatabaseName );
00043     this->addFunction1<Kross::Api::Variant, Kross::Api::Variant>("isSystemFieldName", this, &KexiDBDriver::isSystemFieldName );
00044     this->addFunction2<Kross::Api::Variant, Kross::Api::Variant, Kross::Api::Variant> ("valueToSQL", this, &KexiDBDriver::valueToSQL );
00045 
00046     this->addFunction1<KexiDBConnection, KexiDBConnectionData>("createConnection", this, &KexiDBDriver::createConnection);
00047     this->addFunction0< Kross::Api::ListT< KexiDBConnection > >("connectionsList", this, &KexiDBDriver::connectionsList);
00048 }
00049 
00050 KexiDBDriver::~KexiDBDriver()
00051 {
00052 }
00053 
00054 const QString KexiDBDriver::getClassName() const
00055 {
00056     return "Kross::KexiDB::KexiDBDriver";
00057 }
00058 
00059 bool KexiDBDriver::isValid() { return m_driver->isValid(); }
00060 int KexiDBDriver::versionMajor() { return m_driver->version().major; }
00061 int KexiDBDriver::versionMinor() { return m_driver->version().minor; }
00062 QString KexiDBDriver::escapeString(const QString& s) { return m_driver->escapeString(s); }
00063 bool KexiDBDriver::isFileDriver() { return m_driver->isFileDriver(); }
00064 QString KexiDBDriver::fileDBDriverMimeType() { return m_driver->fileDBDriverMimeType(); }
00065 bool KexiDBDriver::isSystemObjectName(const QString& name) { return m_driver->isSystemObjectName(name); }
00066 bool KexiDBDriver::isSystemDatabaseName(const QString& name) { return m_driver->isSystemDatabaseName(name); }
00067 bool KexiDBDriver::isSystemFieldName(const QString& name) { return m_driver->isSystemFieldName(name); }
00068 QString KexiDBDriver::valueToSQL(const QString& fieldtype, const QVariant& value) { return m_driver->valueToSQL(fieldtype, value); }
00069 KexiDBConnection* KexiDBDriver::createConnection(KexiDBConnectionData* data) { return new KexiDBConnection( m_driver->createConnection(*data) ); }
00070 QPtrList< ::KexiDB::Connection > KexiDBDriver::connectionsList() { return m_driver->connectionsList(); }
KDE Home | KDE Accessibility Home | Description of Access Keys