Esempio n. 1
0
std::vector<std::string>* Connection::dbs() const {
	if (_logger->isDebug()) _logger->debug(2, "dbs command.");

	ShowdbsCommand cmd;
	_commandWriter->writeCommand(&cmd);

	cmd.readResult(_inputStream);

	std::vector<std::string>* result = (std::vector<std::string>*)cmd.result();

	return result;
}
Esempio n. 2
0
std::vector<char*>* DjondbConnection::dbs() const {
	if (_logger->isDebug()) _logger->debug(2, "dbs command.");

	if (!isOpen()) {
		throw DjondbException(D_ERROR_CONNECTION, "Not connected to any server");
	}
	ShowdbsCommand cmd;
	_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 db = *i;
		result->push_back(strcpy(db.c_str(), db.length()));
	}

	delete temp;

	return result;
}