bool listAll(SDBConnectionPtr aSDB){ try { ListDomainsResponsePtr lRes = aSDB->listDomains(); std::cout << "list domains successfully" << std::endl; lRes->open(); std::string lDomain; while (lRes->next (lDomain)) { std::cout << " Domain: " << lDomain << std::endl; SDBQueryResponsePtr lRes = aSDB->query (lDomain, ""); int lCounter = 0; lRes->open(); std::string lItem; while (lRes->next (lItem)) { std::cout << " " << ++lCounter << ". Item: " << lItem; GetAttributesResponsePtr lRes = aSDB->getAttributes (lDomain, lItem); lRes->open(); std::pair<std::string, std::string> lAttr; while (lRes->next (lAttr)) { std::cout << " " << lAttr.first << ":" << lAttr.second ; } lRes->close(); std::cout << std::endl; } lRes->close(); } lRes->close(); } catch (ListDomainsException &e) { std::cerr << e.what() << std::endl; return false; } return true; }
static void load_image_meta(SDBConnectionPtr sdbconn, ImageMetadata *meta) { std::string item; serial_image_meta(meta, IMAGE_ITEM_ID, item); GetAttributesResponsePtr res = sdbconnect()->getAttributes(meta->imagetable->imagedomain, item, ""); res->open(); AttributePair attr; while (res->next(attr)) { deserial_image_meta(meta, attr.first.c_str(), attr.second); } res->close(); }
static void load_image_table_meta(SDBConnectionPtr sdbconn, ImageTableMetadata *meta) { std::string value; serial_image_table_meta(meta, IMAGE_TABLE_ITEM_ID, value); GetAttributesResponsePtr res = sdbconn->getAttributes(CVDB::CATALOG, value, ""); res->open(); AttributePair attr; while (res->next(attr)) { deserial_image_table_meta(meta, attr.first.c_str(), attr.second); } res->close(); }
bool getAttribute (SDBConnectionPtr aSDB, const std::string& aDomainName, const std::string& aItemName, const std::string attributeName = "") { try { GetAttributesResponsePtr lRes = aSDB->getAttributes (aDomainName, aItemName, attributeName); std::cout << "get attribute successfully" << std::endl; lRes->open(); std::pair<std::string, std::string> lAttr; while (lRes->next (lAttr)) { std::cout << " Attr-Name: " << lAttr.first << "-> " << lAttr.second << std::endl; } lRes->close(); } catch (PutAttributesException &e) { std::cerr << e.what() << std::endl; return false; } return true; }