00001 00016 #ifndef Read_Write_Base_Hpp 00017 #define Read_Write_Base_Hpp 00018 00019 // includes 00020 #include "openDB.hpp" 00021 #include "ocTypes.h" 00022 #include "ocString.h" 00023 #include "dataXfer.hpp" 00024 00025 // forward declaration 00026 class ref_base; 00027 00029 typedef map< string, string> changeMap; 00030 00032 class read_write_base 00033 { 00034 protected: 00035 openDbFactory DbMaker; 00036 openDB & db; 00037 openRsFactory RsMaker; 00038 openRS & rs; 00039 openCmdFactory CmdMaker; 00040 openCMD & cmd; 00041 dataXfers xfers; 00042 string m_name; 00043 ocString m_result; 00044 long long m_key; 00045 bool actDerived; 00046 public: 00047 read_write_base(); 00048 read_write_base(dbProvider,const char *); 00049 00050 virtual ~read_write_base(); 00051 00052 // validation and supplemental for insert,update and delete ) 00053 virtual bool ivalidate( void ); 00054 virtual bool uvalidate( changeMap & changes ); 00055 virtual bool dvalidate( void ); 00056 00057 virtual bool isupplemental( void ); 00058 virtual bool usupplemental( changeMap & changes ); 00059 virtual bool dsupplemental( void ); 00060 virtual bool ssupplemental( void ); 00061 00062 00063 // gets,sets 00064 void data_name( string in ){ m_name=in; } 00065 const string & data_name ( void ){ return m_name; } 00066 const string & last_result ( void ){ return m_result; } 00067 long long key( void ){ return m_key; } 00068 void key( long long in ){ m_key=in; } 00069 00070 bool db_action( string mode, changeMap & changes ); 00071 virtual bool db_insert( void ); 00072 virtual bool db_update( changeMap & changes ); 00073 virtual bool db_delete( void ); 00074 bool get_data( void ); 00075 /* 00076 custom user called get_data() with where clause input. 00077 (The ' where ' keyword is provided for you.) 00078 Sets the key for subsequent update/delete actions. 00079 If whereClause is zero length, the where keyword is not added 00080 */ 00081 bool get_data( string whereClause, string orderClause = "" ); 00082 00083 // for some of these where clauses, multiple records, allow forward iteration... 00084 bool next( void ); 00085 00086 bool addDXMap( dataXfer * xfer ); 00087 void clearMaps( void ); 00088 00089 // new for transasction capable dbs 00090 bool commit( void ); 00091 00092 friend class ref_base; 00093 }; 00094 00095 00096 #endif
1.5.5