From 15c6024da6a15e2d6e3302e4df375092959edbe2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 Mar 2013 13:55:18 +0200 Subject: Add changelog test --- common/changelog/add-table-mssql-diff.xml | 45 +++++++++++++ common/changelog/add-table-mssql-patch.xml | 42 ++++++++++++ common/changelog/add-table-mysql-diff.xml | 45 +++++++++++++ common/changelog/add-table-mysql-patch.xml | 42 ++++++++++++ common/changelog/add-table-oracle-diff.xml | 45 +++++++++++++ common/changelog/add-table-oracle-patch.xml | 42 ++++++++++++ common/changelog/add-table-pgsql-diff.xml | 45 +++++++++++++ common/changelog/add-table-pgsql-patch.xml | 42 ++++++++++++ common/changelog/add-table-sqlite-diff.xml | 45 +++++++++++++ common/changelog/add-table-sqlite-patch.xml | 42 ++++++++++++ common/changelog/add-table.hxx | 35 ++++++++++ common/changelog/drop-table-mssql-diff.xml | 47 ++++++++++++++ common/changelog/drop-table-mssql-patch.xml | 11 ++++ common/changelog/drop-table-mysql-diff.xml | 47 ++++++++++++++ common/changelog/drop-table-mysql-patch.xml | 11 ++++ common/changelog/drop-table-oracle-diff.xml | 47 ++++++++++++++ common/changelog/drop-table-oracle-patch.xml | 11 ++++ common/changelog/drop-table-pgsql-diff.xml | 47 ++++++++++++++ common/changelog/drop-table-pgsql-patch.xml | 11 ++++ common/changelog/drop-table-sqlite-diff.xml | 47 ++++++++++++++ common/changelog/drop-table-sqlite-patch.xml | 11 ++++ common/changelog/drop-table.hxx | 35 ++++++++++ common/changelog/makefile | 97 ++++++++++++++++++++++++++++ common/changelog/model-mssql-diff.xml | 1 + common/changelog/model-mssql-patch.xml | 1 + common/changelog/model-mssql.xml | 56 ++++++++++++++++ common/changelog/model-mysql-diff.xml | 1 + common/changelog/model-mysql-patch.xml | 1 + common/changelog/model-mysql.xml | 56 ++++++++++++++++ common/changelog/model-oracle-diff.xml | 1 + common/changelog/model-oracle-patch.xml | 1 + common/changelog/model-oracle.xml | 56 ++++++++++++++++ common/changelog/model-pgsql-diff.xml | 1 + common/changelog/model-pgsql-patch.xml | 1 + common/changelog/model-pgsql.xml | 56 ++++++++++++++++ common/changelog/model-sqlite-diff.xml | 1 + common/changelog/model-sqlite-patch.xml | 1 + common/changelog/model-sqlite.xml | 56 ++++++++++++++++ common/changelog/model.hxx | 47 ++++++++++++++ 39 files changed, 1229 insertions(+) create mode 100644 common/changelog/add-table-mssql-diff.xml create mode 100644 common/changelog/add-table-mssql-patch.xml create mode 100644 common/changelog/add-table-mysql-diff.xml create mode 100644 common/changelog/add-table-mysql-patch.xml create mode 100644 common/changelog/add-table-oracle-diff.xml create mode 100644 common/changelog/add-table-oracle-patch.xml create mode 100644 common/changelog/add-table-pgsql-diff.xml create mode 100644 common/changelog/add-table-pgsql-patch.xml create mode 100644 common/changelog/add-table-sqlite-diff.xml create mode 100644 common/changelog/add-table-sqlite-patch.xml create mode 100644 common/changelog/add-table.hxx create mode 100644 common/changelog/drop-table-mssql-diff.xml create mode 100644 common/changelog/drop-table-mssql-patch.xml create mode 100644 common/changelog/drop-table-mysql-diff.xml create mode 100644 common/changelog/drop-table-mysql-patch.xml create mode 100644 common/changelog/drop-table-oracle-diff.xml create mode 100644 common/changelog/drop-table-oracle-patch.xml create mode 100644 common/changelog/drop-table-pgsql-diff.xml create mode 100644 common/changelog/drop-table-pgsql-patch.xml create mode 100644 common/changelog/drop-table-sqlite-diff.xml create mode 100644 common/changelog/drop-table-sqlite-patch.xml create mode 100644 common/changelog/drop-table.hxx create mode 100644 common/changelog/makefile create mode 120000 common/changelog/model-mssql-diff.xml create mode 120000 common/changelog/model-mssql-patch.xml create mode 100644 common/changelog/model-mssql.xml create mode 120000 common/changelog/model-mysql-diff.xml create mode 120000 common/changelog/model-mysql-patch.xml create mode 100644 common/changelog/model-mysql.xml create mode 120000 common/changelog/model-oracle-diff.xml create mode 120000 common/changelog/model-oracle-patch.xml create mode 100644 common/changelog/model-oracle.xml create mode 120000 common/changelog/model-pgsql-diff.xml create mode 120000 common/changelog/model-pgsql-patch.xml create mode 100644 common/changelog/model-pgsql.xml create mode 120000 common/changelog/model-sqlite-diff.xml create mode 120000 common/changelog/model-sqlite-patch.xml create mode 100644 common/changelog/model-sqlite.xml create mode 100644 common/changelog/model.hxx (limited to 'common/changelog') diff --git a/common/changelog/add-table-mssql-diff.xml b/common/changelog/add-table-mssql-diff.xml new file mode 100644 index 0000000..8d3a95d --- /dev/null +++ b/common/changelog/add-table-mssql-diff.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
diff --git a/common/changelog/add-table-mssql-patch.xml b/common/changelog/add-table-mssql-patch.xml new file mode 100644 index 0000000..204a5a9 --- /dev/null +++ b/common/changelog/add-table-mssql-patch.xml @@ -0,0 +1,42 @@ + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+
+
diff --git a/common/changelog/add-table-mysql-diff.xml b/common/changelog/add-table-mysql-diff.xml new file mode 100644 index 0000000..019e51c --- /dev/null +++ b/common/changelog/add-table-mysql-diff.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
diff --git a/common/changelog/add-table-mysql-patch.xml b/common/changelog/add-table-mysql-patch.xml new file mode 100644 index 0000000..127139a --- /dev/null +++ b/common/changelog/add-table-mysql-patch.xml @@ -0,0 +1,42 @@ + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+
+
diff --git a/common/changelog/add-table-oracle-diff.xml b/common/changelog/add-table-oracle-diff.xml new file mode 100644 index 0000000..e04ba2b --- /dev/null +++ b/common/changelog/add-table-oracle-diff.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
diff --git a/common/changelog/add-table-oracle-patch.xml b/common/changelog/add-table-oracle-patch.xml new file mode 100644 index 0000000..b0e32c0 --- /dev/null +++ b/common/changelog/add-table-oracle-patch.xml @@ -0,0 +1,42 @@ + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+
+
diff --git a/common/changelog/add-table-pgsql-diff.xml b/common/changelog/add-table-pgsql-diff.xml new file mode 100644 index 0000000..61c4985 --- /dev/null +++ b/common/changelog/add-table-pgsql-diff.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
diff --git a/common/changelog/add-table-pgsql-patch.xml b/common/changelog/add-table-pgsql-patch.xml new file mode 100644 index 0000000..33f8850 --- /dev/null +++ b/common/changelog/add-table-pgsql-patch.xml @@ -0,0 +1,42 @@ + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+
+
diff --git a/common/changelog/add-table-sqlite-diff.xml b/common/changelog/add-table-sqlite-diff.xml new file mode 100644 index 0000000..97b7e24 --- /dev/null +++ b/common/changelog/add-table-sqlite-diff.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
diff --git a/common/changelog/add-table-sqlite-patch.xml b/common/changelog/add-table-sqlite-patch.xml new file mode 100644 index 0000000..84c9d75 --- /dev/null +++ b/common/changelog/add-table-sqlite-patch.xml @@ -0,0 +1,42 @@ + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+
+
diff --git a/common/changelog/add-table.hxx b/common/changelog/add-table.hxx new file mode 100644 index 0000000..8dfabc6 --- /dev/null +++ b/common/changelog/add-table.hxx @@ -0,0 +1,35 @@ +// file : common/changelog/add-table.hxx +// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ADD_TABLE_HXX +#define ADD_TABLE_HXX + +#include + +#pragma db model version(BVER, CVER, true) + +struct object1; + +#if CVER > 1 +#pragma db object +struct object +{ + #pragma db id auto + int id; + int num; + + std::vector nums; + object1* o1; +}; +#endif + +#pragma db object +struct object1 +{ + #pragma db id + int id; + int num; +}; + +#endif // ADD_TABLE_HXX diff --git a/common/changelog/drop-table-mssql-diff.xml b/common/changelog/drop-table-mssql-diff.xml new file mode 100644 index 0000000..7d6779e --- /dev/null +++ b/common/changelog/drop-table-mssql-diff.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + +
+
+
diff --git a/common/changelog/drop-table-mssql-patch.xml b/common/changelog/drop-table-mssql-patch.xml new file mode 100644 index 0000000..c6003ea --- /dev/null +++ b/common/changelog/drop-table-mssql-patch.xml @@ -0,0 +1,11 @@ + + + + + + + + +
+
+
diff --git a/common/changelog/drop-table-mysql-diff.xml b/common/changelog/drop-table-mysql-diff.xml new file mode 100644 index 0000000..4b223fb --- /dev/null +++ b/common/changelog/drop-table-mysql-diff.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + +
+
+
diff --git a/common/changelog/drop-table-mysql-patch.xml b/common/changelog/drop-table-mysql-patch.xml new file mode 100644 index 0000000..c6003ea --- /dev/null +++ b/common/changelog/drop-table-mysql-patch.xml @@ -0,0 +1,11 @@ + + + + + + + + +
+
+
diff --git a/common/changelog/drop-table-oracle-diff.xml b/common/changelog/drop-table-oracle-diff.xml new file mode 100644 index 0000000..9334585 --- /dev/null +++ b/common/changelog/drop-table-oracle-diff.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + +
+
+
diff --git a/common/changelog/drop-table-oracle-patch.xml b/common/changelog/drop-table-oracle-patch.xml new file mode 100644 index 0000000..309aa86 --- /dev/null +++ b/common/changelog/drop-table-oracle-patch.xml @@ -0,0 +1,11 @@ + + + + + + + + +
+
+
diff --git a/common/changelog/drop-table-pgsql-diff.xml b/common/changelog/drop-table-pgsql-diff.xml new file mode 100644 index 0000000..18d01f6 --- /dev/null +++ b/common/changelog/drop-table-pgsql-diff.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + +
+
+
diff --git a/common/changelog/drop-table-pgsql-patch.xml b/common/changelog/drop-table-pgsql-patch.xml new file mode 100644 index 0000000..393a20f --- /dev/null +++ b/common/changelog/drop-table-pgsql-patch.xml @@ -0,0 +1,11 @@ + + + + + + + + +
+
+
diff --git a/common/changelog/drop-table-sqlite-diff.xml b/common/changelog/drop-table-sqlite-diff.xml new file mode 100644 index 0000000..5277fd8 --- /dev/null +++ b/common/changelog/drop-table-sqlite-diff.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + +
+
+
diff --git a/common/changelog/drop-table-sqlite-patch.xml b/common/changelog/drop-table-sqlite-patch.xml new file mode 100644 index 0000000..393a20f --- /dev/null +++ b/common/changelog/drop-table-sqlite-patch.xml @@ -0,0 +1,11 @@ + + + + + + + + +
+
+
diff --git a/common/changelog/drop-table.hxx b/common/changelog/drop-table.hxx new file mode 100644 index 0000000..a28c0d4 --- /dev/null +++ b/common/changelog/drop-table.hxx @@ -0,0 +1,35 @@ +// file : common/changelog/drop-table.hxx +// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef DROP_TABLE_HXX +#define DROP_TABLE_HXX + +#include + +#pragma db model version(BVER, CVER, true) + +struct object1; + +#if CVER == 1 +#pragma db object +struct object +{ + #pragma db id auto + int id; + int num; + + std::vector nums; + object1* o1; +}; +#endif + +#pragma db object +struct object1 +{ + #pragma db id + int id; + int num; +}; + +#endif // DROP_TABLE_HXX diff --git a/common/changelog/makefile b/common/changelog/makefile new file mode 100644 index 0000000..0819616 --- /dev/null +++ b/common/changelog/makefile @@ -0,0 +1,97 @@ +# file : common/changelog/makefile +# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make + +odb_hdr := model.hxx add-table.hxx drop-table.hxx + +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,\ + $(scf_root)/import/odb/stub.make,\ + odb: odb,odb-rules: odb_rules) + +# Build. +# +$(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) $(dist): export odb_options += --database $(db_id) \ +--generate-schema-only --schema-format sql --changelog-dir $(out_base) +$(gen): cpp_options := -I$(src_base) +$(gen): $(common.l.cpp-options) + +ifdef STEP + +ifeq ($(STEP),1) +$(gen): cpp_options += -DBVER=1 -DCVER=1 # Initialize. +else ifeq ($(STEP),2) +$(gen): cpp_options += -DBVER=1 -DCVER=2 # Diff. +else ifeq ($(STEP),3) +$(gen): cpp_options += -DBVER=2 -DCVER=3 # Patch (via rewind). +else +$(error unexpected STEP value $(STEP) +endif + +$(default): $(gen) +else +$(default): ;@: +endif + +# Dist: not supported. +# +$(dist): + +# Test. +# +$(test): tests := $(odb_hdr:.hxx=) +$(test): diff = $(call message,,diff -u $(src_base)/$1-$(db_id)-$2.xml \ +$(out_base)/$1.xml)$(literal_newline)$(literal_tab) +$(test): | $(out_base)/. + $(call message,,rm -f $(addprefix $(out_base)/,$(addsuffix .xml,$(tests)))) + $(call message,,$(MAKE) --no-print-directory -C $(out_base) -f $(src_base)/makefile STEP=1) + $(call message,,$(MAKE) --no-print-directory -C $(out_base) -f $(src_base)/makefile STEP=2) + $(foreach t,$(tests),$(call diff,$t,diff)) + $(call message,,$(MAKE) --no-print-directory -C $(out_base) -f $(src_base)/makefile STEP=3) + $(foreach t,$(tests),$(call diff,$t,patch)) + +# Clean. +# +$(clean): changelogs := $(addprefix $(out_base)/,$(odb_hdr:.hxx=.xml)) +$(clean): $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean)) + $(call message,,rm -f $(changelogs)) + +# Generated .gitignore. +# +ifeq ($(out_base),$(src_base)) +$(default) $(test): | $(out_base)/.gitignore + +$(out_base)/.gitignore: files := $(genf) +$(clean): $(out_base)/.gitignore.clean + +$(call include,$(bld_root)/git/gitignore.make) +endif + +# How to. +# +$(call include,$(bld_root)/cxx/standard.make) # cxx_standard +ifdef cxx_standard +$(gen): odb_options += --std $(cxx_standard) +$(call include,$(odb_rules)) +endif + +# Dependencies. +# +$(call import,$(src_root)/libcommon/makefile) diff --git a/common/changelog/model-mssql-diff.xml b/common/changelog/model-mssql-diff.xml new file mode 120000 index 0000000..e1f812d --- /dev/null +++ b/common/changelog/model-mssql-diff.xml @@ -0,0 +1 @@ +model-mssql.xml \ No newline at end of file diff --git a/common/changelog/model-mssql-patch.xml b/common/changelog/model-mssql-patch.xml new file mode 120000 index 0000000..e1f812d --- /dev/null +++ b/common/changelog/model-mssql-patch.xml @@ -0,0 +1 @@ +model-mssql.xml \ No newline at end of file diff --git a/common/changelog/model-mssql.xml b/common/changelog/model-mssql.xml new file mode 100644 index 0000000..d9689a0 --- /dev/null +++ b/common/changelog/model-mssql.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+
diff --git a/common/changelog/model-mysql-diff.xml b/common/changelog/model-mysql-diff.xml new file mode 120000 index 0000000..9100280 --- /dev/null +++ b/common/changelog/model-mysql-diff.xml @@ -0,0 +1 @@ +model-mysql.xml \ No newline at end of file diff --git a/common/changelog/model-mysql-patch.xml b/common/changelog/model-mysql-patch.xml new file mode 120000 index 0000000..9100280 --- /dev/null +++ b/common/changelog/model-mysql-patch.xml @@ -0,0 +1 @@ +model-mysql.xml \ No newline at end of file diff --git a/common/changelog/model-mysql.xml b/common/changelog/model-mysql.xml new file mode 100644 index 0000000..ed46ebe --- /dev/null +++ b/common/changelog/model-mysql.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+
diff --git a/common/changelog/model-oracle-diff.xml b/common/changelog/model-oracle-diff.xml new file mode 120000 index 0000000..36e4479 --- /dev/null +++ b/common/changelog/model-oracle-diff.xml @@ -0,0 +1 @@ +model-oracle.xml \ No newline at end of file diff --git a/common/changelog/model-oracle-patch.xml b/common/changelog/model-oracle-patch.xml new file mode 120000 index 0000000..36e4479 --- /dev/null +++ b/common/changelog/model-oracle-patch.xml @@ -0,0 +1 @@ +model-oracle.xml \ No newline at end of file diff --git a/common/changelog/model-oracle.xml b/common/changelog/model-oracle.xml new file mode 100644 index 0000000..756a355 --- /dev/null +++ b/common/changelog/model-oracle.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+
diff --git a/common/changelog/model-pgsql-diff.xml b/common/changelog/model-pgsql-diff.xml new file mode 120000 index 0000000..b39ce26 --- /dev/null +++ b/common/changelog/model-pgsql-diff.xml @@ -0,0 +1 @@ +model-pgsql.xml \ No newline at end of file diff --git a/common/changelog/model-pgsql-patch.xml b/common/changelog/model-pgsql-patch.xml new file mode 120000 index 0000000..b39ce26 --- /dev/null +++ b/common/changelog/model-pgsql-patch.xml @@ -0,0 +1 @@ +model-pgsql.xml \ No newline at end of file diff --git a/common/changelog/model-pgsql.xml b/common/changelog/model-pgsql.xml new file mode 100644 index 0000000..6dad23b --- /dev/null +++ b/common/changelog/model-pgsql.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+
diff --git a/common/changelog/model-sqlite-diff.xml b/common/changelog/model-sqlite-diff.xml new file mode 120000 index 0000000..3454f51 --- /dev/null +++ b/common/changelog/model-sqlite-diff.xml @@ -0,0 +1 @@ +model-sqlite.xml \ No newline at end of file diff --git a/common/changelog/model-sqlite-patch.xml b/common/changelog/model-sqlite-patch.xml new file mode 120000 index 0000000..3454f51 --- /dev/null +++ b/common/changelog/model-sqlite-patch.xml @@ -0,0 +1 @@ +model-sqlite.xml \ No newline at end of file diff --git a/common/changelog/model-sqlite.xml b/common/changelog/model-sqlite.xml new file mode 100644 index 0000000..9f22af0 --- /dev/null +++ b/common/changelog/model-sqlite.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+
diff --git a/common/changelog/model.hxx b/common/changelog/model.hxx new file mode 100644 index 0000000..e4c630e --- /dev/null +++ b/common/changelog/model.hxx @@ -0,0 +1,47 @@ +// file : common/changelog/model.hxx +// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef MODEL_HXX +#define MODEL_HXX + +#include + +#pragma db model version(1, 1, true) + +#pragma db value +struct value +{ + int x; + int y; +}; + +struct object1; + +#pragma db object +struct object +{ + #pragma db id auto + int id; + + #pragma db null default(0) options("DUMMY=1") + int num; + + #pragma db index unique member(num, "DESC") method("BTREE") options("DUMMY=1") + + #pragma db index + value v; // Multi-column. + + std::vector nums; + object1* o1; +}; + +#pragma db object +struct object1 +{ + #pragma db id + value id; // Multi-column. + int num; +}; + +#endif // MODEL_HXX -- cgit v1.1