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

Fix warnings and minor issues

This commit is contained in:
Frank Park 2017-04-07 14:25:44 -04:00
parent d15a6ee1a3
commit 50c6b29920
2 changed files with 12 additions and 6 deletions

View File

@ -44,7 +44,7 @@ namespace sqlpp
struct automatic
{
template<typename Connection>
bool validate(Connection* connection)
void validate(Connection* connection)
{
if (!connection->is_valid())
{
@ -52,7 +52,7 @@ namespace sqlpp
{
connection->reconnect();
}
catch (const sqlpp::exception& e)
catch (const sqlpp::exception&)
{
throw sqlpp::exception("Failed to reconnect to database.");
}
@ -191,7 +191,7 @@ namespace sqlpp
break;
}
}
catch (const sqlpp::exception& e)
catch (const sqlpp::exception&)
{
throw sqlpp::exception("Failed to retrieve a valid connection.");
}
@ -201,7 +201,7 @@ namespace sqlpp
{
return pool_connection<Connection_config, Connection_validator, Connection>(std::move(std::make_unique<Connection>(config)), this);
}
catch (const sqlpp::exception& e)
catch (const sqlpp::exception&)
{
throw sqlpp::exception("Failed to spawn a new connection.");
}

View File

@ -44,9 +44,12 @@ namespace sqlpp
: _impl(std::move(connection)), origin(origin) {}
~pool_connection()
{
if (_impl.get())
{
origin->free_connection(_impl);
}
}
template<typename... Args>
auto operator()(Args&&... args) -> decltype(_impl->args(std::forward<Args>(args)...))
@ -81,7 +84,10 @@ namespace sqlpp
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&&) = delete;
pool_connection& operator=(pool_connection&& other)
{
_impl(std::move(other._impl)), origin(other.origin);
}
};
}