20 #include "RelationalAccess/ITableDescription.h" 21 #include "RelationalAccess/IColumn.h" 82 coral::ISchema& schema = schemaName.empty() ? coralSession.nominalSchema() : coralSession.schema(schemaName);
87 std::shared_ptr<coral::IQuery>
query(
table.newQuery());
90 std::vector<std::string>::const_iterator
it =
columnNames.begin();
91 std::vector<std::string>::const_iterator end =
columnNames.end();
92 for (;
it != end; ++
it) {
97 if (!conditionLHS.empty() && conditionRHS.
numberRows() == 1) {
98 if (!conditionRHSName.empty()) {
100 coral::AttributeList attList;
101 attList.extend(conditionRHSName,
typeid(
std::string));
106 query->setCondition(conditionLHS +
" = :" + conditionRHSName, attList);
110 query->setCondition(conditionLHS +
" = :" + conditionRHS.
columnNames().front(),
115 coral::ICursor& cursor =
query->execute();
119 std::vector<coral::AttributeList> atts;
120 while (cursor.next()) {
121 atts.push_back(cursor.currentRow());
140 coral::ISchema& schema = schemaName.empty() ? coralSession.nominalSchema() : coralSession.schema(schemaName);
143 const coral::ITableDescription& tableDesc =
table.description();
145 std::vector<std::string>
names;
146 int nCols = tableDesc.numberOfColumns();
148 for (
int i = 0;
i < nCols; ++
i) {
149 const coral::IColumn& column = tableDesc.columnDescription(
i);
150 names.push_back(column.name());
165 coral::ISchema& schema = schemaName.empty() ? coralSession.nominalSchema() : coralSession.schema(schemaName);
170 coral::IQuery*
query = schema.newQuery();
174 for (std::vector<std::string>::const_iterator constIt =
columnNames.begin(); constIt !=
columnNames.end();
176 query->addToOutputList(*constIt);
179 query->addToTableList(viewName);
182 if (!conditionLHS.empty() && conditionRHS.
numberRows() == 1) {
183 if (!conditionRHSName.empty()) {
185 coral::AttributeList attList;
186 attList.extend(conditionRHSName,
typeid(
std::string));
191 query->setCondition(conditionLHS +
" = :" + conditionRHSName, attList);
195 query->setCondition(conditionLHS +
" = :" + conditionRHS.
columnNames().front(),
200 coral::ICursor& cursor =
query->execute();
204 std::vector<coral::AttributeList> atts;
205 while (cursor.next()) {
206 atts.push_back(cursor.currentRow());
236 coral::ISchema& schema = schemaName.empty() ? coralSession.nominalSchema() : coralSession.schema(schemaName);
238 std::set<std::string> views = schema.listViews();
239 std::vector<std::string>
names;
241 if (schema.existsView(viewName)) {
242 coral::IView&
view = schema.viewHandle(viewName);
244 int nCols =
view.numberOfColumns();
246 for (
int i = 0;
i < nCols; ++
i) {
247 const coral::IColumn& column =
view.column(
i);
248 names.push_back(column.name());
void start(bool readOnly=true)
Transaction & transaction()
const std::string names[nVars_]
void connect(const std::string &connectString, const std::string &authenticationPath, bool isOMDS=false)
const std::vector< coral::AttributeList > & attributeLists() const
std::vector< std::string > columnNames(const std::string &schemaName, const std::string &tableName)
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
bool fillVariable(const std::string &columnName, T &outputVariable) 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()
cond::persistency::Session session