MySQLaux 0.6 is free software from Langensoft written by Thomas Langen.

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

MySQLaux/Database.h

Go to the documentation of this file.
00001 /* 
00002  * MySQLaux - auxiliary C++ classes for MySQL database clients
00003  * Copyright  2001  Thomas Langen (mailto:langen@langensoft.com)
00004  * 
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  * 
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
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  * 
00019  * $Source: Database.h $
00020  * $Id: Database.h 1.6 Fri, 06 Apr 2001 10:30:48 +0200 langen $
00021  * $ProjectHeader: MySQLaux 0.6 Fri, 06 Apr 2001 10:30:48 +0200 langen $
00022  */
00023 
00024 #ifndef __MySQLaux_Database_h__
00025 #define __MySQLaux_Database_h__
00026 
00027 #include <strstream.h>  // deprecated
00028 #include <string>
00029 #include <vector>
00030 #include <mysql/mysql.h>
00031 #include "GarbageCollector.h"
00032 #include "Table.h"
00033 #include "Error.h"
00034 
00059 namespace MySQLaux
00060 {
00070   class Database
00071   {
00072   private:
00073     char const *   _host;     
00074     char const *   _user;     
00075     char const *   _password;
00076     char const *   _dbname; 
00077     unsigned       _port;     
00078     char const *   _socket;   
00079     unsigned       _clientflag;
00080     MYSQL _mysql;
00081     GarbageCollector _gc;
00082   public:
00109     Database (string const & host = string(),
00110               string const & user = string(),
00111               string const & passwd = string(),
00112               string const & dbname = string(),
00113               unsigned port = 0,
00114               string const & socket = string(),
00115               unsigned clientflag = 0) 
00116       throw (Error);
00117     
00119     ~Database ();
00120     
00122     char const * host () const
00123     {
00124       return _host;
00125     }
00127     char const *  user () const
00128     {
00129       return _user;
00130     }
00132     char const *  password () const
00133     {
00134       return _password;
00135     }
00137     char const *  dbname () const
00138     {
00139       return _dbname;
00140     }
00142     unsigned  port () const
00143     {
00144       return _port;
00145     }
00147     char const *  socket () const
00148     {
00149       return _socket;
00150     }
00152     unsigned clientflag () const
00153     {
00154       return _clientflag;
00155     }
00156     
00157   public:  // *** obsolete, will be private in future versions ***
00159     MYSQL & mysql()
00160     {
00161       return _mysql;
00162     }
00163     
00168     GarbageCollector & gc() 
00169     {
00170       return _gc;
00171     }
00172     
00173   public:
00178     bool is_accessible()
00179       throw (Error);
00180     
00181     // wrapper for mysql_xxx () functions
00182     
00188     Table const query (const string & q)
00189       throw (Error, MissingFeature);
00190   };
00191 }
00192 
00193 #endif // __MySQLaux_Database_h__ 
00194 
00195 /*
00196  * Local Variables:
00197  * mode: C++
00198  * fill-column: 80
00199  * c-comment-continuation-stars: " * "
00200  * End:
00201  */

Generated at Fri Apr 6 11:20:02 2001 for MySQLaux by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001