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

Boris Kolpackov boris at codesynthesis.com
Mon Oct 12 09:59:02 EDT 2015


Hi,

MM <finjulhich at gmail.com> writes:

> 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>}’)

You should be able to do:

OQuery::a == criteria.c_str ()

Or:

OQuery::a == OQuery::_val (criteria)

Boris



More information about the odb-users mailing list