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
commit55ab9a6844185e48904be6c1e995881a7fe55e8c (patch)
tree22ef584de943f9549d8961f9202f78c312bf8c8a
parentdb71e956ea808569ce1e5bbcabb7e65dc4604ac8 (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/pgsql/statement.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/odb/pgsql/statement.cxx b/odb/pgsql/statement.cxx
index c839e92..671bf61 100644
--- a/odb/pgsql/statement.cxx
+++ b/odb/pgsql/statement.cxx
@@ -180,6 +180,11 @@ namespace odb
bool r (true);
int int_row (static_cast<int> (row));
+ // 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> (PQnfields (result)) == count);
for (int i (0); i < static_cast<int> (count); ++i)