Compare commits
No commits in common. "93b868aaafecdee525098a760dcf385a6c2ba3e2" and "f3c502a2ce487d6d1b5a4ffe8cde6f761c4258a3" have entirely different histories.
93b868aaaf
...
f3c502a2ce
|
|
@ -16,6 +16,23 @@ public:
|
|||
[[nodiscard]] const char *column(size_t index) const override;
|
||||
bool fetch() override;
|
||||
|
||||
void read_value(const char *id, size_t index, char &value) override;
|
||||
void read_value(const char *id, size_t index, short &value) override;
|
||||
void read_value(const char *id, size_t index, int &value) override;
|
||||
void read_value(const char *id, size_t index, long &value) override;
|
||||
void read_value(const char *id, size_t index, long long int &value) override;
|
||||
void read_value(const char *id, size_t index, unsigned char &value) override;
|
||||
void read_value(const char *id, size_t index, unsigned short &value) override;
|
||||
void read_value(const char *id, size_t index, unsigned int &value) override;
|
||||
void read_value(const char *id, size_t index, unsigned long &value) override;
|
||||
void read_value(const char *id, size_t index, unsigned long long int &value) override;
|
||||
void read_value(const char *id, size_t index, bool &value) override;
|
||||
void read_value(const char *id, size_t index, float &value) override;
|
||||
void read_value(const char *id, size_t index, double &value) override;
|
||||
void read_value(const char *id, size_t index, char *value, size_t s) override;
|
||||
void read_value(const char *id, size_t index, std::string &value) override;
|
||||
void read_value(const char *id, size_t index, std::string &value, size_t s) override;
|
||||
|
||||
private:
|
||||
PGresult *result_{};
|
||||
|
||||
|
|
|
|||
|
|
@ -32,4 +32,106 @@ bool postgres_result_reader::fetch()
|
|||
return ++row_index_ < row_count_;
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, char &value)
|
||||
{
|
||||
sql::to_value(value, PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index)));
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, short &value)
|
||||
{
|
||||
sql::to_value(value, PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index)));
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, int &value)
|
||||
{
|
||||
sql::to_value(value, PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index)));
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, long &value)
|
||||
{
|
||||
sql::to_value(value, PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index)));
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, long long int &value)
|
||||
{
|
||||
sql::to_value(value, PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index)));
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, unsigned char &value)
|
||||
{
|
||||
sql::to_value(value, PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index)));
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, unsigned short &value)
|
||||
{
|
||||
sql::to_value(value, PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index)));
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, unsigned int &value)
|
||||
{
|
||||
sql::to_value(value, PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index)));
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, unsigned long &value)
|
||||
{
|
||||
sql::to_value(value, PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index)));
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, unsigned long long int &value)
|
||||
{
|
||||
sql::to_value(value, PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index)));
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, bool &value)
|
||||
{
|
||||
sql::to_value(value, PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index)));
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, float &value)
|
||||
{
|
||||
sql::to_value(value, PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index)));
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, double &value)
|
||||
{
|
||||
sql::to_value(value, PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index)));
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, char *value, size_t s)
|
||||
{
|
||||
auto *val = PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index));
|
||||
|
||||
size_t len = strlen(value);
|
||||
if (len > (size_t)s) {
|
||||
#ifdef _MSC_VER
|
||||
strncpy_s(val, s, value, s);
|
||||
#else
|
||||
strncpy(val, value, s);
|
||||
#endif
|
||||
val[s-1] = '\n';
|
||||
} else {
|
||||
#ifdef _MSC_VER
|
||||
strcpy_s(val, s, value);
|
||||
#else
|
||||
strcpy(val, value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, std::string &value)
|
||||
{
|
||||
auto *val = PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index));
|
||||
if (strlen(val) != 0) {
|
||||
value.assign(val);
|
||||
}
|
||||
}
|
||||
|
||||
void postgres_result_reader::read_value(const char *id, size_t index, std::string &value, size_t s)
|
||||
{
|
||||
auto *val = PQgetvalue(result_, static_cast<int>(row_index_), static_cast<int>(index));
|
||||
if (strlen(val) != 0) {
|
||||
value.assign(val);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -17,11 +17,28 @@ public:
|
|||
sqlite_result_reader(rows result, size_t column_count);
|
||||
~sqlite_result_reader() override;
|
||||
|
||||
[[nodiscard]] size_t column_count() const override;
|
||||
size_t column_count() const override;
|
||||
|
||||
[[nodiscard]] const char* column(size_t index) const override;
|
||||
[[nodiscard]] bool fetch() override;
|
||||
|
||||
void read_value(const char *id, size_t index, char &value) override;
|
||||
void read_value(const char *id, size_t index, short &value) override;
|
||||
void read_value(const char *id, size_t index, int &value) override;
|
||||
void read_value(const char *id, size_t index, long &value) override;
|
||||
void read_value(const char *id, size_t index, long long int &value) override;
|
||||
void read_value(const char *id, size_t index, unsigned char &value) override;
|
||||
void read_value(const char *id, size_t index, unsigned short &value) override;
|
||||
void read_value(const char *id, size_t index, unsigned int &value) override;
|
||||
void read_value(const char *id, size_t index, unsigned long &value) override;
|
||||
void read_value(const char *id, size_t index, unsigned long long int &value) override;
|
||||
void read_value(const char *id, size_t index, bool &value) override;
|
||||
void read_value(const char *id, size_t index, float &value) override;
|
||||
void read_value(const char *id, size_t index, double &value) override;
|
||||
void read_value(const char *id, size_t index, char *value, size_t size) override;
|
||||
void read_value(const char *id, size_t index, std::string &value) override;
|
||||
void read_value(const char *id, size_t index, std::string &value, size_t s) override;
|
||||
|
||||
private:
|
||||
rows result_;
|
||||
long long row_index_ = -1;
|
||||
|
|
|
|||
|
|
@ -34,4 +34,99 @@ bool sqlite_result_reader::fetch()
|
|||
return ++row_index_ < result_.size();
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, char &value)
|
||||
{
|
||||
sql::to_value(value, result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, short &value)
|
||||
{
|
||||
sql::to_value(value, result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, int &value)
|
||||
{
|
||||
sql::to_value(value, result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, long &value)
|
||||
{
|
||||
sql::to_value(value, result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, long long int &value)
|
||||
{
|
||||
sql::to_value(value, result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, unsigned char &value)
|
||||
{
|
||||
sql::to_value(value, result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, unsigned short &value)
|
||||
{
|
||||
sql::to_value(value, result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, unsigned int &value)
|
||||
{
|
||||
sql::to_value(value, result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, unsigned long &value)
|
||||
{
|
||||
sql::to_value(value, result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, unsigned long long int &value)
|
||||
{
|
||||
sql::to_value(value, result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, bool &value)
|
||||
{
|
||||
sql::to_value(value, result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, float &value)
|
||||
{
|
||||
sql::to_value(value, result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, double &value)
|
||||
{
|
||||
sql::to_value(value, result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, char *value, size_t size)
|
||||
{
|
||||
auto val = result_[row_index_][index];
|
||||
size_t len = strlen(val);
|
||||
if (len > size) {
|
||||
#ifdef _MSC_VER
|
||||
strncpy_s(value, size, val, len);
|
||||
#else
|
||||
strncpy(value, val, size);
|
||||
#endif
|
||||
value[size-1] = '\n';
|
||||
} else {
|
||||
#ifdef _MSC_VER
|
||||
strcpy_s(value, size, val);
|
||||
#else
|
||||
strcpy(value, val);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, std::string &value)
|
||||
{
|
||||
value.assign(result_[row_index_][index]);
|
||||
}
|
||||
|
||||
void sqlite_result_reader::read_value(const char *id, size_t index, std::string &value, size_t s)
|
||||
{
|
||||
value.assign(result_[row_index_][index]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -5,7 +5,6 @@
|
|||
#include <queue>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace matador::sql {
|
||||
|
|
@ -13,98 +12,64 @@ namespace matador::sql {
|
|||
template < class Connection >
|
||||
class connection_pool;
|
||||
|
||||
template < class Connection >
|
||||
using IdConnection = std::pair<size_t, Connection>;
|
||||
|
||||
template < class Connection >
|
||||
class connection_ptr
|
||||
{
|
||||
public:
|
||||
connection_ptr(IdConnection<Connection> *c, connection_pool<Connection> &pool)
|
||||
connection_ptr(Connection *c, connection_pool<Connection> &pool)
|
||||
: connection_(c), pool_(pool) {}
|
||||
~connection_ptr();
|
||||
connection_ptr(const connection_ptr &) = delete;
|
||||
connection_ptr& operator=(const connection_ptr &) = delete;
|
||||
connection_ptr(connection_ptr &&x) noexcept
|
||||
: connection_(x.connection_)
|
||||
, pool_(x.pool_)
|
||||
{
|
||||
x.connection_ = nullptr;
|
||||
}
|
||||
connection_ptr& operator=(connection_ptr &&x) noexcept
|
||||
{
|
||||
if (this == &x) {
|
||||
return *this;
|
||||
}
|
||||
connection_ = x.connection_;
|
||||
pool_ = x.pool_;
|
||||
x.connection_ = nullptr;
|
||||
connection_ptr(connection_ptr &&) noexcept = default;
|
||||
connection_ptr& operator=(connection_ptr &&) noexcept = default;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Connection* operator->() { return &connection_->second; }
|
||||
Connection& operator*() { return connection_->second; }
|
||||
|
||||
[[nodiscard]] size_t id() const { return connection_->first; }
|
||||
Connection* operator->() { return connection_; }
|
||||
Connection& operator*() { return *connection_; }
|
||||
|
||||
[[nodiscard]] bool valid() const { return connection_ != nullptr; }
|
||||
|
||||
private:
|
||||
friend class connection_pool<Connection>;
|
||||
|
||||
IdConnection<Connection> *connection_;
|
||||
Connection *connection_;
|
||||
connection_pool<Connection> &pool_;
|
||||
};
|
||||
|
||||
template < class Connection >
|
||||
class connection_pool
|
||||
{
|
||||
public:
|
||||
using connection_pointer = connection_ptr<Connection>;
|
||||
|
||||
public:
|
||||
connection_pool(const std::string &dns, unsigned int count)
|
||||
: info_(connection_info::parse(dns)) {
|
||||
connection_repo_.reserve(count);
|
||||
for (auto i = 0U; i < count; ++i) {
|
||||
connection_repo_.emplace_back(i+1, info_);
|
||||
auto &conn = connection_repo_.back();
|
||||
idle_connections_.emplace(conn.first, &conn);
|
||||
conn.second.open();
|
||||
connection_repo_.emplace_back(info_);
|
||||
idle_connections_.push(&connection_repo_.back());
|
||||
idle_connections_.back()->open();
|
||||
}
|
||||
}
|
||||
|
||||
connection_ptr<Connection> acquire() {
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
std::lock_guard<std::mutex> guard(mutex_);
|
||||
if (idle_connections_.empty()) {
|
||||
return {nullptr, *this};
|
||||
}
|
||||
|
||||
|
||||
pointer next_connection{nullptr};
|
||||
for (auto &item : idle_connections_) {
|
||||
next_connection = item.second;
|
||||
auto node = idle_connections_.extract(item.first);
|
||||
inuse_connections_.insert(std::move(node));
|
||||
break;
|
||||
}
|
||||
return {next_connection, *this};
|
||||
auto ptr = idle_connections_.front();
|
||||
idle_connections_.pop();
|
||||
inuse_connections_.insert(ptr);
|
||||
return { ptr, *this };
|
||||
}
|
||||
|
||||
connection_ptr<Connection> acquire(size_t id) {
|
||||
std::lock_guard<std::mutex> guard(mutex_);
|
||||
return {nullptr, *this};
|
||||
}
|
||||
|
||||
void release(IdConnection<Connection> *c) {
|
||||
void release(Connection *c) {
|
||||
if (c == nullptr) {
|
||||
return;
|
||||
}
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
if (auto it = inuse_connections_.find(c->first); it != inuse_connections_.end()) {
|
||||
auto node = inuse_connections_.extract(it);
|
||||
idle_connections_.insert(std::move(node));
|
||||
std::lock_guard<std::mutex> guard(mutex_);
|
||||
|
||||
if (inuse_connections_.erase(c) > 0) {
|
||||
idle_connections_.push(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -128,14 +93,12 @@ public:
|
|||
}
|
||||
private:
|
||||
mutable std::mutex mutex_;
|
||||
std::vector<IdConnection<Connection>> connection_repo_;
|
||||
using pointer = IdConnection<Connection>*;
|
||||
std::vector<Connection> connection_repo_;
|
||||
using pointer = Connection*;
|
||||
using connections = std::queue<pointer>;
|
||||
using connection_map = std::unordered_map<size_t, pointer>;
|
||||
using connection_set = std::unordered_set<pointer>;
|
||||
// connections idle_connections_;
|
||||
connection_map inuse_connections_;
|
||||
connection_map idle_connections_;
|
||||
connections idle_connections_;
|
||||
connection_set inuse_connections_;
|
||||
|
||||
const connection_info info_;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,24 +15,24 @@ public:
|
|||
[[nodiscard]] virtual const char* column(size_t index) const = 0;
|
||||
[[nodiscard]] virtual bool fetch() = 0;
|
||||
|
||||
virtual void read_value(const char *id, size_t index, char &value);
|
||||
virtual void read_value(const char *id, size_t index, short &value);
|
||||
virtual void read_value(const char *id, size_t index, int &value);
|
||||
virtual void read_value(const char *id, size_t index, long &value);
|
||||
virtual void read_value(const char *id, size_t index, long long &value);
|
||||
virtual void read_value(const char *id, size_t index, unsigned char &value);
|
||||
virtual void read_value(const char *id, size_t index, unsigned short &value);
|
||||
virtual void read_value(const char *id, size_t index, unsigned int &value);
|
||||
virtual void read_value(const char *id, size_t index, unsigned long &value);
|
||||
virtual void read_value(const char *id, size_t index, unsigned long long &value);
|
||||
virtual void read_value(const char *id, size_t index, bool &value);
|
||||
virtual void read_value(const char *id, size_t index, float &value);
|
||||
virtual void read_value(const char *id, size_t index, double &value);
|
||||
// virtual void read_value(const char *id, size_t index, matador::time &value);
|
||||
// virtual void read_value(const char *id, size_t index, matador::date &value);
|
||||
virtual void read_value(const char *id, size_t index, char *value, size_t s);
|
||||
virtual void read_value(const char *id, size_t index, std::string &value);
|
||||
virtual void read_value(const char *id, size_t index, std::string &value, size_t s);
|
||||
virtual void read_value(const char *id, size_t index, char &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, short &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, int &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, long &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, long long &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, unsigned char &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, unsigned short &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, unsigned int &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, unsigned long &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, unsigned long long &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, bool &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, float &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, double &value) = 0;
|
||||
// virtual void read_value(const char *id, size_t index, matador::time &value) = 0;
|
||||
// virtual void read_value(const char *id, size_t index, matador::date &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, char *value, size_t s) = 0;
|
||||
virtual void read_value(const char *id, size_t index, std::string &value) = 0;
|
||||
virtual void read_value(const char *id, size_t index, std::string &value, size_t s) = 0;
|
||||
virtual void read_value(const char *id, size_t index, any_type &value, data_type_t type, size_t size);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,101 +3,6 @@
|
|||
|
||||
namespace matador::sql {
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, char &value)
|
||||
{
|
||||
sql::to_value(value, column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, short &value)
|
||||
{
|
||||
sql::to_value(value, column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, int &value)
|
||||
{
|
||||
sql::to_value(value, column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, long &value)
|
||||
{
|
||||
sql::to_value(value, column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, long long int &value)
|
||||
{
|
||||
sql::to_value(value, column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, unsigned char &value)
|
||||
{
|
||||
sql::to_value(value, column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, unsigned short &value)
|
||||
{
|
||||
sql::to_value(value, column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, unsigned int &value)
|
||||
{
|
||||
sql::to_value(value, column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, unsigned long &value)
|
||||
{
|
||||
sql::to_value(value, column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, unsigned long long int &value)
|
||||
{
|
||||
sql::to_value(value, column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, bool &value)
|
||||
{
|
||||
sql::to_value(value, column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, float &value)
|
||||
{
|
||||
sql::to_value(value, column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, double &value)
|
||||
{
|
||||
sql::to_value(value, column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, char *value, size_t size)
|
||||
{
|
||||
auto val = column(index);
|
||||
size_t len = strlen(val);
|
||||
if (len > size) {
|
||||
#ifdef _MSC_VER
|
||||
strncpy_s(value, size, val, len);
|
||||
#else
|
||||
strncpy(value, val, size);
|
||||
#endif
|
||||
value[size-1] = '\n';
|
||||
} else {
|
||||
#ifdef _MSC_VER
|
||||
strcpy_s(value, size, val);
|
||||
#else
|
||||
strcpy(value, val);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, std::string &value)
|
||||
{
|
||||
value.assign(column(index));
|
||||
}
|
||||
|
||||
void query_result_reader::read_value(const char *id, size_t index, std::string &value, size_t s)
|
||||
{
|
||||
value.assign(column(index));
|
||||
}
|
||||
|
||||
template < typename Type >
|
||||
void convert(const char *valstr, sql::any_type &value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ TEST_CASE("Create connection pool", "[connection pool]") {
|
|||
|
||||
auto ptr = pool.acquire();
|
||||
REQUIRE(ptr.valid());
|
||||
REQUIRE(ptr.id() > 0);
|
||||
REQUIRE(ptr->is_open());
|
||||
// REQUIRE(!ptr->dns().empty());
|
||||
|
||||
REQUIRE(pool.idle() == 3);
|
||||
REQUIRE(pool.inuse() == 1);
|
||||
|
|
@ -31,6 +31,7 @@ TEST_CASE("Create connection pool", "[connection pool]") {
|
|||
auto ptr2 = pool.acquire();
|
||||
REQUIRE(ptr2.valid());
|
||||
REQUIRE(ptr2->is_open());
|
||||
// REQUIRE(!ptr2->dns().empty());
|
||||
|
||||
REQUIRE(pool.idle() == 3);
|
||||
REQUIRE(pool.inuse() == 1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue