00001 /* 00002 * Copyright (c) 2004 on behalf of the EU EGEE Project: 00003 * The European Organization for Nuclear Research (CERN), 00004 * Istituto Nazionale di Fisica Nucleare (INFN), Italy 00005 * Datamat Spa, Italy 00006 * Centre National de la Recherche Scientifique (CNRS), France 00007 * CS Systeme d'Information (CSSI), France 00008 * Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden 00009 * Universiteit van Amsterdam (UvA), Netherlands 00010 * University of Helsinki (UH.HIP), Finland 00011 * University of Bergen (UiB), Norway 00012 * Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom 00013 */ 00014 #ifndef TUPLE_H 00015 #define TUPLE_H 00016 #include <vector> 00017 #include <string> 00018 #include "rgma/ResultSetMetaData.h" 00019 #include "rgma/RGMAException.h" 00020 namespace glite 00021 { 00022 namespace rgma 00023 { 00028 class Tuple 00029 { 00030 00031 public: 00035 class TupleItem 00036 { 00037 private: 00038 std::string m_value; 00039 bool m_isNull; 00040 public: 00041 TupleItem(){} 00048 TupleItem( std::string value = "", bool isNull = false); 00053 bool isNull(); 00058 std::string getValue(); 00059 00060 virtual ~TupleItem(); 00061 }; 00062 00063 Tuple(ResultSetMetaData& metaData); 00068 Tuple(ResultSetMetaData* metaData); 00069 Tuple(){} 00070 virtual ~Tuple(); 00071 00072 Tuple( const Tuple& tuple ); 00073 00074 Tuple& operator=( const Tuple& tuple ); 00075 00080 void addTupleItem( TupleItem item ); 00087 ResultSetMetaData* getMetaData(); 00088 00094 ResultSetMetaData getTupleMetaData(); 00095 00103 double getDouble( std::string columnName )throw(RGMAException); 00111 float getFloat( std::string columnName )throw(RGMAException); 00119 std::string getString( std::string columnName )throw(RGMAException); 00120 00128 int getInt( std::string columnName )throw(RGMAException); 00129 00137 bool getBoolean( std::string columnName )throw(RGMAException); 00138 00146 bool isNull(std::string columnName)throw(RGMAException); 00147 00148 private: 00149 std::vector<TupleItem> m_items; 00150 ResultSetMetaData m_metaData; 00156 TupleItem getTupleItem(std::string columnName)throw(RGMAException); 00157 }; 00158 } 00159 } 00160 #endif // TUPLE_H