4 #include "RelationalAccess/IColumn.h"
5 #include "RelationalAccess/ISchema.h"
6 #include "RelationalAccess/ITable.h"
7 #include "RelationalAccess/ITableDescription.h"
10 m_schema( schema ),m_init(
false),m_register(),m_currentTable(0),m_currentColumns(0){
18 std::set<std::string> tableList = m_schema.listTables();
19 for( std::set<std::string>::const_iterator iT = tableList.begin(); iT != tableList.end(); ++iT ){
20 coral::ITable&
table = m_schema.tableHandle( *iT );
21 std::map<std::string,std::set<std::string> >::iterator iEntry =
22 m_register.insert( std::make_pair( *iT, std::set<std::string>() ) ).first;
23 int ncols = table.description().numberOfColumns();
24 for(
int i=0;
i<ncols;
i++){
25 iEntry->second.insert( table.description().columnDescription(
i ).name() );
34 if(!m_currentTable || (tableName!=*m_currentTable)){
35 std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName );
36 if(iT==m_register.end()) {
41 m_currentTable = &iT->first;
42 m_currentColumns = &iT->second;
50 if(!m_currentTable || (tableName!=*m_currentTable)){
51 std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName );
52 if(iT==m_register.end()) {
57 m_currentTable = &iT->first;
58 m_currentColumns = &iT->second;
60 return m_currentColumns->find(columnName)!=m_currentColumns->end();
66 m_register.insert( std::make_pair(tableName, std::set<std::string>()) );
74 if(!m_currentTable || (tableName!=*m_currentTable)){
75 std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName );
76 if(iT==m_register.end()) {
81 m_currentTable = &iT->first;
82 m_currentColumns = &iT->second;
84 m_currentColumns->insert( columnName );
89 const std::vector<std::string>&
columns ){
92 if(!m_currentTable || (tableName!=*m_currentTable)){
93 std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName );
94 if(iT==m_register.end()) {
99 m_currentTable = &iT->first;
100 m_currentColumns = &iT->second;
102 for( std::vector<std::string>::const_iterator iC = columns.begin(); iC != columns.end(); iC++ ){
103 m_currentColumns->insert( *iC );
110 if(!m_currentTable || (tableName!=*m_currentTable)){
111 std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName );
112 if(iT==m_register.end()) {
114 m_currentColumns = 0;
117 m_currentTable = &iT->first;
118 m_currentColumns = &iT->second;
120 return m_currentColumns->size();
TableRegister(coral::ISchema &schema)
bool insertColumns(const std::string &tableName, const std::vector< std::string > &columns)
bool insertColumn(const std::string &tableName, const std::string &columnName)
size_t numberOfColumns(const std::string &tableName)
void insertTable(const std::string &tableName)
bool checkColumn(const std::string &tableName, const std::string &columnName)
volatile std::atomic< bool > shutdown_flag false
bool checkTable(const std::string &tableName)