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

boss_mysql_result.h

Go to the documentation of this file.
00001 /* boss_mysql_result.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_RESULT_H
00026 #define MYSQL_RESULT_H
00027 
00028 using namespace std;
00029 
00030 #include <mysql.h>
00031 #include "boss_mysql_exceptions.h"
00032 #include <map>
00033 
00034 typedef map< string, unsigned >        MySQL_FieldMap;
00035 typedef MySQL_FieldMap::iterator       MySQL_FieldMapIt;
00036 typedef MySQL_FieldMap::const_iterator MySQL_FieldMapCIt;
00037 
00038 // Forward declaration
00039 class MySQL_Handler;
00040 
00051 class MySQL_Result {
00052         
00053   MySQL_Handler   *base;
00054   MYSQL_RES       *result;
00055   MySQL_FieldMap  field_map;
00056 
00057  public:
00058         
00059   friend ostream & operator << (ostream & out, const MySQL_Result & r);
00060         
00061   MySQL_Result() : base(0), result(0) {}
00062   MySQL_Result(MySQL_Handler * b, MYSQL_RES * r) throw(MySQL_QueryFailed);
00063   MySQL_Result(const MySQL_Result & r);
00064   ~MySQL_Result();
00065   MySQL_Result & operator = (const MySQL_Result & r);
00066 
00067   string operator () (const unsigned & row, const unsigned & col) const throw(MySQL_QueryFailed, MySQL_IndexOutOfRange);
00068   string operator () (const unsigned & row, const string & col) const throw(MySQL_QueryFailed);
00069   unsigned col() const { return mysql_num_fields(result); }
00070   unsigned row() const { return mysql_num_rows(result); }
00071   bool valid() const { return result; }
00072 };
00073 
00074 #endif

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