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

connection.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 CONNECTION_H
00021 #define CONNECTION_H
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026 
00027 #include <qstring.h>
00028 #include <qlist.h>
00029 
00030 #include "object.h"
00031 #include "database.h"
00032 
00033 class KConfigBase;
00034 
00035 namespace KDB {
00036 
00037 class Connector;
00038 class Connection;
00039 typedef QList<Connection>         ConnectionList;
00040 typedef QListIterator<Connection> ConnectionIterator;
00041 
00058 class Connection : public Object {
00059     friend class DBEngine;
00060 
00061     Q_OBJECT
00062 
00063  public:
00064 
00065     virtual ~Connection();
00066 
00073     bool open() ;
00074 
00079     void close(bool destructive = true);
00080 
00084     bool isConnected();
00085 
00089     bool saveStatus();
00090 
00095     void setSaveStatus(bool status);
00096 
00097     
00102     void setUser(const QString &name);
00103 
00107     QString user();
00108 
00112     QString plugin();
00113     
00120     void setPassword(const QString &pwd, bool save = false);
00121 
00125     QString password();
00126     
00130     QString host();
00131 
00135     int port();
00136 
00140     QString prettyPrint();
00141 
00145     Database * openDatabase(const QString &name);
00146 
00151     Database * findDatabase(const QString &name);
00152 
00156     virtual Database * createDatabase(const QString &name) ;
00157 
00161     DatabaseList databases();
00162 
00166     DatabaseIterator begin();
00167 
00173     void saveToConfig( KConfigBase *config, int number = -1);
00174 
00175     
00176  signals:
00177 
00178     void closing(Connection *);
00179     
00180  private:
00181 
00182     Connector *connector;
00183     DatabaseList m_databases;
00184 
00185     QString m_plugin;
00186     QString m_host;
00187     int m_port;
00188     QString m_user;
00189     QString m_pwd;
00190     bool m_savePwd;
00191     bool m_saveStatus;
00192     
00193     Connection(const QString &pluginName, const QString &host, int port, QObject *parent = 0);
00194 
00195 };
00196 
00197 }
00198 
00199 #endif
00200 
00201 
00202 
00203 
00204 
00205 
00206 
00207 

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