W dniu 2013-03-27 12:10, Mateusz Loskot pisze:
> On 27 March 2013 11:02, isoul zi <[email protected]> wrote:
>> Not to find in soci functions something like soci :: session :: is_open
>> Bad looking? It really is not? And you only need to catch the exceptions?
> You can check if  session::get_backend() != nullptr

Hi,

I think that @isoul means that there isn't function which checks if tcp
connection with database isn't broken.

Use case: long running server which doesn't make many queries to server.
Before next query it checks if the tcp connection still exists:

if (!sql.isConnected())
    sql.reconect();

// ... do query

It isn't perfect but provides simple pattern for reconnecting when tcp
connection goes out.

Also maybe there should be possibility to create connection_pool with
parameter auto_reconnect = true; which ensures that sessions taken from
connection_pool are connected or it will throw execption.

-- 
Krzysztof Bieleń


------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to