Skip to content
This repository has been archived by the owner on Dec 18, 2021. It is now read-only.

best practice for managing db connection? #11

Closed
JamesXiao opened this issue Apr 11, 2016 · 2 comments
Closed

best practice for managing db connection? #11

JamesXiao opened this issue Apr 11, 2016 · 2 comments

Comments

@JamesXiao
Copy link

Dear:
The sample code on the project page shows a way to init a db connection

    auto config = std::make_shared<mysql::connection_config>();
    config->user = "root";
    config->database = "sqlpp_mysql";
    config->debug = true;
    mysql::connection db(config);

I am wondering if this is the standard way of calling this lib in real projects?
How can I address the issue of database connection pool for better resource reusing while using the sqlpp11-mysql-connector?

@rbock
Copy link
Owner

rbock commented Apr 11, 2016

Dear James,

As of now, you have to write the connection pool yourself. I haven't gotten to it yet. I think I would store the connections as unique_ptr and move those out of and back into the pool via RAII.

Contributions welcome, of course :-)

Best,

Roland

@iriselia
Copy link

iriselia commented Apr 4, 2017

Hi James,

Roland, Erroneous1, and I have been working on an experimental connection_pool recently. There is currently no documentation for it but it has been pushed to the master branch. rbock/sqlpp11#155

@rbock rbock closed this as completed Dec 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants