00001
00002 #ifndef RDBMODEL_RDB_H
00003 #define RDBMODEL_RDB_H
00004 #include <vector>
00005 #include <string>
00006
00007
00008 #include "rdbModel/Management/Visitor.h"
00009
00010 namespace rdbModel {
00011
00012 class Table;
00013 class Column;
00014 class Index;
00015
00016 class XercesBuilder;
00017 class Connection;
00018 class Row;
00019
00020
00021 enum FIELDTYPE {
00022 FIELDTYPElit = 0,
00023 FIELDTYPEold,
00024 FIELDTYPEtoBe,
00025 FIELDTYPEask,
00026 FIELDTYPElitDef,
00027 FIELDTYPEoldDef,
00028 FIELDTYPEtoBeDef
00029 };
00030
00041 class Rdb {
00042 public:
00047 virtual ~Rdb();
00048 Rdb() : m_connection(0) { }
00049
00050
00051 unsigned getMajorVersion(){return m_majorVersion;};
00052 unsigned getMinorVersion(){return m_minorVersion;};
00053
00054 const std::string& getCVSid(){return m_CVSid;};
00055
00056 const std::string& getDbName(){return m_dbName;};
00057
00058
00059
00060
00061 Table* getTable(const std::string& name) const;
00062 Column* getColumn(const std::string& tableName,
00063 const std::string& colName) const;
00064
00065 Index* getIndex(const std::string& tableName,
00066 const std::string& indexName) const;
00067
00068 unsigned int getNTable() const {return m_tables.size();}
00069
00070
00071 void setConnection(Connection* connection);
00072
00078 int insertRow(const std::string& tName, Row& row, int* serial=0) const;
00079
00086 int insertLatest(Table* t, Row& row, int* serial=0) const;
00087 int insertLatest(const std::string& tName, Row& row, int* serial=0) const;
00088
00089 int supersedeRow(const std::string& tName, Row& row, int oldKey,
00090 int* newKey=0) const;
00091
00095 int updateRows(const std::string& tName, Row& row, Assertion* where) const;
00096
00097
00099 unsigned int accept(Visitor* v);
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109 private:
00110
00111
00112 friend class rdbModel::XercesBuilder;
00113
00114
00115 void setCVSid(std::string pcvs){m_CVSid = pcvs;};
00116
00117 void addTable(Table* t){m_tables.push_back(t);};
00118
00119
00120
00121
00122
00123
00124 std::vector<Table* > m_tables;
00125
00127 std::string m_dbName;
00129 unsigned m_majorVersion;
00130 unsigned m_minorVersion;
00131
00133 std::string m_CVSid;
00134 Connection* m_connection;
00135
00136 };
00137 }
00138
00139 #endif //RDB_H
00140