diff options
-rw-r--r-- | odb/mysql/statement.cxx | 11 |
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) |