#include <TableRegister.h>
Public Member Functions | |
bool | checkColumn (const std::string &tableName, const std::string &columnName) |
bool | checkTable (const std::string &tableName) |
bool | insertColumn (const std::string &tableName, const std::string &columnName) |
bool | insertColumns (const std::string &tableName, const std::vector< std::string > &columns) |
void | insertTable (const std::string &tableName) |
size_t | numberOfColumns (const std::string &tableName) |
TableRegister (coral::ISchema &schema) | |
virtual | ~TableRegister () |
Private Member Functions | |
void | init () |
Private Attributes | |
std::set< std::string > * | m_currentColumns |
const std::string * | m_currentTable |
bool | m_init |
std::map< std::string, std::set< std::string > > | m_register |
coral::ISchema & | m_schema |
Definition at line 16 of file TableRegister.h.
ora::TableRegister::TableRegister | ( | coral::ISchema & | schema | ) | [explicit] |
Definition at line 9 of file TableRegister.cc.
: m_schema( schema ),m_init(false),m_register(),m_currentTable(0),m_currentColumns(0){ }
ora::TableRegister::~TableRegister | ( | ) | [virtual] |
Definition at line 13 of file TableRegister.cc.
{ }
bool ora::TableRegister::checkColumn | ( | const std::string & | tableName, |
const std::string & | columnName | ||
) |
Definition at line 47 of file TableRegister.cc.
References init.
Referenced by ora::processLeafElement().
{ init(); if(!m_currentTable || (tableName!=*m_currentTable)){ std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName ); if(iT==m_register.end()) { m_currentTable = 0; m_currentColumns = 0; return false; } m_currentTable = &iT->first; m_currentColumns = &iT->second; } return m_currentColumns->find(columnName)!=m_currentColumns->end(); }
bool ora::TableRegister::checkTable | ( | const std::string & | tableName | ) |
Definition at line 32 of file TableRegister.cc.
References init.
Referenced by ora::processLeafElement().
{ init(); if(!m_currentTable || (tableName!=*m_currentTable)){ std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName ); if(iT==m_register.end()) { m_currentTable = 0; m_currentColumns = 0; return false; } m_currentTable = &iT->first; m_currentColumns = &iT->second; } return true; }
void ora::TableRegister::init | ( | void | ) | [private] |
Definition at line 16 of file TableRegister.cc.
References i, and asciidump::table.
{ if(!m_init){ std::set<std::string> tableList = m_schema.listTables(); for( std::set<std::string>::const_iterator iT = tableList.begin(); iT != tableList.end(); ++iT ){ coral::ITable& table = m_schema.tableHandle( *iT ); std::map<std::string,std::set<std::string> >::iterator iEntry = m_register.insert( std::make_pair( *iT, std::set<std::string>() ) ).first; int ncols = table.description().numberOfColumns(); for(int i=0;i<ncols;i++){ iEntry->second.insert( table.description().columnDescription( i ).name() ); } } m_init = true; } }
bool ora::TableRegister::insertColumn | ( | const std::string & | tableName, |
const std::string & | columnName | ||
) |
Definition at line 71 of file TableRegister.cc.
References init.
Referenced by ora::processLeafElement().
{ init(); if(!m_currentTable || (tableName!=*m_currentTable)){ std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName ); if(iT==m_register.end()) { m_currentTable = 0; m_currentColumns = 0; return false; } m_currentTable = &iT->first; m_currentColumns = &iT->second; } m_currentColumns->insert( columnName ); return true; }
bool ora::TableRegister::insertColumns | ( | const std::string & | tableName, |
const std::vector< std::string > & | columns | ||
) |
Definition at line 88 of file TableRegister.cc.
References init.
{ init(); if(!m_currentTable || (tableName!=*m_currentTable)){ std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName ); if(iT==m_register.end()) { m_currentTable = 0; m_currentColumns = 0; return false; } m_currentTable = &iT->first; m_currentColumns = &iT->second; } for( std::vector<std::string>::const_iterator iC = columns.begin(); iC != columns.end(); iC++ ){ m_currentColumns->insert( *iC ); } return true; }
void ora::TableRegister::insertTable | ( | const std::string & | tableName | ) |
Definition at line 64 of file TableRegister.cc.
References init.
{ init(); m_register.insert( std::make_pair(tableName, std::set<std::string>()) ); m_currentTable = 0; m_currentColumns = 0; }
size_t ora::TableRegister::numberOfColumns | ( | const std::string & | tableName | ) |
Definition at line 108 of file TableRegister.cc.
References init.
{ init(); if(!m_currentTable || (tableName!=*m_currentTable)){ std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName ); if(iT==m_register.end()) { m_currentTable = 0; m_currentColumns = 0; return 0; } m_currentTable = &iT->first; m_currentColumns = &iT->second; } return m_currentColumns->size(); }
std::set<std::string>* ora::TableRegister::m_currentColumns [private] |
Definition at line 50 of file TableRegister.h.
const std::string* ora::TableRegister::m_currentTable [private] |
Definition at line 48 of file TableRegister.h.
bool ora::TableRegister::m_init [private] |
Definition at line 44 of file TableRegister.h.
std::map<std::string,std::set<std::string> > ora::TableRegister::m_register [private] |
Definition at line 46 of file TableRegister.h.
coral::ISchema& ora::TableRegister::m_schema [private] |
Definition at line 42 of file TableRegister.h.