mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 21:04:15 +08:00
Untab everything and improve formatting
This commit is contained in:
parent
1987614bfe
commit
628b0bbaff
@ -71,7 +71,7 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::chrono::seconds revalidate_interval;
|
std::chrono::seconds revalidate_interval;
|
||||||
std::unordered_map<void*,std::chrono::time_point<std::chrono::system_clock>> last_checked;
|
std::unordered_map<void*, std::chrono::time_point<std::chrono::system_clock>> last_checked;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
periodic(const std::chrono::seconds r = 28800s) //default wait_timeout in MySQL
|
periodic(const std::chrono::seconds r = 28800s) //default wait_timeout in MySQL
|
||||||
@ -111,7 +111,7 @@ namespace sqlpp
|
|||||||
void deregister(Connection* con)
|
void deregister(Connection* con)
|
||||||
{
|
{
|
||||||
auto itr = last_checked.find(con);
|
auto itr = last_checked.find(con);
|
||||||
if(itr != last_checked.end())
|
if (itr != last_checked.end())
|
||||||
{
|
{
|
||||||
last_checked.erase(itr);
|
last_checked.erase(itr);
|
||||||
}
|
}
|
||||||
@ -174,7 +174,8 @@ namespace sqlpp
|
|||||||
connection_pool& operator=(const connection_pool&) = delete;
|
connection_pool& operator=(const connection_pool&) = delete;
|
||||||
connection_pool& operator=(connection_pool&&) = delete;
|
connection_pool& operator=(connection_pool&&) = delete;
|
||||||
|
|
||||||
pool_connection<Connection_config, Connection_validator, Connection> get_connection()
|
auto get_connection()
|
||||||
|
-> pool_connection<Connection_config, Connection_validator, Connection>
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(connection_pool_mutex);
|
std::lock_guard<std::mutex> lock(connection_pool_mutex);
|
||||||
while (true)
|
while (true)
|
||||||
@ -219,16 +220,15 @@ namespace sqlpp
|
|||||||
template<typename Query>
|
template<typename Query>
|
||||||
void operator()(Query query)
|
void operator()(Query query)
|
||||||
{
|
{
|
||||||
operator()(query, [](){});
|
operator()(query, []() {});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Connection_config,
|
template<typename Connection_config,
|
||||||
typename Connection_validator = connection_validator::automatic,
|
typename Connection_validator = connection_validator::automatic,
|
||||||
typename Connection = typename std::enable_if<std::is_class<Connection_config::connection>::value,Connection_config::connection>::type>
|
typename Connection = typename std::enable_if<std::is_class<Connection_config::connection>::value, Connection_config::connection>::type>
|
||||||
connection_pool<Connection_config, Connection_validator, Connection> make_connection_pool(
|
auto make_connection_pool(const std::shared_ptr<Connection_config>& config, size_t max_pool_size)
|
||||||
const std::shared_ptr<Connection_config>& config,
|
-> connection_pool<Connection_config, Connection_validator, Connection>
|
||||||
size_t max_pool_size)
|
|
||||||
{
|
{
|
||||||
return connection_pool<Connection_config, Connection_validator, Connection>(config, max_pool_size);
|
return connection_pool<Connection_config, Connection_validator, Connection>(config, max_pool_size);
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,13 @@ namespace sqlpp
|
|||||||
Connection_pool* origin;
|
Connection_pool* origin;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
pool_connection() : _impl(nullptr), origin(nullptr) {}
|
pool_connection() : _impl(nullptr), origin(nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
pool_connection(std::unique_ptr<Connection>& connection, Connection_pool* origin)
|
pool_connection(std::unique_ptr<Connection>& connection, Connection_pool* origin) : _impl(std::move(connection)), origin(origin)
|
||||||
: _impl(std::move(connection)), origin(origin) {}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
~pool_connection()
|
~pool_connection()
|
||||||
{
|
{
|
||||||
@ -79,8 +82,9 @@ namespace sqlpp
|
|||||||
}
|
}
|
||||||
|
|
||||||
pool_connection(const pool_connection&) = delete;
|
pool_connection(const pool_connection&) = delete;
|
||||||
pool_connection(pool_connection&& other)
|
pool_connection(pool_connection&& other) : _impl(std::move(other._impl)), origin(other.origin)
|
||||||
: _impl(std::move(other._impl)), origin(other.origin) {}
|
{
|
||||||
|
}
|
||||||
pool_connection& operator=(const pool_connection&) = delete;
|
pool_connection& operator=(const pool_connection&) = delete;
|
||||||
pool_connection& operator=(pool_connection&& other)
|
pool_connection& operator=(pool_connection&& other)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user