summaryrefslogtreecommitdiff
path: root/odb/mysql/connection.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-08-10 13:57:24 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-08-10 13:57:24 +0200
commitb49d3e5e0e58e69b4fde856e37f73d101b5b2c0a (patch)
tree92c587949496e21028071ab7ca2202bc5b67f6bb /odb/mysql/connection.hxx
parent0a589394a09ce5b3f16d902d657710a2886cc2fc (diff)
Delay closing statement until there are no active statements
Diffstat (limited to 'odb/mysql/connection.hxx')
-rw-r--r--odb/mysql/connection.hxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/odb/mysql/connection.hxx b/odb/mysql/connection.hxx
index 513abc5..8509790 100644
--- a/odb/mysql/connection.hxx
+++ b/odb/mysql/connection.hxx
@@ -8,6 +8,8 @@
#include <mysql/mysql.h>
+#include <vector>
+
#include <odb/forward.hxx>
#include <odb/shared-ptr.hxx>
@@ -52,17 +54,34 @@ namespace odb
active (statement* s)
{
active_ = s;
+
+ if (s == 0 && stmt_handles_.size () > 0)
+ free_stmt_handles ();
}
+ public:
+ MYSQL_STMT*
+ alloc_stmt_handle ();
+
+ void
+ free_stmt_handle (MYSQL_STMT*);
+
private:
connection (const connection&);
connection& operator= (const connection&);
private:
+ void
+ free_stmt_handles ();
+
+ private:
MYSQL mysql_;
MYSQL* handle_;
statement* active_;
statement_cache_type statement_cache_;
+
+ typedef std::vector<MYSQL_STMT*> stmt_handles;
+ stmt_handles stmt_handles_;
};
}
}