aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/access/makefile29
-rw-r--r--common/access/test.hxx2
-rw-r--r--common/auto/makefile29
-rw-r--r--common/blob/makefile29
-rw-r--r--common/callback/driver.cxx1
-rw-r--r--common/callback/makefile29
-rw-r--r--common/changelog/makefile12
-rw-r--r--common/circular/multiple/driver.cxx19
-rw-r--r--common/circular/multiple/makefile28
-rw-r--r--common/circular/single/makefile29
-rw-r--r--common/composite-id/makefile29
-rw-r--r--common/composite/makefile29
-rw-r--r--common/const-member/makefile29
-rw-r--r--common/const-object/makefile29
-rw-r--r--common/container/basics/makefile29
-rw-r--r--common/container/change-tracking/makefile29
-rw-r--r--common/ctor/makefile29
-rw-r--r--common/default/driver.cxx11
-rw-r--r--common/default/makefile29
-rw-r--r--common/definition/makefile29
-rw-r--r--common/enum/makefile29
-rw-r--r--common/erase-query/driver.cxx30
-rw-r--r--common/erase-query/makefile29
-rw-r--r--common/include/makefile20
-rw-r--r--common/index/makefile29
-rw-r--r--common/inheritance/polymorphism/makefile30
-rw-r--r--common/inheritance/reuse/makefile29
-rw-r--r--common/inheritance/transient/makefile29
-rw-r--r--common/inverse/makefile29
-rw-r--r--common/lazy-ptr/makefile29
-rw-r--r--common/lifecycle/makefile29
-rw-r--r--common/makefile14
-rw-r--r--common/no-id/makefile29
-rw-r--r--common/optimistic/makefile29
-rw-r--r--common/pragma/makefile28
-rw-r--r--common/prepared/makefile29
-rw-r--r--common/query/array/driver.cxx34
-rw-r--r--common/query/array/makefile29
-rw-r--r--common/query/array/test.hxx3
-rw-r--r--common/query/basics/driver.cxx88
-rw-r--r--common/query/basics/makefile29
-rw-r--r--common/readonly/driver.cxx3
-rw-r--r--common/readonly/makefile29
-rw-r--r--common/relationship-query/makefile29
-rw-r--r--common/relationship/makefile29
-rw-r--r--common/schema/embedded/basics/driver.cxx11
-rw-r--r--common/schema/embedded/basics/makefile28
-rw-r--r--common/schema/embedded/order/driver.cxx20
-rw-r--r--common/schema/embedded/order/makefile28
-rw-r--r--common/schema/namespace/makefile29
-rw-r--r--common/schema/namespace/test.hxx2
-rw-r--r--common/session/cache/makefile29
-rw-r--r--common/session/custom/makefile29
-rw-r--r--common/template/makefile29
-rw-r--r--common/threads/driver.cxx18
-rw-r--r--common/threads/makefile29
-rw-r--r--common/transaction/basics/makefile15
-rw-r--r--common/transaction/callback/makefile15
-rw-r--r--common/types/makefile28
-rw-r--r--common/view/driver.cxx84
-rw-r--r--common/view/makefile29
-rw-r--r--common/virtual/makefile29
-rw-r--r--common/wrapper/makefile29
63 files changed, 797 insertions, 877 deletions
diff --git a/common/access/makefile b/common/access/makefile
index 1cb1d2f..9d9da3b 100644
--- a/common/access/makefile
+++ b/common/access/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -40,7 +34,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -67,12 +65,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -80,7 +77,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/access/test.hxx b/common/access/test.hxx
index 4073766..6c4516e 100644
--- a/common/access/test.hxx
+++ b/common/access/test.hxx
@@ -26,6 +26,8 @@
# define BINARY16_TYPE "RAW(16)"
# elif defined(ODB_DATABASE_MSSQL)
# define BINARY16_TYPE "BINARY(16)"
+# elif defined(ODB_DATABASE_COMMON)
+# define BINARY16_TYPE ""
# else
# error unknown database
# endif
diff --git a/common/auto/makefile b/common/auto/makefile
index ed5e3f9..409d5b6 100644
--- a/common/auto/makefile
+++ b/common/auto/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --table-prefix auto_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,12 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -78,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/blob/makefile b/common/blob/makefile
index 4deb80e..4cdfd01 100644
--- a/common/blob/makefile
+++ b/common/blob/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --table-prefix blob_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,12 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -78,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/callback/driver.cxx b/common/callback/driver.cxx
index 0597645..d8e91db 100644
--- a/common/callback/driver.cxx
+++ b/common/callback/driver.cxx
@@ -13,7 +13,6 @@
#include <odb/transaction.hxx>
#include <common/common.hxx>
-#include <common/config.hxx> // DATABASE_XXX
#include "test.hxx"
#include "test-odb.hxx"
diff --git a/common/callback/makefile b/common/callback/makefile
index f38fa60..35e2254 100644
--- a/common/callback/makefile
+++ b/common/callback/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/changelog/makefile b/common/changelog/makefile
index 8d5e96d..bd0f243 100644
--- a/common/changelog/makefile
+++ b/common/changelog/makefile
@@ -15,14 +15,11 @@ add-index.hxx \
drop-index.hxx \
add-foreign-key.hxx \
drop-foreign-key.hxx
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -33,9 +30,6 @@ $(call import,\
#
$(default):
-genf := $(foreach f,$(odb_hdr:.hxx=-odb),$(addprefix $f,.hxx .ixx .cxx))
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb) FORCE # Force regeneration even if up to date.
$(gen): odb := $(odb)
$(gen): export odb_options += --database $(db_id) --generate-schema-only \
@@ -81,7 +75,7 @@ $(test): | $(out_base)/.
# Clean.
#
$(clean): changelogs := $(addprefix $(out_base)/,$(odb_hdr:.hxx=.xml))
-$(clean): $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+$(clean): $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(changelogs))
# Generated .gitignore.
diff --git a/common/circular/multiple/driver.cxx b/common/circular/multiple/driver.cxx
index cc730be..09a34e7 100644
--- a/common/circular/multiple/driver.cxx
+++ b/common/circular/multiple/driver.cxx
@@ -15,7 +15,6 @@
#include <odb/transaction.hxx>
#include <odb/schema-catalog.hxx>
-#include <common/config.hxx> // DATABASE_XXX
#include <common/common.hxx>
#include "test1.hxx"
@@ -43,21 +42,19 @@ main (int argc, char* argv[])
// For these databases this is the only way to drop circularly-
// dependant tables.
//
-#if defined(DATABASE_MYSQL)
- c->execute ("SET FOREIGN_KEY_CHECKS=0");
-#elif defined(DATABASE_SQLITE)
- c->execute ("PRAGMA foreign_keys=OFF");
-#endif
+ if (db->id () == odb::id_mysql)
+ c->execute ("SET FOREIGN_KEY_CHECKS=0");
+ else if (db->id () == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=OFF");
transaction t (c->begin ());
schema_catalog::create_schema (*db);
t.commit ();
-#if defined(DATABASE_MYSQL)
- c->execute ("SET FOREIGN_KEY_CHECKS=1");
-#elif defined(DATABASE_SQLITE)
- c->execute ("PRAGMA foreign_keys=ON");
-#endif
+ if (db->id () == odb::id_mysql)
+ c->execute ("SET FOREIGN_KEY_CHECKS=1");
+ else if (db->id () == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=ON");
}
query<base> bq (query<base>::d->id != 0);
diff --git a/common/circular/multiple/makefile b/common/circular/multiple/makefile
index 92784d1..d603c82 100644
--- a/common/circular/multiple/makefile
+++ b/common/circular/multiple/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(foreach f,$(odb_hdr:.hxx=),$(addprefix $f,-odb.hxx -odb.ixx -odb.cxx .sql))
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -43,7 +37,11 @@ $(gen): $(common.l.cpp-options)
#
$(gen): $(addprefix $(src_base)/,$(odb_hdr))
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -71,11 +69,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
@@ -83,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/circular/single/makefile b/common/circular/single/makefile
index 1708b6c..1e88748 100644
--- a/common/circular/single/makefile
+++ b/common/circular/single/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/composite-id/makefile b/common/composite-id/makefile
index 29227ae..59ffd1b 100644
--- a/common/composite-id/makefile
+++ b/common/composite-id/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/composite/makefile b/common/composite/makefile
index a1fed9b..c32f9c8 100644
--- a/common/composite/makefile
+++ b/common/composite/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/const-member/makefile b/common/const-member/makefile
index fc855c5..d366517 100644
--- a/common/const-member/makefile
+++ b/common/const-member/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --table-prefix constm_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,12 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -78,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/const-object/makefile b/common/const-object/makefile
index d8015cf..46c968c 100644
--- a/common/const-object/makefile
+++ b/common/const-object/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/container/basics/makefile b/common/container/basics/makefile
index d6c4949..433d610 100644
--- a/common/container/basics/makefile
+++ b/common/container/basics/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/container/change-tracking/makefile b/common/container/change-tracking/makefile
index de4c148..354059f 100644
--- a/common/container/change-tracking/makefile
+++ b/common/container/change-tracking/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/ctor/makefile b/common/ctor/makefile
index a94a113..ab1dc32 100644
--- a/common/ctor/makefile
+++ b/common/ctor/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/default/driver.cxx b/common/default/driver.cxx
index 515cb38..56f9a3d 100644
--- a/common/default/driver.cxx
+++ b/common/default/driver.cxx
@@ -13,7 +13,6 @@
#include <odb/transaction.hxx>
#include <common/common.hxx>
-#include <common/config.hxx> // DATABASE_XXX
#include "test.hxx"
#include "test-odb.hxx"
@@ -34,11 +33,11 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifndef DATABASE_ORACLE
- db->execute ("INSERT INTO default_object (obj_id) VALUES (1)");
-#else
- db->execute ("INSERT INTO \"default_object\" (\"obj_id\") VALUES (1)");
-#endif
+ if (db->id () != odb::id_oracle)
+ db->execute ("INSERT INTO default_object (obj_id) VALUES (1)");
+ else
+ db->execute ("INSERT INTO \"default_object\" (\"obj_id\") VALUES (1)");
+
t.commit ();
}
diff --git a/common/default/makefile b/common/default/makefile
index 44e6d04..652af83 100644
--- a/common/default/makefile
+++ b/common/default/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/definition/makefile b/common/definition/makefile
index 370a739..280a27c 100644
--- a/common/definition/makefile
+++ b/common/definition/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx time-mapping.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(foreach f,$(odb_hdr:.hxx=),$(addprefix $f,-odb.hxx -odb.ixx -odb.cxx .sql))
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -43,7 +37,11 @@ $(gen): $(common.l.cpp-options)
#
$(gen): $(src_base)/time-mapping.hxx
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -71,12 +69,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -84,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/enum/makefile b/common/enum/makefile
index 466ad98..00e7da4 100644
--- a/common/enum/makefile
+++ b/common/enum/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/erase-query/driver.cxx b/common/erase-query/driver.cxx
index 6c69bfc..302e506 100644
--- a/common/erase-query/driver.cxx
+++ b/common/erase-query/driver.cxx
@@ -12,7 +12,6 @@
#include <odb/database.hxx>
#include <odb/transaction.hxx>
-#include <common/config.hxx> // DATABASE_XXX
#include <common/common.hxx>
#include "test.hxx"
@@ -62,13 +61,14 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifndef DATABASE_ORACLE
- assert (db->erase_query<object> (
- "erase_query_object.id < 3") == 2);
-#else
- assert (db->erase_query<object> (
- "\"erase_query_object\".\"id\" < 3") == 2);
-#endif
+
+ if (db->id () != odb::id_oracle)
+ assert (db->erase_query<object> (
+ "erase_query_object.id < 3") == 2);
+ else
+ assert (db->erase_query<object> (
+ "\"erase_query_object\".\"id\" < 3") == 2);
+
db->erase_query<object> ();
t.commit ();
}
@@ -162,13 +162,13 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifndef DATABASE_ORACLE
- assert (db->execute ("SELECT * FROM erase_query_object_v "
- "WHERE object_id = 1") == 0);
-#else
- assert (db->execute ("SELECT * FROM \"erase_query_object_v\" "
- "WHERE \"object_id\" = 1") == 0);
-#endif
+
+ if (db->id () != odb::id_oracle)
+ assert (db->execute ("SELECT * FROM erase_query_object_v "
+ "WHERE object_id = 1") == 0);
+ else
+ assert (db->execute ("SELECT * FROM \"erase_query_object_v\" "
+ "WHERE \"object_id\" = 1") == 0);
t.commit ();
}
}
diff --git a/common/erase-query/makefile b/common/erase-query/makefile
index 949064e..f66d840 100644
--- a/common/erase-query/makefile
+++ b/common/erase-query/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/include/makefile b/common/include/makefile
index eb25d9f..9428c59 100644
--- a/common/include/makefile
+++ b/common/include/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := obj1.hxx obj2.hxx obj3.hxx test1.hxx test2.hxx test3.hxx test4.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -30,9 +27,6 @@ $(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) \
-I$(out_base)/../.. -I$(src_base)/../..
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(foreach f,$(odb_hdr:.hxx=-odb),$(addprefix $f,.hxx .ixx .cxx))
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen): odb_options += --database $(db_id) --table-prefix include_
@@ -51,11 +45,7 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+$(eval $(call test-schemaless-rule))
# Clean.
#
@@ -63,7 +53,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/index/makefile b/common/index/makefile
index 610aec3..690e2ab 100644
--- a/common/index/makefile
+++ b/common/index/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --table-prefix index_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,12 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -78,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/inheritance/polymorphism/makefile b/common/inheritance/polymorphism/makefile
index d7a8e2f..2609151 100644
--- a/common/inheritance/polymorphism/makefile
+++ b/common/inheritance/polymorphism/makefile
@@ -8,17 +8,14 @@ cxx_tun := driver.cxx
odb_hdr := test1.hxx test2.hxx test3.hxx test4.hxx test5.hxx test6.hxx \
test7.hxx test8.hxx test9.hxx test10.hxx test11.hxx test12.hxx test13.hxx \
test14.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -31,9 +28,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(foreach f,$(odb_hdr:.hxx=),$(addprefix $f,-odb.hxx -odb.ixx -odb.cxx .sql))
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -41,7 +35,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -69,13 +67,11 @@ $(dist):
# Test.
#
-$(test): schemas := $(addprefix $(out_base)/,$(odb_hdr:.hxx=.sql))
-$(test): $(driver) $(src_base)/test.std
- $(call schema,$(schemas))
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule,,$(filter %.sql,$(gen))))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d,$(filter %.sql,$(gen)))))
+endif
# Clean.
#
@@ -83,7 +79,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/inheritance/reuse/makefile b/common/inheritance/reuse/makefile
index 874d48b..f240640 100644
--- a/common/inheritance/reuse/makefile
+++ b/common/inheritance/reuse/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/inheritance/transient/makefile b/common/inheritance/transient/makefile
index f20894e..4d6ba4d 100644
--- a/common/inheritance/transient/makefile
+++ b/common/inheritance/transient/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/inverse/makefile b/common/inverse/makefile
index a1c3202..89c98ee 100644
--- a/common/inverse/makefile
+++ b/common/inverse/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/lazy-ptr/makefile b/common/lazy-ptr/makefile
index cfb7010..03e39af 100644
--- a/common/lazy-ptr/makefile
+++ b/common/lazy-ptr/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-session \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-session \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/lifecycle/makefile b/common/lifecycle/makefile
index 3d700d9..f047e0f 100644
--- a/common/lifecycle/makefile
+++ b/common/lifecycle/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/makefile b/common/makefile
index ebf969a..44adcc7 100644
--- a/common/makefile
+++ b/common/makefile
@@ -57,10 +57,7 @@ cxx11_tests := session/custom
no_dist_tests := changelog include
-default := $(out_base)/
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
+no_multi_tests := changelog include
$(default):
$(call include,$(bld_root)/cxx/standard.make) # cxx_standard
@@ -72,6 +69,10 @@ ifeq ($(cxx_standard),c++11)
build_tests += $(cxx11_tests)
endif
+ifeq ($(db_id),common)
+build_tests := $(filter-out $(no_multi_tests),$(build_tests))
+endif
+
$(default): $(addprefix $(out_base)/,$(addsuffix /,$(build_tests)))
name := common
@@ -89,6 +90,11 @@ $(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_tests)))
$(call meta-vctest,$(name)-mysql-vc10.sln,test.bat)
$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(build_tests)))
+
+ifeq ($(db_id),common)
+$(foreach d,$(databases),$(eval $(call db-test-dir,$d,$(build_tests))))
+endif
+
$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(all_tests)))
$(call include,$(bld_root)/meta/vc9sln.make)
diff --git a/common/no-id/makefile b/common/no-id/makefile
index 439e883..99df92d 100644
--- a/common/no-id/makefile
+++ b/common/no-id/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/optimistic/makefile b/common/optimistic/makefile
index 8da011e..ac61e5a 100644
--- a/common/optimistic/makefile
+++ b/common/optimistic/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/pragma/makefile b/common/pragma/makefile
index bb54f7a..1ea8ba1 100644
--- a/common/pragma/makefile
+++ b/common/pragma/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --table-prefix pragma_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,11 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
@@ -77,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/prepared/makefile b/common/prepared/makefile
index 72d0974..d905419 100644
--- a/common/prepared/makefile
+++ b/common/prepared/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/query/array/driver.cxx b/common/query/array/driver.cxx
index c449566..5b0d378 100644
--- a/common/query/array/driver.cxx
+++ b/common/query/array/driver.cxx
@@ -32,6 +32,7 @@ const odb::pgsql::database_type_id bt = odb::pgsql::id_bytea;
const odb::oracle::database_type_id bt = odb::oracle::id_raw;
#elif defined(DATABASE_MSSQL)
const odb::mssql::database_type_id bt = odb::mssql::id_binary;
+#elif defined(DATABASE_COMMON)
#else
# error unknown database
#endif
@@ -66,57 +67,78 @@ main (int argc, char* argv[])
// string
//
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::s == "abc")) == 1);
assert (size (db->query<object> (query::s == query::_val ("bcd"))) == 1);
assert (size (db->query<object> ("s = " + query::_val ("bcd"))) == 1);
assert (size (db->query<object> ("s = " + query::_ref ("bcd"))) == 1);
+#endif
{
char a[] = "bcd";
char* ra = a;
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::s == a)) == 1);
assert (size (db->query<object> (query::s == query::_val (a))) == 1);
+#endif
assert (size (db->query<object> (query::s == query::_ref (ra))) == 1);
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("s = " + query::_val (a))) == 1);
assert (size (db->query<object> ("s = " + query::_ref (a))) == 1);
+#endif
}
{
const char a[] = "bcd";
const char* ra = a;
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::s == a)) == 1);
assert (size (db->query<object> (query::s == query::_val (a))) == 1);
+#endif
assert (size (db->query<object> (query::s == query::_ref (ra))) == 1);
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("s = " + query::_val (a))) == 1);
assert (size (db->query<object> ("s = " + query::_ref (a))) == 1);
+#endif
}
{
const char* p = "cde";
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::s == p)) == 1);
assert (size (db->query<object> (query::s == query::_val (p))) == 1);
+#endif
assert (size (db->query<object> (query::s == query::_ref (p))) == 1);
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("s = " + query::_val (p))) == 1);
assert (size (db->query<object> ("s = " + query::_ref (p))) == 1);
+#endif
}
{
char a[] = "cde";
char* p = a;
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::s == p)) == 1);
assert (size (db->query<object> (query::s == query::_val (p))) == 1);
+#endif
assert (size (db->query<object> (query::s == query::_ref (p))) == 1);
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("s = " + query::_val (p))) == 1);
assert (size (db->query<object> ("s = " + query::_ref (p))) == 1);
+#endif
}
+#ifndef DATABASE_COMMON
string s ("abc");
//assert (size (db->query<object> (query::s == s)) == 1);
assert (size (db->query<object> (query::s == s.c_str ())) == 1);
//assert (size (db->query<object> (query::s == query::_val (s))) == 1);
assert (size (db->query<object> (query::s == query::_val (s.c_str ()))) == 1);
+
assert (size (db->query<object> ("s = " + query::_val (s))) == 1);
assert (size (db->query<object> ("s = " + query::_ref (s))) == 1);
+#endif
assert (size (db->query<object> (query::s == query::s1)) == 3);
@@ -126,12 +148,16 @@ main (int argc, char* argv[])
array<char, 17> a;
strcpy (a.data (), "abc");
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::a == a)) == 1);
assert (size (db->query<object> (query::a == query::_val (a))) == 1);
+#endif
assert (size (db->query<object> (query::a == query::_ref (a))) == 1);
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("a = " + query::_val (a))) == 1);
assert (size (db->query<object> ("a = " + query::_ref (a))) == 1);
#endif
+#endif
// char
//
@@ -141,18 +167,26 @@ main (int argc, char* argv[])
assert (size (db->query<object> (query::c == query::_val (c))) == 1);
assert (size (db->query<object> (query::c == query::_ref (c))) == 1);
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("c = " + query::_val ('c'))) == 1);
assert (size (db->query<object> ("c = " + query::_ref (c))) == 1);
+#endif
assert (size (db->query<object> (query::c == query::c1)) == 3);
// buffer
//
+#ifndef DATABASE_COMMON
assert (size (db->query<object> (query::b == buf)) == 3);
assert (size (db->query<object> (query::b == query::_val (buf))) == 3);
+#endif
+
assert (size (db->query<object> (query::b == query::_ref (buf))) == 3);
+
+#ifndef DATABASE_COMMON
assert (size (db->query<object> ("b = " + query::_val<bt> (buf))) == 3);
assert (size (db->query<object> ("b = " + query::_ref<bt> (buf))) == 3);
+#endif
t.commit ();
}
diff --git a/common/query/array/makefile b/common/query/array/makefile
index 3708b9d..d8fa45b 100644
--- a/common/query/array/makefile
+++ b/common/query/array/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/query/array/test.hxx b/common/query/array/test.hxx
index e086a44..e9cbd15 100644
--- a/common/query/array/test.hxx
+++ b/common/query/array/test.hxx
@@ -46,6 +46,8 @@ struct object
# pragma db type("VARCHAR(16)")
# elif defined(ODB_DATABASE_SQLITE)
# pragma db type("TEXT")
+# elif defined(ODB_DATABASE_COMMON)
+# pragma db type("DYMMU") // Necessary to make it a value.
# else
# error unknown database
# endif
@@ -67,6 +69,7 @@ struct object
# pragma db type("RAW(16)")
# elif defined(ODB_DATABASE_MSSQL)
# pragma db type("BINARY(16)")
+# elif defined(ODB_DATABASE_COMMON)
# else
# error unknown database
# endif
diff --git a/common/query/basics/driver.cxx b/common/query/basics/driver.cxx
index ee8e3b1..be45237 100644
--- a/common/query/basics/driver.cxx
+++ b/common/query/basics/driver.cxx
@@ -48,6 +48,7 @@ main (int argc, char* argv[])
try
{
auto_ptr<database> db (create_database (argc, argv));
+ odb::database_id db_id (db->id ());
typedef odb::query<person> query;
typedef odb::result<person> result;
@@ -70,8 +71,13 @@ main (int argc, char* argv[])
t.commit ();
}
+ //
+ // Native queries.
+ //
+
// Compilation tests.
//
+#ifndef DATABASE_COMMON
if (false)
{
string name;
@@ -92,6 +98,7 @@ main (int argc, char* argv[])
query q1 (query::_val (name));
q1 += " = first";
}
+#endif
// Select-all query.
//
@@ -139,11 +146,13 @@ main (int argc, char* argv[])
cout << "test 003" << endl;
{
transaction t (db->begin ());
-#ifndef DATABASE_ORACLE
- result r (db->query<person> ("age >= 30 AND last = 'Doe'"));
-#else
- result r (db->query<person> ("\"age\" >= 30 AND \"last\" = 'Doe'"));
-#endif
+
+ result r;
+ if (db_id != odb::id_oracle)
+ r = db->query<person> ("age >= 30 AND last = 'Doe'");
+ else
+ r = db->query<person> ("\"age\" >= 30 AND \"last\" = 'Doe'");
+
print (r);
t.commit ();
}
@@ -156,16 +165,22 @@ main (int argc, char* argv[])
const char* name = "Doe";
-#ifndef DATABASE_ORACLE
+#if defined(DATABASE_COMMON)
result r (
db->query<person> (
- "age >= " + query::_ref (30) + "AND" +
- "last = " + query::_val (name)));
-#else
+ query::age >= query::_val (30) &&
+ query::last_name == query::_val (name)));
+
+#elif defined(DATABASE_ORACLE)
result r (
db->query<person> (
- "\"age\" >= " + query::_ref (30) + "AND" +
+ "\"age\" >= " + query::_val (30) + "AND" +
"\"last\" = " + query::_val (name)));
+#else
+ result r (
+ db->query<person> (
+ "age >= " + query::_val (30) + "AND" +
+ "last = " + query::_val (name)));
#endif
print (r);
@@ -181,12 +196,15 @@ main (int argc, char* argv[])
string name;
unsigned short age;
-#ifndef DATABASE_ORACLE
- query q ("age >= " + query::_ref (age) + "AND" +
- "last = " + query::_ref (name));
-#else
+#if defined(DATABASE_COMMON)
+ query q (query::age >= query::_ref (age) &&
+ query::last_name == query::_ref (name));
+#elif defined(DATABASE_ORACLE)
query q ("\"age\" >= " + query::_ref (age) + "AND" +
"\"last\" = " + query::_ref (name));
+#else
+ query q ("age >= " + query::_ref (age) + "AND" +
+ "last = " + query::_ref (name));
#endif
name = "Doe";
@@ -232,7 +250,9 @@ main (int argc, char* argv[])
//db->query<person> (query::age == query::_ref (name));
db->query<person> (query::last_name == "Doe");
db->query<person> (query::last_name == name);
+#ifndef DATABASE_COMMON
db->query<person> (query::last_name == query::_val ("Doe"));
+#endif
db->query<person> (query::last_name == query::_val (name));
db->query<person> (query::last_name == query::_ref (name));
//db->query<person> (query::last_name == 30);
@@ -437,9 +457,8 @@ main (int argc, char* argv[])
// SQL Server does not support re-loading of an object with long data
// from a query result.
//
-#ifndef DATABASE_MSSQL
- assert (i->last_name_ == "Doe"); // Actual load.
-#endif
+ if (db_id != odb::id_mssql)
+ assert (i->last_name_ == "Doe"); // Actual load.
// Overwrite object image again.
//
@@ -470,18 +489,22 @@ main (int argc, char* argv[])
result r;
result::iterator i;
+ // ==
+ //
+
// Oracle does not support LOB comparisons.
//
#ifndef DATABASE_ORACLE
- // ==
- //
- r = db->query<person> (query::public_key == key2);
+ if (db_id != odb::id_oracle)
+ {
+ r = db->query<person> (query::public_key == key2);
- i = r.begin ();
- assert (i != r.end ());
+ i = r.begin ();
+ assert (i != r.end ());
- assert (*i->public_key_ == key2);
- assert (++i == r.end ());
+ assert (*i->public_key_ == key2);
+ assert (++i == r.end ());
+ }
#endif
// is_null
@@ -549,9 +572,9 @@ main (int argc, char* argv[])
// Test size() validity at the beginning/middle/end of result set.
//
cout << "test 019" << endl;
-#if !defined(DATABASE_SQLITE) && \
- !defined(DATABASE_ORACLE) && \
- !defined(DATABASE_MSSQL)
+ if (db_id != odb::id_sqlite &&
+ db_id != odb::id_oracle &&
+ db_id != odb::id_mssql)
{
{
transaction t (db->begin ());
@@ -600,7 +623,6 @@ main (int argc, char* argv[])
assert (r.size () == 0);
}
}
-#endif
// Test like.
//
@@ -619,11 +641,11 @@ main (int argc, char* argv[])
// In Oracle one can only escape special characters (% and _).
//
-#if defined(DATABASE_ORACLE)
- string v ("Ja%");
-#else
- string v ("!Ja%");
-#endif
+ string v;
+ if (db_id != odb::id_oracle)
+ v = "!Ja%";
+ else
+ v = "Ja%";
r = db->query<person> (query::first_name.like (query::_ref (v), "!"));
print (r);
diff --git a/common/query/basics/makefile b/common/query/basics/makefile
index ec63728..fc26133 100644
--- a/common/query/basics/makefile
+++ b/common/query/basics/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/readonly/driver.cxx b/common/readonly/driver.cxx
index e97a0cb..2bb7ce9 100644
--- a/common/readonly/driver.cxx
+++ b/common/readonly/driver.cxx
@@ -14,6 +14,7 @@
#include <odb/database.hxx>
#include <odb/transaction.hxx>
+#include <common/config.hxx> // DATABASE_*
#include <common/common.hxx>
#include "test.hxx"
@@ -204,6 +205,7 @@ main (int argc, char* argv[])
// Readonly object.
//
{
+#ifndef DATABASE_COMMON
typedef odb::object_traits_impl<simple_object, odb::id_common> so_traits;
typedef odb::object_traits_impl<ro_object, odb::id_common> ro_traits;
typedef odb::object_traits_impl<rw_object, odb::id_common> rw_traits;
@@ -216,6 +218,7 @@ main (int argc, char* argv[])
assert (rw_traits::column_count !=
rw_traits::id_column_count + rw_traits::readonly_column_count);
+#endif
simple_object so (1, 1);
ro_object ro_o (1, 1);
diff --git a/common/readonly/makefile b/common/readonly/makefile
index 3c586bd..92bc2cf 100644
--- a/common/readonly/makefile
+++ b/common/readonly/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/relationship-query/makefile b/common/relationship-query/makefile
index 56994b5..caf72ea 100644
--- a/common/relationship-query/makefile
+++ b/common/relationship-query/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/relationship/makefile b/common/relationship/makefile
index c469a93..95ad959 100644
--- a/common/relationship/makefile
+++ b/common/relationship/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/schema/embedded/basics/driver.cxx b/common/schema/embedded/basics/driver.cxx
index 5a14149..a67529c 100644
--- a/common/schema/embedded/basics/driver.cxx
+++ b/common/schema/embedded/basics/driver.cxx
@@ -13,7 +13,6 @@
#include <odb/transaction.hxx>
#include <odb/schema-catalog.hxx>
-#include <common/config.hxx> // DATABASE_XXX
#include <common/common.hxx>
#include "test.hxx"
@@ -36,9 +35,8 @@ main (int argc, char* argv[])
// Temporarily disable foreign key constraints for SQLite.
//
-#if defined(DATABASE_SQLITE)
- c->execute ("PRAGMA foreign_keys=OFF");
-#endif
+ if (db->id () == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=OFF");
assert (schema_catalog::exists (*db, "test"));
assert (!schema_catalog::exists (*db, "test1"));
@@ -48,9 +46,8 @@ main (int argc, char* argv[])
schema_catalog::create_schema (*db, "test");
t.commit ();
-#if defined(DATABASE_SQLITE)
- c->execute ("PRAGMA foreign_keys=ON");
-#endif
+ if (db->id () == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=ON");
}
}
catch (const odb::exception& e)
diff --git a/common/schema/embedded/basics/makefile b/common/schema/embedded/basics/makefile
index 96e987a..07a246f 100644
--- a/common/schema/embedded/basics/makefile
+++ b/common/schema/embedded/basics/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,11 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
@@ -78,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/schema/embedded/order/driver.cxx b/common/schema/embedded/order/driver.cxx
index 685693d..0545442 100644
--- a/common/schema/embedded/order/driver.cxx
+++ b/common/schema/embedded/order/driver.cxx
@@ -13,7 +13,6 @@
#include <odb/transaction.hxx>
#include <odb/schema-catalog.hxx>
-#include <common/config.hxx> // DATABASE_XXX
#include <common/common.hxx>
#include "test1.hxx"
@@ -31,6 +30,7 @@ main (int argc, char* argv[])
try
{
auto_ptr<database> db (create_database (argc, argv, false));
+ odb::database_id db_id (db->id ());
// Create the database schema.
//
@@ -41,21 +41,19 @@ main (int argc, char* argv[])
// For MySQL we can actually create the tables in any order. It is
// dropping them that's the problem (there is no IF EXISTS).
//
-#if defined(DATABASE_MYSQL)
- c->execute ("SET FOREIGN_KEY_CHECKS=0");
-#elif defined(DATABASE_SQLITE)
- c->execute ("PRAGMA foreign_keys=OFF");
-#endif
+ if (db_id == odb::id_mysql)
+ c->execute ("SET FOREIGN_KEY_CHECKS=0");
+ else if (db_id == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=OFF");
transaction t (c->begin ());
schema_catalog::create_schema (*db);
t.commit ();
-#if defined(DATABASE_MYSQL)
- c->execute ("SET FOREIGN_KEY_CHECKS=1");
-#elif defined(DATABASE_SQLITE)
- c->execute ("PRAGMA foreign_keys=ON");
-#endif
+ if (db_id == odb::id_mysql)
+ c->execute ("SET FOREIGN_KEY_CHECKS=1");
+ else if (db_id == odb::id_sqlite)
+ c->execute ("PRAGMA foreign_keys=ON");
}
}
catch (const odb::exception& e)
diff --git a/common/schema/embedded/order/makefile b/common/schema/embedded/order/makefile
index e8897d5..10242cf 100644
--- a/common/schema/embedded/order/makefile
+++ b/common/schema/embedded/order/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test2.hxx test1.hxx # Reverse order.
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(foreach f,$(odb_hdr:.hxx=),$(addprefix $f,-odb.hxx -odb.ixx -odb.cxx .sql))
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -43,7 +37,11 @@ $(gen): $(common.l.cpp-options)
#
$(gen): $(addprefix $(src_base)/,$(odb_hdr))
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -71,11 +69,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
@@ -83,7 +81,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/schema/namespace/makefile b/common/schema/namespace/makefile
index 38f6be1..8d34d43 100644
--- a/common/schema/namespace/makefile
+++ b/common/schema/namespace/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/schema/namespace/test.hxx b/common/schema/namespace/test.hxx
index 351b574..dfaaf19 100644
--- a/common/schema/namespace/test.hxx
+++ b/common/schema/namespace/test.hxx
@@ -92,6 +92,8 @@ struct type
# define DB_SCHEMA ""
#elif defined(ODB_DATABASE_MSSQL)
# define DB_SCHEMA "dbo"
+#elif defined(ODB_DATABASE_COMMON)
+# define DB_SCHEMA "dummy"
#else
# error unknown database
#endif
diff --git a/common/session/cache/makefile b/common/session/cache/makefile
index 3219565..165a7b3 100644
--- a/common/session/cache/makefile
+++ b/common/session/cache/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-session \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-session \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/session/custom/makefile b/common/session/custom/makefile
index 2342b04..da19443 100644
--- a/common/session/custom/makefile
+++ b/common/session/custom/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
cxx_tun := driver.cxx session.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-session \
@@ -40,7 +34,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-session \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -68,12 +66,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -81,7 +78,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/template/makefile b/common/template/makefile
index 0d8cf60..2498cce 100644
--- a/common/template/makefile
+++ b/common/template/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/threads/driver.cxx b/common/threads/driver.cxx
index 0714d4a..3114072 100644
--- a/common/threads/driver.cxx
+++ b/common/threads/driver.cxx
@@ -17,10 +17,10 @@
#include <odb/details/shared-ptr.hxx>
#include <odb/details/thread.hxx>
-#include <common/config.hxx> // DATABASE_SQLITE
+#include <common/config.hxx> // DATABASE_*
#include <common/common.hxx>
-#ifdef DATABASE_SQLITE
+#if defined(DATABASE_SQLITE) || defined(DATABASE_COMMON)
# include <odb/sqlite/database.hxx>
#endif
@@ -70,7 +70,7 @@ struct task
{
try
{
-#ifndef DATABASE_SQLITE
+#if !defined(DATABASE_SQLITE) && !defined(DATABASE_COMMON)
transaction t (db_.begin ());
#else
// SQLite has a peculiar table locking mode (shared cache)
@@ -79,10 +79,16 @@ struct task
// perspective. One way to work around this problem is to
// start a "write" transaction as such right away.
//
- transaction t (
- static_cast<odb::sqlite::database&> (db_).begin_immediate ());
-#endif
+ transaction t;
+ if (db_.id () != odb::id_sqlite)
+ t.reset (db_.begin ());
+ else
+ {
+ t.reset (
+ static_cast<odb::sqlite::database&> (db_).begin_immediate ());
+ }
+#endif
auto_ptr<object> o (db_.load<object> (id));
assert (o->str_ == "first object");
o->str_ = "another value";
diff --git a/common/threads/makefile b/common/threads/makefile
index 91adc8d..92d00d7 100644
--- a/common/threads/makefile
+++ b/common/threads/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/transaction/basics/makefile b/common/transaction/basics/makefile
index a399e8c..07b1ba6 100644
--- a/common/transaction/basics/makefile
+++ b/common/transaction/basics/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -46,11 +41,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
diff --git a/common/transaction/callback/makefile b/common/transaction/callback/makefile
index e60c936..012dd2f 100644
--- a/common/transaction/callback/makefile
+++ b/common/transaction/callback/makefile
@@ -11,11 +11,6 @@ cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Build.
#
$(driver): $(cxx_obj) $(common.l)
@@ -46,11 +41,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
diff --git a/common/types/makefile b/common/types/makefile
index f47e4d4..c28964a 100644
--- a/common/types/makefile
+++ b/common/types/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --table-prefix types_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,11 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-schemaless-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-schemaless-rule,$d)))
+endif
# Clean.
#
@@ -77,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/view/driver.cxx b/common/view/driver.cxx
index b8a8f3e..2c5c65c 100644
--- a/common/view/driver.cxx
+++ b/common/view/driver.cxx
@@ -58,11 +58,11 @@ view2_test (const auto_ptr<database>& db)
}
{
-#ifndef DATABASE_ORACLE
- result r (db->query<V> ("age < 31"));
-#else
- result r (db->query<V> ("\"age\" < 31"));
-#endif
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<V> ("age < 31");
+ else
+ r = db->query<V> ("\"age\" < 31");
iterator i (r.begin ());
assert (i != r.end ());
@@ -90,11 +90,11 @@ view4_test (const auto_ptr<database>& db)
transaction t (db->begin ());
{
-#ifndef DATABASE_ORACLE
- result r (db->query<V> ((query::person::age > 30) + "ORDER BY age"));
-#else
- result r (db->query<V> ((query::person::age > 30) + "ORDER BY \"age\""));
-#endif
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<V> ((query::person::age > 30) + "ORDER BY age");
+ else
+ r = db->query<V> ((query::person::age > 30) + "ORDER BY \"age\"");
iterator i (r.begin ());
@@ -237,20 +237,22 @@ main (int argc, char* argv[])
}
{
-#ifndef DATABASE_ORACLE
- result r (db->query<view1> ("ORDER BY age"));
-#else
- result r (db->query<view1> ("ORDER BY \"age\""));
-#endif
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<view1> ("ORDER BY age");
+ else
+ r = db->query<view1> ("ORDER BY \"age\"");
+
assert (size (r) == 4);
}
{
-#ifndef DATABASE_ORACLE
- result r (db->query<view1> ("age < 31 ORDER BY age"));
-#else
- result r (db->query<view1> ("\"age\" < 31 ORDER BY \"age\""));
-#endif
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<view1> ("age < 31 ORDER BY age");
+ else
+ r = db->query<view1> ("\"age\" < 31 ORDER BY \"age\"");
+
view1_check (r);
}
@@ -289,6 +291,9 @@ main (int argc, char* argv[])
t.commit ();
}
+ // No native parameter support in dynamic multi-database mode.
+ //
+#ifndef DATABASE_COMMON
{
transaction t (db->begin ());
@@ -306,6 +311,7 @@ main (int argc, char* argv[])
t.commit ();
}
+#endif
}
}
@@ -317,20 +323,15 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
-#ifndef DATABASE_ORACLE
- result r (
- db->query<view1c> (
- "SELECT first, last, age "
- "FROM t_view_person "
- "WHERE age < 31 ORDER BY age"));
-#else
- result r (
- db->query<view1c> (
- "SELECT \"first\", \"last\", \"age\" "
- "FROM \"t_view_person\" "
- "WHERE \"age\" < 31 ORDER BY \"age\""));
-#endif
-
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<view1c> ("SELECT first, last, age "
+ "FROM t_view_person "
+ "WHERE age < 31 ORDER BY age");
+ else
+ r = db->query<view1c> ("SELECT \"first\", \"last\", \"age\" "
+ "FROM \"t_view_person\" "
+ "WHERE \"age\" < 31 ORDER BY \"age\"");
view1_check (r);
t.commit ();
@@ -346,11 +347,12 @@ main (int argc, char* argv[])
transaction t (db->begin ());
{
-#ifndef DATABASE_ORACLE
- result r (db->query<view1d> ("age < 31 ORDER BY age"));
-#else
- result r (db->query<view1d> ("\"age\" < 31 ORDER BY \"age\""));
-#endif
+ result r;
+ if (db->id () != odb::id_oracle)
+ r = db->query<view1d> ("age < 31 ORDER BY age");
+ else
+ r = db->query<view1d> ("\"age\" < 31 ORDER BY \"age\"");
+
view1_check (r);
}
@@ -466,12 +468,16 @@ main (int argc, char* argv[])
view6_test<view6b> (
db, odb::query<view6b>::employer::name == "Simple Tech, Inc");
+ // No native parameter support in dynamic multi-database mode.
+ //
+#ifndef DATABASE_COMMON
view6_test<view6c> (
#ifndef DATABASE_ORACLE
db, "e.name = " + odb::query<view6c>::_val ("Simple Tech, Inc"));
#else
db, "\"e\".\"name\" = " + odb::query<view6c>::_val ("Simple Tech, Inc"));
#endif
+#endif
// view7
//
diff --git a/common/view/makefile b/common/view/makefile
index 6aad221..d13e7c6 100644
--- a/common/view/makefile
+++ b/common/view/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/virtual/makefile b/common/virtual/makefile
index 168c969..ef27eff 100644
--- a/common/virtual/makefile
+++ b/common/virtual/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,9 +26,6 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --generate-query \
@@ -39,7 +33,11 @@ $(gen) $(dist): export odb_options += --generate-schema --generate-query \
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -66,12 +64,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -79,7 +76,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.
diff --git a/common/wrapper/makefile b/common/wrapper/makefile
index 68492c1..1c2cd3f 100644
--- a/common/wrapper/makefile
+++ b/common/wrapper/makefile
@@ -6,17 +6,14 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
cxx_tun := driver.cxx
odb_hdr := test.hxx
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+genf := $(call odb-gen,$(odb_hdr))
+gen := $(addprefix $(out_base)/,$(genf))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o))
cxx_od := $(cxx_obj:.o=.o.d)
common.l := $(out_root)/libcommon/common/common.l
common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options
-driver := $(out_base)/driver
-dist := $(out_base)/.dist
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
# Import.
#
$(call import,\
@@ -29,16 +26,17 @@ $(driver): $(cxx_obj) $(common.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base)
$(cxx_obj) $(cxx_od): $(common.l.cpp-options)
-genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql)
-gen := $(addprefix $(out_base)/,$(genf))
-
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --generate-schema --table-prefix wrapper_
$(gen): cpp_options := -I$(src_base)
$(gen): $(common.l.cpp-options)
+ifneq ($(db_id),common)
$(gen): odb_options += --database $(db_id)
+else
+$(gen): odb_options += --multi-database dynamic
+endif
$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
@@ -65,12 +63,11 @@ $(dist):
# Test.
#
-$(test): $(driver) $(src_base)/test.std
- $(call schema)
- $(call message,test $<,$< --options-file $(dcf_root)/$(db_id).options \
->$(out_base)/test.out)
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
+ifneq ($(db_id),common)
+$(eval $(call test-rule))
+else
+$(foreach d,$(databases),$(eval $(call test-rule,$d)))
+endif
# Clean.
#
@@ -78,7 +75,7 @@ $(clean): \
$(driver).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
$(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+ $(addsuffix .hxx.clean,$(filter %.cxx,$(gen)))
$(call message,,rm -f $(out_base)/test.out)
# Generated .gitignore.