[odb-users] invalid use of incomplete type ‘struct odb::query_selector_impl<app_version, (odb::database_id)5u, (odb::class_kind)2u>’
José Silva Monard
josesilvamonard at gmail.com
Fri Jul 1 16:03:13 EDT 2016
Hi, I'm trying to run a custom query (native view) and I am having some
troubles.
I have this structure:
#pragma db view query("SELECT last_installed_id " \
"FROM app_version")
struct app_version
{
#pragma db type("INTEGER")
unsigned long last_installed_id;
};
To use it, I tried something like this :
typedef odb::result<app_version> result;
result r((*db).query<app_version>(true));
But I got a compiler error:
.....
/usr/local/include/odb/query.hxx: In instantiation of ‘struct
odb::query_selector<app_version, (odb::database_id)5u>’:
/usr/local/include/odb/database.hxx:275:5: required by substitution of
‘template<class T> odb::result<T> odb::database::query(const
odb::query<T>&, bool) [with T = app_version]’
/home/user/AppVersion/main.cpp:28:38: required from here
/usr/local/include/odb/query.hxx:104:10: error: invalid use of incomplete
type ‘struct odb::query_selector_impl<app_version, (odb::database_id)5u,
(odb::class_kind)2u>’
struct query_selector: query_selector_impl<T, DB, class_traits<T>::kind>
^
/usr/local/include/odb/query.hxx:84:10: note: declaration of ‘struct
odb::query_selector_impl<app_version, (odb::database_id)5u,
(odb::class_kind)2u>’
struct query_selector_impl;
.....
I have tried with: (*db).query_value(), (*db).query("last_installed_id <> 0").
But the error persists.
I am including following headers:
#include <odb/pgsql/database.hxx>
#include <odb/transaction.hxx>
#include* <odb/core.hxx>
*#include <odb/session.hxx>
I know there are similar questions here but this is a different case,
because I did not run the odb compiler, I do not need to.
I just want the ODB libraries to read data from a table. Actually this is
the only query that I have.
Hope you help me.
Regards.
More information about the odb-users
mailing list