Ejemplo n.º 1
0
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;
  
}
Ejemplo n.º 2
0
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();
}
Ejemplo n.º 3
0
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();
}
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
int getAttributes(SDBConnection* lCon) {
    try {
        GetAttributesResponsePtr lPtr = lCon->getAttributes("testDomain",
                                        "testItem");
        std::cout << "Get Attributes:" << std::endl;
        lPtr->open();
        AttributePair attPair;
        while (lPtr->next(attPair)) {
            std::cout << "Name: " << attPair.first << " Value: " << attPair.second
                      << std::endl;
        }
        printBoxUsage(*lPtr);
    }
    catch (GetAttributesException& e) {
        std::cerr << "Couldn't get attributes" << std::endl;
        std::cerr << e.what() << std::endl;
        return 1;
    }
    return 0;
}