aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-09-19 11:11:35 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-09-19 11:11:35 +0200
commitf2d85ec8bb5ab5ba11f43de8c4334b6b8412a045 (patch)
tree67dfcdb2d366638fdd6908de211147c0a55baebd
parent02aed5f059797cd5e53a9fe6dde13714f86332d4 (diff)
Add assertion for mismatch of result set column count in MySQL and SQLite
This is useful for detecting native views that happened to have stray data members. Also update comment in PostgreSQL.
-rw-r--r--odb/sqlite/statement.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/odb/sqlite/statement.cxx b/odb/sqlite/statement.cxx
index 6417b3a..9071f68 100644
--- a/odb/sqlite/statement.cxx
+++ b/odb/sqlite/statement.cxx
@@ -114,6 +114,13 @@ namespace odb
bool statement::
bind_result (const bind* p, size_t n, bool truncated)
{
+ // Make sure that the number of columns in the result returned by
+ // the database matches the number that we expect. A common cause
+ // of this assertion is a native view with a number of data members
+ // not matching the number of columns in the SELECT-list.
+ //
+ assert (static_cast<size_t> (sqlite3_data_count (stmt_)) == n);
+
bool r (true);
for (size_t i (0); i < n; ++i)