kexidbmodule.cpp
1/***************************************************************************
2 * kexidbmodule.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 "kexidbmodule.h"
21#include "kexidbdrivermanager.h"
22#include "kexidbconnection.h"
23
24//#include <api/object.h>
25//#include <api/variant.h>
26#include <main/manager.h>
27
28#include <kdebug.h>
29
30// The as version() published versionnumber of this kross-module.
31#define KROSS_KEXIDB_VERSION 1
32
33extern "C"
34{
39 Kross::Api::Object* TDE_EXPORT init_module(Kross::Api::Manager* manager)
40 {
41 return new Kross::KexiDB::KexiDBModule(manager);
42 }
43}
44
45using namespace Kross::KexiDB;
46
47KexiDBModule::KexiDBModule(Kross::Api::Manager* /*manager*/)
48 : Kross::Api::Module("KexiDB")
49 //, m_manager(manager)
50{
51 //kdDebug() << "Kross::KexiDB::KexiDBModule Ctor" << endl;
52 addChild( "version", new Kross::Api::Variant(KROSS_KEXIDB_VERSION) );
53 addChild( new KexiDBDriverManager() );
54}
55
56KexiDBModule::~KexiDBModule()
57{
58 //kdDebug() << "Kross::KexiDB::KexiDBModule Dtor" << endl;
59}
60
61const TQString KexiDBModule::getClassName() const
62{
63 return "Kross::KexiDB::KexiDBModule";
64}
65
66Kross::Api::Object::Ptr KexiDBModule::get(const TQString& name, void* p)
67{
68 if(name == "KexiDBConnection") {
70 if(connection)
71 return new KexiDBConnection(connection);
72 }
73 return 0;
74}
Provides database connection, allowing queries and data modification.
Definition connection.h:62
A connection to a database.
The drivermanager is the base class to access KexiDBDriver objects and provides common functionality ...
KrossKexiDB provides access to the KexiDB database functionality.