42 ,
const std::string& tagId)
62 <<
" node. Returning empty recordset" <<
endmsg;
70 for (
char& ch : upperName) {
71 ch = std::toupper (
static_cast<unsigned int>(ch));
74 coral::IQuery* queryStructure = session->nominalSchema().newQuery();
77 const coral::ITableDescription& dataTableDesc = session->nominalSchema().tableHandle(upperName +
"_DATA").description();
78 for(
int i=0; i<dataTableDesc.numberOfColumns(); i++) {
79 queryStructure->addToOutputList(upperName +
"_DATA." + dataTableDesc.columnDescription(i).name());
83 queryStructure->addToTableList(upperName +
"_DATA");
84 queryStructure->addToTableList(upperName +
"_DATA2TAG");
87 bindsData.extend<std::string>(
"tagID");
90 std::string queryStructCondition = upperName +
"_DATA2TAG." + upperName +
"_TAG_ID =:tagID";
91 queryStructCondition +=
" AND " + upperName +
"_DATA." + upperName +
"_DATA_ID=" + upperName +
"_DATA2TAG." + upperName +
"_DATA_ID";
93 queryStructure->setCondition(queryStructCondition , bindsData);
94 bindsData[0].data<std::string>() = tagId;
96 queryStructure->addToOrderList(upperName +
"_DATA." + upperName +
"_DATA_ID");
97 queryStructure->setMemoryCacheSize(1);
99 coral::ICursor& cursorStructure = queryStructure->execute();
102 while(cursorStructure.next()) {
103 const coral::AttributeList& row = cursorStructure.currentRow();
107 delete queryStructure;
109 catch(coral::SchemaException& se) {
110 m_accessSvc->msg() << MSG::ERROR<<
"RT: Schema Exception : " << se.what() <<
endmsg;
112 catch(std::exception& e) {
168 os <<
"Recordsets correspond to different nodes" << std::endl;
173 os <<
"Recordsets correspond to different tags" << std::endl;
177 std::set<size_t> uniq0, uniq1;
178 std::vector<long> dataId0, dataId1;
182 for (
char& ch : upperName) {
183 ch = std::toupper (
static_cast<unsigned int>(ch));
187 for(
size_t i=0; i<
m_records.size(); ++i) {
188 dataId0.push_back(
m_records[i]->getLong(upperName+
"_DATA_ID"));
191 for(
size_t i=0; i<rec.
m_records.size(); ++i) {
192 dataId1.push_back(rec.
m_records[i]->getLong(upperName+
"_DATA_ID"));
197 bool diffFound =
false;
198 for(
size_t i=0; i<dataId0.size(); ++i) {
199 long id0 = dataId0[i];
202 for(
size_t ii=0; ii<dataId1.size(); ++ii) {
203 if(id0==dataId1[ii]) {
214 && *record0!=*record1) {
216 os <<
"Records with the same data id and different contents:" << std::endl;
219 os <<
"< " << *record0 << std::endl;
220 os <<
"> " << *record1 << std::endl;
221 os <<
"--" << std::endl;
229 for(
size_t i=0; i<dataId1.size(); ++i) {
230 long id1 = dataId1[i];
232 for(
size_t ii=0; ii<dataId0.size(); ++ii) {
233 if(id1==dataId0[ii]) {
245 os <<
"Records with the following data ids are present in recordset 0 and missing in recordset 1: " << std::endl;
246 std::set<size_t>::const_iterator it = uniq0.begin();
247 for(; it!=uniq0.end(); ++it) {
248 os <<
m_records[*it]->getLong(upperName+
"_DATA_ID") <<
" ";
253 os <<
"Records with the following data ids are present in recordset 1 and missing in recordset 0: " << std::endl;
254 std::set<size_t>::const_iterator it = uniq1.begin();
255 for(; it!=uniq1.end(); ++it) {
256 os << rec.
m_records[*it]->getLong(upperName+
"_DATA_ID") <<
" ";
void getData(coral::ISessionProxy *session, const std::string &nodeName, const std::string &tagName, const std::string &tagId)
Constructs SQL query and retrieves the data from DB.