oracleType.hh

00001 //********************************************************************
00002 //*** ResourcePool/oracle/oracleType.hh
00003 //*** Copyright (c) 2003-2009 by Markus Winand <mws@fatalmind.com>
00004 //*** $Id: oracleType.hh,v 1.19 2009-03-14 13:51:44 mws Exp $
00005 //********************************************************************
00006 /*
00007 This file is part of ResourcePool.
00008 
00009 ResourcePool is free software; you can redistribute it
00010 and/or modify it under the terms of the GNU General Public License
00011 as published by the Free Software Foundation; either version 2 of 
00012 the License, or (at your option) any later version.
00013 
00014 ResourcePool is distributed in the hope that it will be
00015 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00016 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License for more details.
00018 
00019 You should have received a copy of the GNU General Public License
00020 along with ResourcePool; if not, write to the Free Software
00021 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00022 02111-1307  USA */
00023 
00024 #ifndef RESOURCEPOOL_ORACLE_ORACLETYPE_HH
00025 #define RESOURCEPOOL_ORACLE_ORACLETYPE_HH
00026 
00027 #include <ostream>
00028 
00029 #ifndef OCI_ORACLE
00030 #include <oci.h>
00031 #endif
00032 
00033 #include "mm/gc_ptr.hh"
00034 
00035 namespace fatalmind {
00036 namespace oracle {
00037 
00038 class oracleType: public usg_cnt_t<DefaultThreadedModel> {
00039     public:
00040         oracleType(bool nul = true);
00041         
00042         virtual void* ptr() const = 0;
00043         virtual sb4   size() const = 0;
00044         virtual ub2   type() const = 0;
00045         virtual ~oracleType();
00046         virtual void outputoperator(std::ostream&) const = 0;
00047 
00048         dvoid* indptr() const;
00049         sb2  indicator() const;
00050         bool isnull() const;
00051         void setnull(bool nul = true);
00052 
00053     private:
00054         sb2 ind;
00055 };
00056 
00057 template<typename T>
00058 class oracleTypeImpl: public oracleType {
00059     public:
00060         oracleTypeImpl(const T& val, bool nul = true);
00061         virtual ~oracleTypeImpl();
00062         
00063         virtual void* ptr() const;
00064         virtual sb4   size() const;
00065         virtual ub2   type() const;
00066         virtual void outputoperator(std::ostream&) const;
00067     private:
00068         T _val;
00069 };
00070 
00071 } // namespace oracle
00072 } // namespace fatalmind
00073 #endif

Generated on Mon Nov 9 16:21:24 2009 for ResourcePool by  doxygen 1.5.3