diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-22 09:21:32 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-22 09:21:32 +0200 |
commit | 0da4b5d62dc10993db4d55236cb175e891a9c62b (patch) | |
tree | 6402eb39a8471415ba5bacb8a15073c59ccba89e | |
parent | b2fcd4dcdeb0f4962f8c8a1ce1a6fd64c2014062 (diff) |
Add --table-prefix option
Assign unique table prefixes to most examples. This makes sure that
we don't end up with broken schemas where half of the tables were
changed by the next test and the other half has foreign keys that
now point to nowhere.
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | boost/makefile | 2 | ||||
-rw-r--r-- | composite/makefile | 2 | ||||
-rw-r--r-- | container/makefile | 3 | ||||
-rw-r--r-- | inheritance/makefile | 2 | ||||
-rw-r--r-- | inverse/makefile | 3 | ||||
-rw-r--r-- | mapping/makefile | 3 | ||||
-rw-r--r-- | qt/makefile | 2 | ||||
-rw-r--r-- | query/makefile | 2 | ||||
-rw-r--r-- | relationship/makefile | 3 | ||||
-rw-r--r-- | schema/embedded/makefile | 2 | ||||
-rw-r--r-- | template/makefile | 3 |
12 files changed, 22 insertions, 11 deletions
@@ -10,6 +10,12 @@ This package contains the ODB examples. The following list gives an overview of the available examples. See the README file accompanying each example for more information. +Note also that most of the examples use the --table-prefix ODB compiler +option to assign a unique prefix to tables created by each example. This +is done to allow examples to run against the same database without +causing any schema conflicts. You don't have to use this option in your +own applications. + hello A "Hello World" example that shows how to use ODB to perform basic database operations. diff --git a/boost/makefile b/boost/makefile index 8ea4996..ae197a5 100644 --- a/boost/makefile +++ b/boost/makefile @@ -60,7 +60,7 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) $(gen) $(dist): export odb_options += --database $(db_id) --profile boost \ ---generate-query --generate-schema +--generate-query --generate-schema --table-prefix boost_ $(gen): cpp_options := -I$(src_base) $(gen): $(odb.l.cpp-options) $(odb_boost.l.cpp-options) $(boost.l.cpp-options) diff --git a/composite/makefile b/composite/makefile index ef87313..8a9c5fc 100644 --- a/composite/makefile +++ b/composite/makefile @@ -47,7 +47,7 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) $(gen) $(dist): export odb_options += --database $(db_id) --generate-schema \ ---generate-query +--generate-query --table-prefix composite_ $(gen): cpp_options := -I$(src_base) $(gen): $(odb.l.cpp-options) diff --git a/container/makefile b/container/makefile index e892bcf..8f4a463 100644 --- a/container/makefile +++ b/container/makefile @@ -46,7 +46,8 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) -$(gen) $(dist): export odb_options += --database $(db_id) --generate-schema +$(gen) $(dist): export odb_options += --database $(db_id) --generate-schema \ +--table-prefix container_ $(gen): cpp_options := -I$(src_base) $(gen): $(odb.l.cpp-options) diff --git a/inheritance/makefile b/inheritance/makefile index 8c3aedc..27e0bc2 100644 --- a/inheritance/makefile +++ b/inheritance/makefile @@ -47,7 +47,7 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) $(gen) $(dist): export odb_options += --database $(db_id) --generate-schema \ ---generate-query +--generate-query --table-prefix inheritance_ $(gen): cpp_options := -I$(src_base) $(gen): $(odb.l.cpp-options) diff --git a/inverse/makefile b/inverse/makefile index 76e967c..bc0c41e 100644 --- a/inverse/makefile +++ b/inverse/makefile @@ -47,7 +47,8 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) $(gen) $(dist): export odb_options += --database $(db_id) --generate-query \ ---generate-schema --default-pointer std::tr1::shared_ptr +--generate-schema --default-pointer std::tr1::shared_ptr \ +--table-prefix inverse_ $(gen): cpp_options := -I$(src_base) $(gen): $(odb.l.cpp-options) diff --git a/mapping/makefile b/mapping/makefile index 1b50fe2..31ffdb2 100644 --- a/mapping/makefile +++ b/mapping/makefile @@ -47,7 +47,8 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) $(gen) $(dist): export odb_options += --database $(db_id) --generate-schema \ ---generate-query --hxx-prologue '\#include "traits.hxx"' +--generate-query --hxx-prologue '\#include "traits.hxx"' \ +--table-prefix mapping_ $(gen): cpp_options := -I$(src_base) $(gen): $(odb.l.cpp-options) diff --git a/qt/makefile b/qt/makefile index 1b7f0ae..fc4a6ef 100644 --- a/qt/makefile +++ b/qt/makefile @@ -56,7 +56,7 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) $(gen) $(dist): export odb_options += --database $(db_id) --profile qt \ ---generate-query --generate-schema +--generate-query --generate-schema --table-prefix Qt $(gen): cpp_options := -I$(src_base) $(gen): $(odb.l.cpp-options) $(odb_qt.l.cpp-options) $(qt_core.l.cpp-options) diff --git a/query/makefile b/query/makefile index 8e4a0dd..2f0b79b 100644 --- a/query/makefile +++ b/query/makefile @@ -47,7 +47,7 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) $(gen) $(dist): export odb_options += --database $(db_id) --generate-schema \ ---generate-query +--generate-query --table-prefix query_ $(gen): cpp_options := -I$(src_base) $(gen): $(odb.l.cpp-options) diff --git a/relationship/makefile b/relationship/makefile index 5b4eb6d..96440be 100644 --- a/relationship/makefile +++ b/relationship/makefile @@ -47,7 +47,8 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) $(gen) $(dist): export odb_options += --database $(db_id) --generate-query \ ---generate-schema --default-pointer std::tr1::shared_ptr +--generate-schema --default-pointer std::tr1::shared_ptr \ +--table-prefix relationship_ $(gen): cpp_options := -I$(src_base) $(gen): $(odb.l.cpp-options) diff --git a/schema/embedded/makefile b/schema/embedded/makefile index 46f1e3c..81baa23 100644 --- a/schema/embedded/makefile +++ b/schema/embedded/makefile @@ -47,7 +47,7 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) $(gen) $(dist): export odb_options += --database $(db_id) --generate-query \ ---generate-schema --schema-format embedded +--generate-schema --schema-format embedded --table-prefix schema_embedded_ $(gen): cpp_options := -I$(src_base) $(gen): $(odb.l.cpp-options) diff --git a/template/makefile b/template/makefile index 17face5..37e1f03 100644 --- a/template/makefile +++ b/template/makefile @@ -46,7 +46,8 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) -$(gen) $(dist): export odb_options += --database $(db_id) --generate-schema +$(gen) $(dist): export odb_options += --database $(db_id) --generate-schema \ +--table-prefix @@CHANGE-THIS_ $(gen): cpp_options := -I$(src_base) $(gen): $(odb.l.cpp-options) |