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:
parent
d15a6ee1a3
commit
50c6b29920
@ -44,7 +44,7 @@ namespace sqlpp
|
|||||||
struct automatic
|
struct automatic
|
||||||
{
|
{
|
||||||
template<typename Connection>
|
template<typename Connection>
|
||||||
bool validate(Connection* connection)
|
void validate(Connection* connection)
|
||||||
{
|
{
|
||||||
if (!connection->is_valid())
|
if (!connection->is_valid())
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
connection->reconnect();
|
connection->reconnect();
|
||||||
}
|
}
|
||||||
catch (const sqlpp::exception& e)
|
catch (const sqlpp::exception&)
|
||||||
{
|
{
|
||||||
throw sqlpp::exception("Failed to reconnect to database.");
|
throw sqlpp::exception("Failed to reconnect to database.");
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ namespace sqlpp
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const sqlpp::exception& e)
|
catch (const sqlpp::exception&)
|
||||||
{
|
{
|
||||||
throw sqlpp::exception("Failed to retrieve a valid connection.");
|
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);
|
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.");
|
throw sqlpp::exception("Failed to spawn a new connection.");
|
||||||
}
|
}
|
||||||
|
@ -44,9 +44,12 @@ namespace sqlpp
|
|||||||
: _impl(std::move(connection)), origin(origin) {}
|
: _impl(std::move(connection)), origin(origin) {}
|
||||||
|
|
||||||
~pool_connection()
|
~pool_connection()
|
||||||
|
{
|
||||||
|
if (_impl.get())
|
||||||
{
|
{
|
||||||
origin->free_connection(_impl);
|
origin->free_connection(_impl);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
auto operator()(Args&&... args) -> decltype(_impl->args(std::forward<Args>(args)...))
|
auto operator()(Args&&... args) -> decltype(_impl->args(std::forward<Args>(args)...))
|
||||||
@ -81,7 +84,10 @@ namespace sqlpp
|
|||||||
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&&) = delete;
|
pool_connection& operator=(pool_connection&& other)
|
||||||
|
{
|
||||||
|
_impl(std::move(other._impl)), origin(other.origin);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user