#include <RelationalOperation.h>
Public Member Functions | |
void | addBlobData (const std::string &columnName) |
void | addData (const std::string &columnName, const std::type_info &columnType) |
void | addId (const std::string &columnName) |
void | addOrderId (const std::string &columnName) |
void | addWhereId (const std::string &columnName) |
coral::AttributeListSpecification & | attributeListSpecification () |
void | clear () |
coral::AttributeList & | data () |
void | execute () |
bool | nextCursorRow () |
SelectOperation (const std::string &tableName, coral::ISchema &schema) | |
std::string & | whereClause () |
coral::AttributeList & | whereData () |
~SelectOperation () | |
Private Attributes | |
coral::ICursor * | m_cursor |
std::vector< std::string > | m_orderByCols |
std::auto_ptr< coral::IQuery > | m_query |
coral::ISchema & | m_schema |
coral::AttributeListSpecification * | m_spec |
std::string | m_tableName |
std::string | m_whereClause |
coral::AttributeList | m_whereData |
Definition at line 159 of file RelationalOperation.h.
ora::SelectOperation::SelectOperation | ( | const std::string & | tableName, |
coral::ISchema & | schema | ||
) | [explicit] |
Definition at line 224 of file RelationalOperation.cc.
: m_spec( new coral::AttributeListSpecification ), m_whereData(), m_whereClause(""), m_orderByCols(), m_query(), m_cursor( 0 ), m_tableName( tableName ), m_schema( schema ){ }
ora::SelectOperation::~SelectOperation | ( | ) |
Definition at line 236 of file RelationalOperation.cc.
{ m_spec->release(); }
void ora::SelectOperation::addBlobData | ( | const std::string & | columnName | ) | [virtual] |
Implements ora::IRelationalData.
Definition at line 271 of file RelationalOperation.cc.
void ora::SelectOperation::addData | ( | const std::string & | columnName, |
const std::type_info & | columnType | ||
) | [virtual] |
Implements ora::IRelationalData.
Definition at line 264 of file RelationalOperation.cc.
void ora::SelectOperation::addId | ( | const std::string & | columnName | ) | [virtual] |
Implements ora::IRelationalData.
Definition at line 258 of file RelationalOperation.cc.
Referenced by ora::IteratorBuffer::IteratorBuffer().
void ora::SelectOperation::addOrderId | ( | const std::string & | columnName | ) |
Definition at line 240 of file RelationalOperation.cc.
Referenced by ora::IteratorBuffer::IteratorBuffer().
{ m_orderByCols.push_back( columnName ); }
void ora::SelectOperation::addWhereId | ( | const std::string & | columnName | ) | [virtual] |
Implements ora::IRelationalData.
Definition at line 277 of file RelationalOperation.cc.
References ora::existAttribute().
Referenced by ora::OraPtrReadBuffer::build(), and ora::ReadBuffer::ReadBuffer().
{ if(!existAttribute( columnName, m_whereData )){ m_whereData.extend<int>( columnName ); if(!m_whereClause.empty()) m_whereClause += " AND "; m_whereClause += ( columnName +"= :"+columnName ); } }
coral::AttributeListSpecification & ora::SelectOperation::attributeListSpecification | ( | ) |
Definition at line 317 of file RelationalOperation.cc.
{ return *m_spec; }
void ora::SelectOperation::clear | ( | void | ) |
Definition at line 253 of file RelationalOperation.cc.
Referenced by ora::ReadBuffer::read().
coral::AttributeList & ora::SelectOperation::data | ( | ) | [virtual] |
Implements ora::IRelationalData.
Definition at line 285 of file RelationalOperation.cc.
References ora::throwException().
{ if(!m_cursor) throwException( "Query on table "+m_tableName+" has not been executed.", "ora::ReadOperation::data" ); return const_cast<coral::AttributeList&>(m_cursor->currentRow()); }
void ora::SelectOperation::execute | ( | ) |
Definition at line 299 of file RelationalOperation.cc.
References asciidump::table.
Referenced by ora::ReadBuffer::read().
{ m_cursor = 0; coral::ITable& table = m_schema.tableHandle( m_tableName ); m_query.reset( table.newQuery() ); for ( coral::AttributeListSpecification::const_iterator iSpec = m_spec->begin(); iSpec != m_spec->end(); ++iSpec ) { m_query->addToOutputList( iSpec->name() ); m_query->defineOutputType( iSpec->name(),iSpec->typeName()); } for(std::vector<std::string>::iterator iCol = m_orderByCols.begin(); iCol != m_orderByCols.end(); iCol++ ){ m_query->addToOrderList( *iCol ); } m_query->setCondition( m_whereClause, m_whereData ); m_query->setRowCacheSize( 100 ); // We should better define this value !!! m_cursor = &m_query->execute(); }
bool ora::SelectOperation::nextCursorRow | ( | ) |
Definition at line 244 of file RelationalOperation.cc.
References runTheMatrix::ret.
Referenced by ora::ReadBuffer::read().
std::string & ora::SelectOperation::whereClause | ( | ) | [virtual] |
Implements ora::IRelationalData.
Definition at line 295 of file RelationalOperation.cc.
{ return m_whereClause; }
coral::AttributeList & ora::SelectOperation::whereData | ( | ) | [virtual] |
Implements ora::IRelationalData.
Definition at line 291 of file RelationalOperation.cc.
Referenced by ora::ReadBuffer::read().
{ return m_whereData; }
coral::ICursor* ora::SelectOperation::m_cursor [private] |
Definition at line 190 of file RelationalOperation.h.
std::vector<std::string> ora::SelectOperation::m_orderByCols [private] |
Definition at line 188 of file RelationalOperation.h.
std::auto_ptr<coral::IQuery> ora::SelectOperation::m_query [private] |
Definition at line 189 of file RelationalOperation.h.
coral::ISchema& ora::SelectOperation::m_schema [private] |
Definition at line 192 of file RelationalOperation.h.
coral::AttributeListSpecification* ora::SelectOperation::m_spec [private] |
Definition at line 185 of file RelationalOperation.h.
std::string ora::SelectOperation::m_tableName [private] |
Definition at line 191 of file RelationalOperation.h.
std::string ora::SelectOperation::m_whereClause [private] |
Definition at line 187 of file RelationalOperation.h.
coral::AttributeList ora::SelectOperation::m_whereData [private] |
Definition at line 186 of file RelationalOperation.h.