0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 21:04:15 +08:00
sqlpp11/examples/connection_pool/src/db_connection.cpp

16 lines
336 B
C++
Raw Normal View History

#include <memory>
#include <db_connection.h>
db_connection::pq_conn& db_connection::fetch()
{
if (m_conn_ptr == nullptr)
{
m_conn_ptr = sqlpp::compat::make_unique<pq_conn>(m_pool.get());
}
return *m_conn_ptr;
}
db_connection::db_connection(sqlpp::postgresql::connection_pool& pool) : m_pool{pool}, m_conn_ptr{nullptr}
{
}