Connection pools (#499)

Add support for connection pooling

* Add support for connection pooling to the core code.
* Add support for PostgreSQL connection pooling with tests.
* Add support for SQLite3 connection pooling with tests.
* Add support for MySQL connection pooling with tests.
This commit is contained in:
MeanSquaredError
2023-07-17 07:14:23 +03:00
committed by GitHub
parent a50d719364
commit dff8c23b22
46 changed files with 1551 additions and 443 deletions

View File

@@ -23,6 +23,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "make_test_connection.h"
#include "TabSample.h"
#include <sqlpp11/mysql/mysql.h>
#include <sqlpp11/sqlpp11.h>
@@ -36,23 +37,10 @@ namespace sql = sqlpp::mysql;
int Update(int, char*[])
{
auto config = std::make_shared<sql::connection_config>();
config->user = "root";
config->database = "sqlpp_mysql";
config->debug = true;
sql::global_library_init();
try
{
sql::connection db(config);
}
catch (const sqlpp::exception& e)
{
std::cerr << "For testing, you'll need to create a database sqlpp_mysql for user root (no password)" << std::endl;
std::cerr << e.what() << std::endl;
return 1;
}
try
{
sql::connection db(config);
auto db = sql::make_test_connection();
db.execute(R"(DROP TABLE IF EXISTS tab_sample)");
db.execute(R"(CREATE TABLE tab_sample (
alpha bigint(20) AUTO_INCREMENT,