[odb-users] design questions: c++ / python / sqlite

MM finjulhich at gmail.com
Thu Jun 5 13:17:48 EDT 2014


The sql generated looks like:

CREATE TABLE "ABClass" (
  "name" TEXT NOT NULL PRIMARY KEY,
  "typeid" TEXT NOT NULL);

10 other CREATE TABLE, 1 for each derived class.
CREATE TABLE "d1" (
  "name" TEXT NOT NULL PRIMARY KEY,
  CONSTRAINT "name_fk"
    FOREIGN KEY ("name")
    REFERENCES "ABClass" ("name")
    ON DELETE CASCADE);

Is the value of typeid col the name of the derived class?

I am gonna populate this table from python.
would I run for each derived class

INSERT INTO ABClass VALUES( "d1", "d1" ) ?

Do I also need a single row in each derived table?

These tables will be created oneoff and very rarely added to


On 2 June 2014 14:56, Boris Kolpackov <boris at codesynthesis.com> wrote:

> Hi,
>
> MM <finjulhich at gmail.com> writes:
>
> > I assume a query like
> >
> > result r (db->query<ABClass >());
> >
> > would just work and load up all the Ds instances in 1 go?
>
> If you mark ABClass polymorphic, yes.
>
> Boris
>
>


More information about the odb-users mailing list