[odb-users] Nested Vectors of Composite Values

Henning Becker henning.becker at apworks.de
Sun May 22 14:12:18 EDT 2016


Hello everybody,
I'm trying to use the following setup of classes (stripped down to a simple 
example). classes.h:


#pragma db value 
class A {
   std::string first; 
   std::string second; 
   friend class odb::access; 
}; 

#pragma db value 
class B { 
   std::string hello; 
   std::vector<A> a; 
   friend class odb::access; 
}; 

#pragma db object 
class C { 
   #pragma db id 
   std::string name; 
   std::vector<B> b; 
   friend class odb::access; 
};


And I run the following to command, just to generate the SQL database schema:
# odb --database sqlite --generate-schema-only --schema-format sql classes.h

I would have expected, that three tables were generated in classes.sql:
- C
- C_b
- C_b_a

But actually, I get only these two:
CREATE TABLE "C" (
  "name" TEXT NOT NULL PRIMARY KEY);

CREATE TABLE "C_b" (
  "object_id" TEXT NOT NULL,
  "index" INTEGER NOT NULL,
  "value_hello" TEXT NOT NULL,
  CONSTRAINT "object_id_fk"
    FOREIGN KEY ("object_id")
    REFERENCES "C" ("name")
    ON DELETE CASCADE);

What am I doing wrong? What am I missing?

Any ideas?

Thanks,
Henning

-- 
_______________________________________
 
Henning Becker

Development Engineer

AIRBUS APWORKS GmbH
Willy-Messerschmitt-Str. 1
82024 Taufkirchen - Germany 
T: +49 89 60729771  
F: +49 89 60728239  
M: +49 174 9818097  
henning.becker at apworks.de 

AIRBUS APWORKS GmbH
Registered Office: Ottobrunn
District Court of Munich: HRB 141734
Managing Director: Joachim Zettler
Internet: www.apworks.de
_______________________________________



More information about the odb-users mailing list