[odb-users] incomplete types for query/result
M at trixX
matrixx at underald.net
Wed May 8 04:51:07 EDT 2013
Hello,
I'm trying to access DB with ODB by following the manual example
(http://www.codesynthesis.com/products/odb/doc/manual.xhtml#2.5), but I've
been unsuccesfull for days...
The load() function works, as expected, but when I try query, I allways got a
lot of error messages from compiler about incomplete types result and query.
I don't know, what I'm doing wrong. Am I missing something?
my code (from file dbs1widget.cpp:
---
#include "dbs1widget.h"
#include <odb/core.hxx>
#include <odb/database.hxx>
#include <odb/transaction.hxx>
#include <odb/result.hxx>
#include <odb/mysql/database.hxx>
#include "vozidlo.h"
#include "vozidlo-odb.hxx"
...
...
void dbs1Widget::zobrazVozidla()
{
typedef odb::query<vozidlo> query;
typedef odb::result<vozidlo> result;
using namespace std;
using namespace odb::core;
try {
transaction t (db->begin ());
result r (db->query<vozidlo> (query::typ > 30));
for (result::iterator i (r.begin ()); i != r.end (); ++i)
{
cout << "Hello, " << voz->TypVozidla() << "!" << endl;
}
t.commit ();
}
catch (const odb::exception& e)
{
cerr << e.what () << endl;
//return 1;
}
}
---
and errors from compiler:
---
/usr/libexec/odb/i686-linux-gnu/include/odb/query.hxx:104:10: instantiated
from 'odb::query_selector<vozidlo, (odb::database_id)5u>'
/home/matrixx/skoal/dbs1/src/dbs1widget.cpp:49:28: instantiated from here
/usr/libexec/odb/i686-linux-gnu/include/odb/query.hxx:89:65: error: no type
named 'query_base_type' in 'struct odb::object_traits_impl<vozidlo,
(odb::database_id)5u>'
/home/matrixx/skoal/dbs1/src/dbs1widget.cpp:49:28: error: template argument 2
is invalid
/home/matrixx/skoal/dbs1/src/dbs1widget.cpp:49:35: error: invalid type in
declaration before ';' token
/home/matrixx/skoal/dbs1/src/dbs1widget.cpp:56:17: instantiated from here
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:75:9: error: invalid
use of incomplete type 'struct odb::result_base<vozidlo, (odb::class_kind)
0u>'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:53:9: error:
declaration of 'struct odb::result_base<vozidlo, (odb::class_kind)0u>'
/home/matrixx/skoal/dbs1/src/dbs1widget.cpp:56:17: instantiated from here
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:82:39: error: invalid
use of incomplete type 'struct odb::result_base<vozidlo, (odb::class_kind)
0u>'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:53:9: error:
declaration of 'struct odb::result_base<vozidlo, (odb::class_kind)0u>'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:93:45: error: invalid
use of incomplete type 'struct odb::result_base<vozidlo, (odb::class_kind)
0u>'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:53:9: error:
declaration of 'struct odb::result_base<vozidlo, (odb::class_kind)0u>'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:101:5: error: invalid
use of incomplete type 'struct odb::result_base<vozidlo, (odb::class_kind)
0u>'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:53:9: error:
declaration of 'struct odb::result_base<vozidlo, (odb::class_kind)0u>'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:215:43: error: invalid
use of incomplete type 'struct odb::result_base<vozidlo, (odb::class_kind)
0u>'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:53:9: error:
declaration of 'struct odb::result_base<vozidlo, (odb::class_kind)0u>'
/home/matrixx/skoal/dbs1/src/dbs1widget.cpp:56:37: error: 'query' is not a
class or namespace
/home/matrixx/skoal/dbs1/src/dbs1widget.cpp:58:32: error:
variable 'odb::result<vozidlo>::iterator i' has initializer but incomplete
type
/home/matrixx/skoal/dbs1/src/dbs1widget.cpp:58:41: error: invalid use of
incomplete type 'odb::result<vozidlo>::iterator {aka struct
odb::result_iterator<vozidlo, (odb::class_kind)0u>}'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:56:9: error:
declaration of 'odb::result<vozidlo>::iterator {aka struct
odb::result_iterator<vozidlo, (odb::class_kind)0u>}'
/home/matrixx/skoal/dbs1/src/dbs1widget.cpp:58:57: error: invalid use of
incomplete type 'odb::result<vozidlo>::iterator {aka struct
odb::result_iterator<vozidlo, (odb::class_kind)0u>}'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:56:9: error:
declaration of 'odb::result<vozidlo>::iterator {aka struct
odb::result_iterator<vozidlo, (odb::class_kind)0u>}'
/home/matrixx/skoal/dbs1/src/dbs1widget.cpp:58:41: instantiated from here
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:167:5: error: return
type 'odb::result<vozidlo>::iterator {aka struct
odb::result_iterator<vozidlo, (odb::class_kind)0u>}' is incomplete
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:169:7: error: using
invalid field 'odb::result<T>::impl_'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:170:9: error: using
invalid field 'odb::result<T>::impl_'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:172:36: error: using
invalid field 'odb::result<T>::impl_'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:172:36: error: invalid
use of incomplete type 'odb::result<vozidlo>::iterator {aka struct
odb::result_iterator<vozidlo, (odb::class_kind)0u>}'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:56:9: error:
declaration of 'odb::result<vozidlo>::iterator {aka struct
odb::result_iterator<vozidlo, (odb::class_kind)0u>}'
/home/matrixx/skoal/dbs1/src/dbs1widget.cpp:58:57: instantiated from here
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:176:5: error: return
type 'odb::result<vozidlo>::iterator {aka struct
odb::result_iterator<vozidlo, (odb::class_kind)0u>}' is incomplete
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:178:24: error: invalid
use of incomplete type 'odb::result<vozidlo>::iterator {aka struct
odb::result_iterator<vozidlo, (odb::class_kind)0u>}'
/usr/libexec/odb/i686-linux-gnu/include/odb/result.hxx:56:9: error:
declaration of 'odb::result<vozidlo>::iterator {aka struct
odb::result_iterator<vozidlo, (odb::class_kind)0u>}'
---
What are those "(odb::database_id)5u", "(odb::class_kind)0u" ?
Am I forgetting to include something? Or what Am I doing wrong?
I'll appreciate any hints for this.
More information about the odb-users
mailing list