mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 12:51:13 +08:00
7f04435576
* Add an example of using a connection pool. * Add documentation about the connection pools. Expand the documentation about multi-threading issues.
16 lines
336 B
C++
16 lines
336 B
C++
#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}
|
|
{
|
|
}
|