0
0
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:
Frank Park 2017-04-11 14:15:38 -04:00
parent 1987614bfe
commit 628b0bbaff
2 changed files with 224 additions and 220 deletions

View File

@ -71,7 +71,7 @@ namespace sqlpp
{
private:
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:
periodic(const std::chrono::seconds r = 28800s) //default wait_timeout in MySQL
@ -111,7 +111,7 @@ namespace sqlpp
void deregister(Connection* con)
{
auto itr = last_checked.find(con);
if(itr != last_checked.end())
if (itr != last_checked.end())
{
last_checked.erase(itr);
}
@ -174,7 +174,8 @@ namespace sqlpp
connection_pool& operator=(const 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);
while (true)
@ -219,16 +220,15 @@ namespace sqlpp
template<typename Query>
void operator()(Query query)
{
operator()(query, [](){});
operator()(query, []() {});
}
};
template<typename Connection_config,
typename Connection_validator = connection_validator::automatic,
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(
const std::shared_ptr<Connection_config>& config,
size_t max_pool_size)
typename Connection = typename std::enable_if<std::is_class<Connection_config::connection>::value, Connection_config::connection>::type>
auto make_connection_pool(const std::shared_ptr<Connection_config>& config, size_t max_pool_size)
-> connection_pool<Connection_config, Connection_validator, Connection>
{
return connection_pool<Connection_config, Connection_validator, Connection>(config, max_pool_size);
}

View File

@ -41,10 +41,13 @@ namespace sqlpp
Connection_pool* origin;
public:
pool_connection() : _impl(nullptr), origin(nullptr) {}
pool_connection() : _impl(nullptr), origin(nullptr)
{
}
pool_connection(std::unique_ptr<Connection>& connection, Connection_pool* origin)
: _impl(std::move(connection)), origin(origin) {}
pool_connection(std::unique_ptr<Connection>& connection, Connection_pool* origin) : _impl(std::move(connection)), origin(origin)
{
}
~pool_connection()
{
@ -79,8 +82,9 @@ namespace sqlpp
}
pool_connection(const pool_connection&) = delete;
pool_connection(pool_connection&& other)
: _impl(std::move(other._impl)), origin(other.origin) {}
pool_connection(pool_connection&& other) : _impl(std::move(other._impl)), origin(other.origin)
{
}
pool_connection& operator=(const pool_connection&) = delete;
pool_connection& operator=(pool_connection&& other)
{