/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Db/Connection.h

Go to the documentation of this file.
00001 // $Header: /bes/bes/BossCvs/Calibration/rdbModel/rdbModel/Db/Connection.h,v 1.1.1.1 2005/10/17 06:10:53 maqm Exp $
00002 #ifndef RDBMODEL_CONNECTION_H
00003 #define RDBMODEL_CONNECTION_H
00004 #include <vector>
00005 #include <string>
00006 
00007 
00008 namespace rdbModel{
00009 
00025   enum MATCH  {
00026     MATCHequivalent,
00027     MATCHcompatible,
00028     MATCHfail,
00029     MATCHnoConnection
00030   };
00031 
00032   class ResultHandle;
00033   class Assertion;
00034   class Rdb;
00052   typedef std::vector<std::string>  StringVector;
00053 
00054   class Connection {
00059   public:
00060     Connection() {};
00061     virtual ~Connection() {};
00062     virtual bool open(const std::string& host, const std::string& userid,
00063                       const std::string& password,
00064                       const std::string& dbName) = 0;
00065                       //,                      unsigned int       port) = 0;
00068     virtual bool close() = 0;
00069 
00072     virtual bool open(const std::string& parms) = 0;
00073 
00075     virtual bool isConnected() = 0;
00076 
00077     virtual std::ostream* getOut() const = 0;
00078     virtual std::ostream* getErrOut() const = 0;
00079 
00085     virtual MATCH matchSchema(Rdb *rdb, bool matchDbName=true) = 0;
00086 
00093     virtual bool insertRow(const std::string& tableName, 
00094                            const StringVector& colNames, 
00095                            const StringVector& values,
00096                            int* auto_value=0,
00097                            const StringVector* nullCols = 0) = 0;
00098 
00099     /*
00100        So far anticipated uses of UPDATE would just modify a single row
00101        identified by ser_no (or, more generally, primary key), so
00102        make a method for this case.  Can call the more general
00103        version below.
00104 
00105        @return true if no errors were encountered; else false.  If the 
00106        update requested was error-free but entailed no actual change, 
00107        returns ??
00108      */
00109     /*
00110       At this level, don't have access to column name for primary 
00111       key, if any.  This has to be done by caller
00112     virtual bool updateUnique(const std::string& tableName, 
00113                               const StringVector& colNames, 
00114                               const StringVector& values,
00115                               const std::string& keyValue) = 0;
00116     */
00117 
00121     virtual unsigned int update(const std::string& tableName, 
00122                                 const StringVector& colNames, 
00123                                 const StringVector& values,
00124                                 const Assertion* where=0,
00125                                 const StringVector* nullCols = 0) = 0;
00126 
00140     virtual ResultHandle* select(const std::string& tableName,
00141                                  const StringVector& getCols,
00142                                  const StringVector& orderCols,
00143                                  const Assertion* where=0,
00144                                  int   rowLimit=0,
00145                                  int   rowOffset=0)=0;
00146 
00151     virtual void disableModify(bool disable)=0;
00152 
00160     virtual ResultHandle* dbRequest(const std::string& request)=0;
00161 
00167     virtual bool compileAssertion(const Assertion* a, std::string& sqlString)
00168       const = 0;
00169 
00170   };
00171 
00172 }  // end namespace rdbModel
00173 #endif

Generated on Tue Nov 29 22:57:56 2016 for BOSS_7.0.2 by  doxygen 1.4.7