[opendbx] odbx_error_type() issue
Brought to you by:
nose
From: Murray S. K. <ms...@cl...> - 2011-01-12 22:07:27
|
I have an application using opendbx that tries the sequence suggested by the opendbx documentation to do a query; specifically, I have a "get" function that basically does this: err = odbx_query(db, ...); if (err < 0) { if (odbx_error_type(db, err) < 0) { odbx_unbind(db); odbx_finish(db); odbx_init(&db, ...); odbx_bind(db, ...); err = odbx_query(db, ...); if (err < 0) return err; } else { return err; } parse_result(db, ...); } I've got a user reporting that a connection lost to a postgresql server results in an error from our application. The postgresql error we get back is: FATAL: terminating connection due to administrator command A web search suggests this is the result of a deliberate server shutdown. An odbx_query() then, predictably, fails, but should run through the reconnect attempt described above. In a test with MySQL, a first "get" succeeds, then after I terminated and restart MySQL, a second "get" runs through the reconnect logic and the inner odbx_query() then succeeds. In a similar restart-after-query test with postgresql, the "get" returns the above error. I'm waiting for more data from the reporting user but it would appear the fatal error reported by that backend isn't causing odbx_error_type() to return -1, so the reconnect isn't attempted and an error is returned. When I can confirm this I'll follow-up. I also don't yet have the versions of postgresql library or server, or the version of opendbx, in use in this scenario. In the interim, does this ring any bells? Is this a known issue, or am I doing something wrong with my use of the API? Thanks, -MSK |