diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-02-21 10:42:13 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-02-21 10:42:13 +0200 |
commit | cfc9c1fa3cab07396b38d192da3d0b6bfa36d0f5 (patch) | |
tree | 4070182474950d34f62fe5f2a828e160540753e6 /odb/mysql/connection.hxx | |
parent | 4acabe57939ff37bad0a8aabc5164b6d5add449b (diff) |
Don't reuse failed connections
If MySQL API returns an error indicating the connection is no longer
usable, mark it as failed. In connection_pool_factory free failed
connections instead of returning them to the pool.
Diffstat (limited to 'odb/mysql/connection.hxx')
-rw-r--r-- | odb/mysql/connection.hxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/odb/mysql/connection.hxx b/odb/mysql/connection.hxx index 0310ee6..6704f23 100644 --- a/odb/mysql/connection.hxx +++ b/odb/mysql/connection.hxx @@ -46,6 +46,19 @@ namespace odb } public: + bool + failed () const + { + return failed_; + } + + void + mark_failed () + { + failed_ = true; + } + + public: MYSQL* handle () { @@ -91,6 +104,7 @@ namespace odb private: database_type& db_; + bool failed_; MYSQL mysql_; MYSQL* handle_; |