[odb-users] query on column of c++ type char[N]

MM finjulhich at gmail.com
Tue Oct 6 02:38:02 EDT 2015


I have an object O with a char[N] member a, that gets mapped to a TEXT
column in sqlite.
I try to run this query:

void f(const std::string& criteria)
  typedef odb::query<O> OQuery;
  O* o = db.query_one<O>( OQuery::a == criteria );

There is a compile error:

no match for ‘operator==’ (operand types are ‘const id_type_ {aka const
odb::sqlite::query_column<char [16], (odb::sqlite::database_type_id)2u>}’
and ‘const string {aka const std::basic_string<char>}’)

Should I provide this overload for operator==? How can I access the value
of a from the query_column object?

Or should I express the query differently?


More information about the odb-users mailing list