kexi

kexidbdriver.cpp
1/***************************************************************************
2 * kexidbdriver.cpp
3 * This file is part of the KDE project
4 * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this program; see the file COPYING. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 ***************************************************************************/
19
20#include "kexidbdriver.h"
21#include "kexidbdrivermanager.h"
22
23#include <tqvaluelist.h>
24#include <tqptrlist.h>
25#include <kdebug.h>
26
27#include <kexidb/connection.h>
28
29using namespace Kross::KexiDB;
30
31KexiDBDriver::KexiDBDriver(::KexiDB::Driver* driver)
32 : Kross::Api::Class<KexiDBDriver>("KexiDBDriver")
33 , m_driver(driver)
34{
35 this->addFunction0<Kross::Api::Variant>("isValid", this, &KexiDBDriver::isValid );
36 this->addFunction0<Kross::Api::Variant>("versionMajor", this, &KexiDBDriver::versionMajor );
37 this->addFunction0<Kross::Api::Variant>("versionMinor", this, &KexiDBDriver::versionMinor );
38 this->addFunction1<Kross::Api::Variant, Kross::Api::Variant>("escapeString", this, &KexiDBDriver::escapeString);
39 this->addFunction0<Kross::Api::Variant>("isFileDriver", this, &KexiDBDriver::isFileDriver );
40 this->addFunction0<Kross::Api::Variant>("fileDBDriverMimeType", this, &KexiDBDriver::fileDBDriverMimeType );
41 this->addFunction1<Kross::Api::Variant, Kross::Api::Variant>("isSystemObjectName", this, &KexiDBDriver::isSystemObjectName );
42 this->addFunction1<Kross::Api::Variant, Kross::Api::Variant>("isSystemDatabaseName", this, &KexiDBDriver::isSystemDatabaseName );
43 this->addFunction1<Kross::Api::Variant, Kross::Api::Variant>("isSystemFieldName", this, &KexiDBDriver::isSystemFieldName );
44 this->addFunction2<Kross::Api::Variant, Kross::Api::Variant, Kross::Api::Variant> ("valueToSQL", this, &KexiDBDriver::valueToSQL );
45
46 this->addFunction1<KexiDBConnection, KexiDBConnectionData>("createConnection", this, &KexiDBDriver::createConnection);
47 this->addFunction0< Kross::Api::ListT< KexiDBConnection > >("connectionsList", this, &KexiDBDriver::connectionsList);
48}
49
50KexiDBDriver::~KexiDBDriver()
51{
52}
53
54const TQString KexiDBDriver::getClassName() const
55{
56 return "Kross::KexiDB::KexiDBDriver";
57}
58
59bool KexiDBDriver::isValid() { return m_driver->isValid(); }
60int KexiDBDriver::versionMajor() { return m_driver->version().major; }
61int KexiDBDriver::versionMinor() { return m_driver->version().minor; }
62TQString KexiDBDriver::escapeString(const TQString& s) { return m_driver->escapeString(s); }
63bool KexiDBDriver::isFileDriver() { return m_driver->isFileDriver(); }
64TQString KexiDBDriver::fileDBDriverMimeType() { return m_driver->fileDBDriverMimeType(); }
65bool KexiDBDriver::isSystemObjectName(const TQString& name) { return m_driver->isSystemObjectName(name); }
66bool KexiDBDriver::isSystemDatabaseName(const TQString& name) { return m_driver->isSystemDatabaseName(name); }
67bool KexiDBDriver::isSystemFieldName(const TQString& name) { return m_driver->isSystemFieldName(name); }
68TQString KexiDBDriver::valueToSQL(const TQString& fieldtype, const TQVariant& value) { return m_driver->valueToSQL(fieldtype, value); }
69KexiDBConnection* KexiDBDriver::createConnection(KexiDBConnectionData* data) { return new KexiDBConnection( m_driver->createConnection(*data) ); }
70TQPtrList< ::KexiDB::Connection > KexiDBDriver::connectionsList() { return m_driver->connectionsList(); }
Generic database abstraction.
Definition driver.h:67
A KexiDBConnectionData is used to store the details needed for a connection with a database.
A connection to a database.
Drivers are the implementations Kexi uses to access the driver-backends.
KrossKexiDB provides access to the KexiDB database functionality.