Add connection methods is_connected() and ping_server() (#528)

* Replace connection handle method check_connection() with is_connected() and ping_server()

* When a connections is fetched from a pool perform a validity check which can be one of none, passive or ping.

* Add the methods is_connected() and ping_server() to the connection template class.

* Remove unused #include and add mising #include.

* Add tests for the connection methods is_connected() and ping_server().
This commit is contained in:
MeanSquaredError
2023-09-20 07:38:16 +03:00
committed by GitHub
parent 8d92e7bb81
commit 623b5154d0
15 changed files with 292 additions and 35 deletions
+1 -1
View File
@@ -30,8 +30,8 @@ set(test_files
Basic.cpp
BasicConstConfig.cpp
Blob.cpp
Connection.cpp
ConnectionPool.cpp
Constructor.cpp
Date.cpp
DateTime.cpp
Exceptions.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017, Serge Robyns
* Copyright (c) 2023, Vesselin Atanasov
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -23,13 +24,17 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "../../include/ConnectionTests.h"
#include "make_test_connection.h"
#include <sqlpp11/postgresql/connection.h>
#include <sqlpp11/sqlpp11.h>
namespace sql = sqlpp::postgresql;
int Constructor(int, char*[])
int Connection(int, char*[])
{
sql::connection db;
namespace sql = sqlpp::postgresql;
namespace test = sqlpp::test;
test::test_normal_connection<sql::connection>(sql::make_test_config());
return 0;
}