[odb-users] Assertion fails in mysql/statement.cxx

Scott Deerwester scott.deerwester at gmail.com
Wed Dec 11 11:28:39 EST 2013

Hmm. I *do* have a view defined for the class that's not working. I don't
see the view in the code in the schema for this class, and so the view
hasn't been defined in the database. I define the view after the class in
the same header:

#pragma db value(QString) type("VARCHAR(255)")
#pragma db object
class CodeSet
#pragma db id
    QString key_;		// Identifier

#pragma db view object(CodeSet)
struct codeSetStat {
#pragma db column("count(" + CodeSet::key_ + ")")
    int count;

Do I need to do something special to get the definition for the view?

On Wed, Dec 11, 2013 at 10:43 AM, Boris Kolpackov
<boris at codesynthesis.com>wrote:

> Hi Scott,
> Scott Deerwester <scott.deerwester at gmail.com> writes:
> > I'm receiving the following in a unit test:
> >
> > tst_MyTest: statement.cxx:377: odb::mysql::select_statement::result
> > odb::mysql::select_statement::fetch(bool): Assertion
> > `mysql_stmt_field_count (stmt_) == count' failed.
> The comment just before the assert() explains what it tries to catch:
> // 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.
> Though it seems like you are loading an object so this can't be that.
> > If you need me to, I'll try to write a minimal set of code that
> > demonstrates the problem.
> Yes, that would be very helpful.
> Boris

More information about the odb-users mailing list