std::vector<std::string>* Connection::namespaces(const std::string& db) const { if (_logger->isDebug()) _logger->debug(2, "namespaces command. db: %s", db.c_str()); ShownamespacesCommand cmd; cmd.setDB(db); _commandWriter->writeCommand(&cmd); cmd.readResult(_inputStream); std::vector<std::string>* result = (std::vector<std::string>*)cmd.result(); return result; }
std::vector<char*>* DjondbConnection::namespaces(const char* db) const { if (_logger->isDebug()) _logger->debug(2, "namespaces command. db: %s", db); if (!isOpen()) { throw DjondbException(D_ERROR_CONNECTION, "Not connected to any server"); } ShownamespacesCommand cmd; cmd.setDB(db); _commandWriter->writeCommand(&cmd); cmd.readResult(_inputStream); std::vector<std::string>* temp = (std::vector<std::string>*)cmd.result(); std::vector<char*>* result = new std::vector<char*>(); for (std::vector<std::string>::const_iterator i = temp->begin(); i != temp->end(); i++) { std::string ns = *i; result->push_back(strcpy(ns.c_str(), ns.length())); } delete temp; return result; }