different database backends.
a distinct message/code in case it can't do it.
attempts).
I can provide a patch or a pull request.
Post by isoul ziPost by Krzysztof BieleÅPost by Mateusz LoskotPost by isoul ziNot 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?
Post by Krzysztof BieleÅPost by Mateusz LoskotYou can check if session::get_backend() != nullptr
connection with database isn't broken.
Yes, I sensed that.
I just suggested related test that is currently possible.
Post by Krzysztof BieleÅUse case: long running server which doesn't make many queries to server.
if (!sql.isConnected())
sql.reconect();
// ... do query
It isn't perfect but provides simple pattern for reconnecting when tcp
connection goes out.
Yes, good point.
The trick is that implementing session::is_connected with consistent
semantic across variety of backends is not easy, it may be impossible.
session sql(...)
sql.is_connected() -> CONNECTION_OK
// someone unplugs power cord of the database server
sql.is_connected() -> CONNECTION_OK
There is know way libpq to detect external causes of connection lost
It can detect local causes only.
Unless,something has changed in libpq lately
Post by Krzysztof BieleÅ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.
Good idea, if you would be willing to submit pull request, please do so.
(If it's not a hassle, branch off of 'develop' please into
feature/yourbranch
i.e. feature/pool_auto_reconnect, trying to make us flowed by gitflow :))
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
------------------------------------------------------------------------------
Own the Future-Intel® 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
https://lists.sourceforge.net/lists/listinfo/soci-users