mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-01-05 20:50:34 -06:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user