Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

database.h

Go to the documentation of this file.
00001 /*
00002    This file is part of the KDB libraries
00003    Copyright (c) 2000 Praduroux Alessandro <pradu@thekompany.com>
00004  
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009  
00010    This library 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  
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */     
00020 #ifndef DATABASE_H
00021 #define DATABASE_H
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026 
00027 #include <qstring.h>
00028 #include <qstringlist.h>
00029 #include <qlist.h>
00030 #include <qvaluelist.h>
00031 
00032 #include <ksharedptr.h>
00033 
00034 #include <kdb/table.h>
00035 #include <kdb/query.h>
00036 #include <kdb/recordset.h>
00037 
00038 #include "object.h"
00039 
00040 
00041 namespace KDB {
00042 
00043 class Connector;
00044 
00045 class Database;
00046 typedef QList<Database>         DatabaseList;
00047 typedef QListIterator<Database> DatabaseIterator;
00048 
00063 class Database : public Object{
00064 
00065     friend class Connection;
00066 
00067     Q_OBJECT
00068 
00069  public:
00070 
00071     Database(const Database & base);
00072     
00073     virtual ~Database();
00074 
00080     TablePtr newTable(const QString &name);
00081 
00086     TablePtr getTable(const QString &name);
00087 
00093     TableList tables(bool system = false);
00094 
00100     QStringList tableNames(bool system = false);
00101     
00107      bool removeTable(const QString &name);
00108 
00118     QueryPtr newQuery(const QString &name, const QString &SQL = QString::null);
00119 
00124     QueryPtr getQuery(const QString &name);
00125     
00129     QueryList queries();
00130 
00134     QStringList queryNames();
00135 
00139     bool removeQuery(const QString &name);
00140 
00147     RecordsetPtr openRecordset(const QString &SQL);
00148 
00153     unsigned long long execute(const QString &SQL);
00154     
00155     bool open();
00156 
00157     void close();
00158 
00159     bool isOpen();
00160 
00161 
00162  signals:
00163 
00164     void tableAdded( Table * );
00165     void tableRemoved( Table * );
00166     void tableChanged( Table * );
00167     void queryAdded( Query * );
00168     void queryRemoved( Query * );
00169     void queryChanged( Query * );
00170     void changed();
00171     void closed();
00172     void opened();
00173 
00174  protected slots:
00175 
00176     void tableCreated( Table * );
00177 
00178  private:
00179 
00180     Connector * connector;
00181     QStringList m_tables;
00182     QStringList m_queries;
00183 
00184     bool m_open;
00185 
00186     Database(Connector *conn,  const char * name, QObject *parent );
00187 
00188     void createQueryTable();
00189 
00190 };
00191 
00192 }
00193 
00194 #endif
00195 
00196 

Generated at Fri Sep 29 16:32:21 2000 for KDB by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000