On 27 March 2013 12:30, Krzysztof Bieleń <[email protected]> wrote: > W dniu 2013-03-27 12:35, Mateusz Loskot pisze: >> The trick is that implementing session::is_connected with consistent >> semantic across variety of backends is not easy, it may be impossible. >> For example, function PQstatus check only state cached by libpq >> library: 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 > > Yes, I'm aware of this. Teoretically I saw people using query like > "SELECT 1" for purpose of checking connection state. Maybe it will be > sufficient solution for default 'is_connected()' for all backends.
There is even PQping, but I'm not sure if silently sampling server over network is best approach, I've seen it criticised on pgsql- mailing lists. > I will try to read more about this and how it should be done. Thanks, I haven't researched it deeply myself, so I'd like to stand corrected. >>> 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 :)) > > Yes, I thought about this. But lately I'm out of of time so I decided to > write this here along with this topic. Understood. Just so you know, long-running pull requests that we work on with review-update-review iterations are fine. So, don't worry if you have something but incomplete, just push it out :) 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 [email protected] https://lists.sourceforge.net/lists/listinfo/soci-users
