Пример #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;
  
}
Пример #2
0
bool listDomains (SDBConnectionPtr aSDB, int aMaxNumberOfDomains, const std::string& aNextToken) {
  try {
    ListDomainsResponsePtr lRes = aSDB->listDomains(aMaxNumberOfDomains, aNextToken);
      std::cout << "list domains successfully" << std::endl;
      lRes->open();
      std::string lDomain;
      while (lRes->next (lDomain)) {
          std::cout << "   Domain: " << lDomain  << std::endl;
        }
      lRes->close();
    } catch (ListDomainsException &e) {
      std::cerr << e.what() << std::endl;
      return false;
    }
  return true;
}
Пример #3
0
bool deleteAllDomains (SDBConnectionPtr aSDB, std::string aPrefix) {
  try {
      ListDomainsResponsePtr lRes = aSDB->listDomains();
      std::cout << "start deleting" << std::endl;
      lRes->open();
      std::string lDomain;
      while (lRes->next (lDomain)) {
        if(aPrefix.length() == 0 || lDomain.compare(0, aPrefix.length(),aPrefix) == 0){
            std::cout << "   " << lDomain  << std::endl;
            aSDB->deleteDomain (lDomain);
          }
        }
      lRes->close();
    } catch (PutAttributesException &e) {
      std::cerr << e.what() << std::endl;
      return false;
    }
  return true;
}