20 #include "RelationalAccess/ITableDescription.h"
21 #include "RelationalAccess/IColumn.h"
87 const std::vector< std::string >& columnNames,
95 coral::ISchema&
schema = schemaName.empty() ?
96 coralSession.nominalSchema() :
97 coralSession.schema( schemaName ) ;
99 coral::ITable&
table = schema.tableHandle( tableName ) ;
102 boost::shared_ptr< coral::IQuery >
query( table.newQuery() ) ;
105 std::vector< std::string >::const_iterator it = columnNames.begin() ;
106 std::vector< std::string >::const_iterator
end = columnNames.end() ;
107 for( ; it !=
end ; ++it )
109 query->addToOutputList( *it ) ;
113 if( !conditionLHS.empty() && conditionRHS.
numberRows() == 1 )
115 if( !conditionRHSName.empty() )
118 coral::AttributeList attList ;
119 attList.extend( conditionRHSName,
typeid(
std::string ) ) ;
122 attList[ conditionRHSName ].data<
std::string >() = tmp ;
124 query->setCondition( conditionLHS +
" = :" + conditionRHSName,
130 query->setCondition( conditionLHS +
" = :" +
136 coral::ICursor& cursor =
query->execute() ;
140 std::vector< coral::AttributeList > atts ;
141 while( cursor.next() )
143 atts.push_back( cursor.currentRow() ) ;
159 columnNames.push_back( columnName ) ;
160 return basicQuery( columnNames, schemaName, tableName,
161 conditionLHS, conditionRHS, conditionRHSName ) ;
164 std::vector< std::string >
170 coral::ISchema&
schema = schemaName.empty() ?
171 coralSession.nominalSchema() :
172 coralSession.schema( schemaName ) ;
174 coral::ITable&
table = schema.tableHandle( tableName ) ;
175 const coral::ITableDescription& tableDesc = table.description() ;
177 std::vector< std::string >
names ;
178 int nCols = tableDesc.numberOfColumns() ;
180 for(
int i = 0 ;
i < nCols ; ++
i )
182 const coral::IColumn& column = tableDesc.columnDescription(
i ) ;
183 names.push_back( column.name() ) ;
193 const std::vector< std::string >& columnNames,
201 coral::ISchema&
schema = schemaName.empty() ?
202 coralSession.nominalSchema() :
203 coralSession.schema( schemaName ) ;
208 coral::IQuery*
query = schema.newQuery(); ;
211 for (std::vector<std::string>::const_iterator constIt = columnNames.begin(); constIt
212 != columnNames.end(); ++constIt) {
213 query->addToOutputList(*constIt);
216 query->addToTableList(viewName);
219 if (!conditionLHS.empty() && conditionRHS.
numberRows() == 1) {
221 if (!conditionRHSName.empty()) {
223 coral::AttributeList attList;
224 attList.extend(conditionRHSName,
typeid(
std::string));
227 attList[conditionRHSName].data<
std::string> () = tmp;
229 query->setCondition(conditionLHS +
" = :" + conditionRHSName, attList);
234 conditionLHS +
" = :" + conditionRHS.
columnNames().front(),
239 coral::ICursor& cursor = query->execute();
243 std::vector<coral::AttributeList> atts;
244 while (cursor.next()) {
245 atts.push_back(cursor.currentRow());
274 columnNames.push_back( columnName ) ;
275 return basicQuery( columnNames, schemaName, viewName,
276 conditionLHS, conditionRHS, conditionRHSName ) ;
279 std::vector< std::string >
285 coral::ISchema&
schema = schemaName.empty() ?
286 coralSession.nominalSchema() :
287 coralSession.schema( schemaName ) ;
289 std::set< std::string > views = schema.listViews ();
290 std::vector< std::string >
names ;
292 if (schema.existsView (viewName)) {
294 coral::IView& view = schema.viewHandle( viewName ) ;
296 int nCols = view.numberOfColumns() ;
298 for (
int i = 0;
i < nCols; ++
i) {
299 const coral::IColumn& column = view.column(
i);
300 names.push_back(column.name());
bool fillVariable(const std::string &columnName, T &outputVariable) const
static const HistoName names[]
void start(bool readOnly=true)
Transaction & transaction()
void connect(const std::string &connectString, const std::string &authenticationPath, bool isOMDS=false)
std::vector< std::string > columnNames(const std::string &schemaName, const std::string &tableName)
const std::vector< coral::AttributeList > & attributeLists() const
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
const std::vector< std::string > & columnNames() const
void connect(const std::string &connectString, const std::string &authenticationPath)
std::vector< std::string > columnNamesView(const std::string &schemaName, const std::string &viewName)
const QueryResults basicQueryView(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &viewName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
coral::ISessionProxy & coralSession()
std::vector< std::vector< double > > tmp
cond::persistency::Session session