50{
52 m_accessSvc->msg() << MSG::WARNING <<
"RDBQuery cannot be executed more than once! Query: "
57 return;
58 }
59
65 }
66
68 m_accessSvc->msg() << MSG::ERROR <<
"Cannot connect to the database: "
70 throw std::runtime_error(
"Cannot connect to the database " +
m_connName);
71 }
72
74 try {
75
77 for (char& ch : upperName) {
78 ch = std::toupper (
static_cast<unsigned int>(ch));
79 }
80
81
84
85
87
88 for(
unsigned int i=0;
i<
m_fields.size(); ++
i) {
90 }
91 }
92 else {
93
94 const coral::ITableDescription& dataTableDesc =
m_accessSvc->getSession(
m_connName)->nominalSchema().tableHandle(upperName +
"_DATA").description();
95 for(
int i=0;
i<dataTableDesc.numberOfColumns(); ++
i) {
96 m_query->addToOutputList(upperName+
"_DATA."+dataTableDesc.columnDescription(i).name());
97 }
98 }
99
100 m_queryCount->addToOutputList(
"COUNT("+upperName+
"_DATA_ID)",
"SUMREC");
101
102
103 m_query->addToTableList(upperName +
"_DATA");
104 m_query->addToTableList(upperName +
"_DATA2TAG");
105
107
108
110 m_query->addToOrderList(upperName +
"_DATA." + upperName +
"_DATA_ID");
111 }
112 else {
114 }
115
116
118 bindsData.extend<std::string>("tagID");
119
120 std::string queryStructCondition = upperName +"_DATA2TAG." + upperName + "_TAG_ID =:tagID";
121 m_queryCount->setCondition(queryStructCondition , bindsData);
122
123 queryStructCondition += " AND " + upperName +"_DATA." + upperName + "_DATA_ID=" + upperName + "_DATA2TAG." + upperName + "_DATA_ID";
124 m_query->setCondition(queryStructCondition , bindsData);
125
126 bindsData[0].data<std::string>() =
m_tagId;
127
129 m_query->setMemoryCacheSize(1);
130
131
133 while(cursorCount.next()) {
134
135 m_size = cursorCount.currentRow()[
"SUMREC"].data<
long>();
136 }
137
138
140 return;
141 }
142 catch(coral::SchemaException& se) {
143 m_accessSvc->msg() << MSG::WARNING <<
"QUERY: Schema Exception : " + std::string(
se.what()) <<
endmsg;
144 }
145 catch(std::exception& e) {
146 m_accessSvc->msg() << MSG::WARNING <<
"QUERY: Exception : " + std::string(
e.what()) <<
endmsg;
147 }
148 catch(...) {
150 }
151
153}
#define ATLAS_THREAD_SAFE