aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-09-13 11:43:09 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-09-13 11:43:09 +0200
commit6652eb7ffb6dafb877344845ca24e938a50e4bfb (patch)
tree4dbd8db2fedad77bd4130a91c0bb64765463e4b3
parent0b97a1c9de404d7131f3d2fda950e43738a07ca3 (diff)
Handle buffer growth in cached result
-rw-r--r--odb/mysql/statement.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/odb/mysql/statement.cxx b/odb/mysql/statement.cxx
index df1ce03..3e0deb8 100644
--- a/odb/mysql/statement.cxx
+++ b/odb/mysql/statement.cxx
@@ -126,6 +126,17 @@ namespace odb
query_statement::result query_statement::
fetch ()
{
+ // If the result was cached the image can grow between calls
+ // to fetch() as a result of other statements execution.
+ //
+ if (cached_ && image_version_ != image_.version)
+ {
+ if (mysql_stmt_bind_result (stmt_, image_.bind))
+ throw database_exception (stmt_);
+
+ image_version_ = image_.version;
+ }
+
int r (mysql_stmt_fetch (stmt_));
switch (r)