Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

boss_mysql_handler.h

Go to the documentation of this file.
00001 /* boss_mysql_handler.h    $Revision: 1.2 $ $Date: 2005/12/10 20:33:54 $
00002    Copyright (C) 2000 University of Bonn.
00003    http://www.ikp.uni-bonn.de/boss
00004 
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU General Public License
00007    as published by the Free Software Foundation; either version 2
00008    of the License, or (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,
00018    Boston, MA  02111-1307, USA.
00019 */
00020 
00025 #ifndef MYSQL_HANDLER_H
00026 #define MYSQL_HANDLER_H
00027 
00028 using namespace std;
00029 
00030 #include <mysql.h>
00031 #include <list>
00032 #include <map>
00033 #include <iterator>
00034 #include "boss_mysql_exceptions.h"
00035 #include "boss_mysql_result.h"
00036 
00037 typedef list< MySQL_Result * >               MySQL_ResultList;
00038 typedef map< MYSQL_RES *, MySQL_ResultList > MySQL_ResultMap;
00039 typedef MySQL_ResultMap::iterator            MySQL_ResultMapIt;
00040 typedef MySQL_ResultMap::const_iterator      MySQL_ResultMapCIt;
00041 
00045 class MySQL_Handler {
00046 
00047 private:
00048 
00049   MYSQL           *handle;
00050   MySQL_ResultMap results;
00051 
00052   friend class MySQL_Result;
00053 
00054   void push_res(MySQL_Result * rclass,  MYSQL_RES * rdata);
00055   void pop_res(MySQL_Result * rclass,   MYSQL_RES * rdata);
00056         
00057 public:
00058 
00059   MySQL_Handler::MySQL_Handler() throw(MySQL_ConnectFailed);
00060   MySQL_Handler(const string & user, const string & passwd, const string & database) throw(MySQL_ConnectFailed);
00061   MySQL_Handler(const string & host, const string & user, const string & passwd, const string & database) throw(MySQL_ConnectFailed);
00062   MySQL_Handler::MySQL_Handler(const MySQL_Handler & h);
00063   ~MySQL_Handler();
00064   MySQL_Handler & operator = (const MySQL_Handler & h);
00065 
00066   MySQL_Result query(const char * query_string, const bool do_free=false);
00067   MySQL_Result query(const char * query_string, const unsigned & length, const bool do_free=false) throw(MySQL_QueryFailed);
00068         
00069   void print(ostream & out) const;
00070 };
00071 
00072 #endif

Generated on Tue Dec 20 23:14:37 2005 for BOSS by doxygen 1.3.6