diff options
100 files changed, 2279 insertions, 1995 deletions
diff --git a/libodb-mssql/manifest b/libodb-mssql/manifest index 8600473..535560c 100644 --- a/libodb-mssql/manifest +++ b/libodb-mssql/manifest @@ -26,7 +26,7 @@ depends: libodb == $ depends: * cli ^1.2.0- ? ($config.libodb_mssql.develop) #tests: odb-tests == $ \ -#? (!$defined(config.odb_tests.database)) config.odb_tests.database=mssql +# ? (!$defined(config.odb_tests.database)) config.odb_tests.database=mssql # @@ TMP # diff --git a/libodb-mysql/manifest b/libodb-mysql/manifest index bcd0e8e..83926a0 100644 --- a/libodb-mysql/manifest +++ b/libodb-mysql/manifest @@ -26,7 +26,7 @@ depends: libodb == $ depends: * cli ^1.2.0- ? ($config.libodb_mysql.develop) #tests: odb-tests == $ \ -#? (!$defined(config.odb_tests.database)) config.odb_tests.database=mysql +# ? (!$defined(config.odb_tests.database)) config.odb_tests.database=mysql # @@ TMP # diff --git a/libodb-oracle/manifest b/libodb-oracle/manifest index 2a0af77..d39d166 100644 --- a/libodb-oracle/manifest +++ b/libodb-oracle/manifest @@ -25,7 +25,7 @@ depends: libodb == $ depends: * cli ^1.2.0- ? ($config.libodb_oracle.develop) #tests: odb-tests == $ \ -#? (!$defined(config.odb_tests.database)) config.odb_tests.database=oracle +# ? (!$defined(config.odb_tests.database)) config.odb_tests.database=oracle # @@ TMP # diff --git a/libodb-pgsql/manifest b/libodb-pgsql/manifest index a3721c4..e9176f0 100644 --- a/libodb-pgsql/manifest +++ b/libodb-pgsql/manifest @@ -25,7 +25,7 @@ depends: libodb == $ depends: * cli ^1.2.0- ? ($config.libodb_pgsql.develop) #tests: odb-tests == $ \ -#? (!$defined(config.odb_tests.database)) config.odb_tests.database=pgsql +# ? (!$defined(config.odb_tests.database)) config.odb_tests.database=pgsql # @@ TMP # diff --git a/libodb-sqlite/manifest b/libodb-sqlite/manifest index 95634b2..2977964 100644 --- a/libodb-sqlite/manifest +++ b/libodb-sqlite/manifest @@ -25,7 +25,7 @@ depends: libodb == $ depends: * cli ^1.2.0- ? ($config.libodb_sqlite.develop) tests: odb-tests == $ \ -? (!$defined(config.odb_tests.database)) config.odb_tests.database=sqlite + ? (!$defined(config.odb_tests.database)) config.odb_tests.database=sqlite # @@ TMP # diff --git a/odb-tests/build/root.build b/odb-tests/build/root.build index 402be67..75386bf 100644 --- a/odb-tests/build/root.build +++ b/odb-tests/build/root.build @@ -197,7 +197,21 @@ if! $skeleton testscript{*}: pgsql_client = $pgsql_client } - # Note that we need ((-.+)?) instead of just (-.+)? because we use this + # Notes: + # + # - The second prerequisite ($<[1]) is expected to be a metadata library + # target which we will use to extract the poptions variable value for + # specifying the contained options on the ODB compiler command line. + # + # - The additional options for the ODB compiler command line must be + # specified via the odb_options variable. + # + # - If the pre/post-migration SQL files are being generated, then the + # version numbers the object model is being migrated through must be + # specified via the schema_versions variable in the NNN form (001 002, + # etc; see the implementation for details). + # + # Also note that we need ((-.+)?) instead of just (-.+)? because we use this # capture as a back-reference in the pattern. # [rule_name=odb_compile] \ @@ -239,12 +253,51 @@ if! $skeleton schema_format = '' end - t = ($schema_format == 'sql' \ - ? $directory($hp)/$regex.replace($bn, '(.+)-odb(-.+)?', '\1\2').sql \ - : '') + ts = ($schema_format == 'sql' \ + ? "$directory($hp)/$regex.replace($bn, '(.+)-odb(-.+)?', '\1\2').sql" \ + : '') + + # If the object model change log and/or migration SQL files will be + # generated, then add them as a dynamic target group member. + # + changelog = '' + init_changelog = false + suppress_migration = false + + for o: $odb_options + if ($o == '--changelog') + changelog = [null] # Indicate that the changelog path comes next. + elif ($changelog == [null]) + changelog = $o + elif ($o == '--init-changelog') + init_changelog = true + elif ($o == '--suppress-migration') + suppress_migration = true + end + end + + if ($changelog != '') + if ($init_changelog) + ts = ($ts == '' ? "$changelog" : "$ts$\n$changelog") + end + + if ($schema_format == 'sql' && !$suppress_migration) + n = $base($leaf($path($<[0]))) + + # Note that it's not easy to deduce the object model migration files + # list. Thus, we expect the version numbers the object model is being + # migrated through to be explicitly specified via the schema_versions + # variable. + # + for v: $schema_versions + ns = "$out_base/$n-$v-pre.sql$\n$out_base/$n-$v-post.sql" + ts = ($ts == '' ? "$ns" : "$ts$\n$ns") + end + end + end depdb dyndep --dyn-target --target-what 'generated schema' --format lines \ - -- echo "$t" + -- echo "$ts" $odb --std c++11 \ ($multi ? --multi-database dynamic : ) \ diff --git a/odb-tests/buildfile b/odb-tests/buildfile index 2acd9fc..82e8fe9 100644 --- a/odb-tests/buildfile +++ b/odb-tests/buildfile @@ -7,4 +7,6 @@ ./: sqlite/: include = ($sqlite && !$multi) ./: pgsql/: include = ($pgsql && !$multi) +./: evolution/: include = (!$multi) + ./: testscript{*}: include = adhoc diff --git a/odb-tests/common/circular/multiple/buildfile b/odb-tests/common/circular/multiple/buildfile index b060cb5..51a1191 100644 --- a/odb-tests/common/circular/multiple/buildfile +++ b/odb-tests/common/circular/multiple/buildfile @@ -10,7 +10,7 @@ for db: $databases import libs += lib{common} -hs = test1 test2 +hdrs = test1 test2 exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript @@ -19,7 +19,7 @@ exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript # libue{test-meta}: $libodb -for h: $hs +for h: $hdrs { exe{driver}: {hxx ixx cxx}{$h-odb} diff --git a/odb-tests/common/definition/buildfile b/odb-tests/common/definition/buildfile index 09ad1db..83a09ff 100644 --- a/odb-tests/common/definition/buildfile +++ b/odb-tests/common/definition/buildfile @@ -10,7 +10,7 @@ for db: $databases import libs += lib{common} -hs = test time-mapping +hdrs = test time-mapping exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript @@ -19,7 +19,7 @@ exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript # libue{test-meta}: $libodb -for h: $hs +for h: $hdrs { exe{driver}: {hxx ixx cxx}{$h-odb} diff --git a/odb-tests/common/include/buildfile b/odb-tests/common/include/buildfile index 6db878c..c9ae42e 100644 --- a/odb-tests/common/include/buildfile +++ b/odb-tests/common/include/buildfile @@ -10,7 +10,7 @@ for db: $databases import libs += lib{common} -hs = obj1 obj2 obj3 test1 test2 test3 test4 +hdrs = obj1 obj2 obj3 test1 test2 test3 test4 exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript @@ -19,7 +19,7 @@ exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript # libue{test-meta}: $libodb -for h: $hs +for h: $hdrs { exe{driver}: {hxx ixx cxx}{$h-odb} diff --git a/odb-tests/common/inheritance/polymorphism/buildfile b/odb-tests/common/inheritance/polymorphism/buildfile index 846eb12..40fc978 100644 --- a/odb-tests/common/inheritance/polymorphism/buildfile +++ b/odb-tests/common/inheritance/polymorphism/buildfile @@ -10,8 +10,8 @@ for db: $databases import libs += lib{common} -hs = test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 \ - test12 test13 test14 test15 +hdrs = test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 \ + test12 test13 test14 test15 exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript @@ -20,7 +20,7 @@ exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript # libue{test-meta}: $libodb -for h: $hs +for h: $hdrs { exe{driver}: {hxx ixx cxx}{$h-odb} @@ -49,4 +49,4 @@ cxx.poptions =+ "-I$out_base" "-I$src_base" # exe{driver}: ../../../alias{database-client}: include = adhoc -testscript@./: schemas = $hs +testscript@./: schemas = $hdrs diff --git a/odb-tests/common/schema/embedded/order/buildfile b/odb-tests/common/schema/embedded/order/buildfile index 57ad7dd..b2fac0b 100644 --- a/odb-tests/common/schema/embedded/order/buildfile +++ b/odb-tests/common/schema/embedded/order/buildfile @@ -10,7 +10,7 @@ for db: $databases import libs += lib{common} -hs = test1 test2 +hdrs = test1 test2 exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript @@ -19,7 +19,7 @@ exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript # libue{test-meta}: $libodb -for h: $hs +for h: $hdrs { exe{driver}: {hxx ixx cxx}{$h-odb} diff --git a/odb-tests/common/view/olv/buildfile b/odb-tests/common/view/olv/buildfile index 89ecbcf..1edf0b4 100644 --- a/odb-tests/common/view/olv/buildfile +++ b/odb-tests/common/view/olv/buildfile @@ -10,7 +10,7 @@ for db: $databases import libs += lib{common} -hs = test1 test2 test3 test4 test5 test6 test7 test8 test9 +hdrs = test1 test2 test3 test4 test5 test6 test7 test8 test9 exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript @@ -19,7 +19,7 @@ exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} testscript # libue{test-meta}: $libodb -for h: $hs +for h: $hdrs { exe{driver}: {hxx ixx cxx}{$h-odb} @@ -47,4 +47,4 @@ cxx.poptions =+ "-I$out_base" "-I$src_base" # exe{driver}: ../../../alias{database-client}: include = adhoc -testscript@./: schemas = $hs +testscript@./: schemas = $hdrs diff --git a/odb-tests/evolution/.gitignore b/odb-tests/evolution/.gitignore new file mode 100644 index 0000000..9a410c7 --- /dev/null +++ b/odb-tests/evolution/.gitignore @@ -0,0 +1,15 @@ +# ODB-generated files. +# +test1-odb.?xx +test1.sql +model.xml + +test2-odb.?xx +test2.sql + +test3-odb.?xx +test3.sql +test3-002-post.sql +test3-002-pre.sql +test3-003-post.sql +test3-003-pre.sql diff --git a/odb-tests/evolution/add-column/buildfile b/odb-tests/evolution/add-column/buildfile new file mode 100644 index 0000000..efa6b6d --- /dev/null +++ b/odb-tests/evolution/add-column/buildfile @@ -0,0 +1,63 @@ +# file : evolution/add-column/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} + +import libs = libodb-$db%lib{odb-$db} +import libs += lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_add_c_ \ + --schema-version-table evo_add_c_sv \ + --generate-schema \ + --generate-query \ + --at-once \ + --changelog $out_base/model.xml + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/add-column/driver.cxx b/odb-tests/evolution/add-column/driver.cxx index d4eb396..c729732 100644 --- a/odb-tests/evolution/add-column/driver.cxx +++ b/odb-tests/evolution/add-column/driver.cxx @@ -4,21 +4,23 @@ // Test adding a new column. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/common.hxx> +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -27,7 +29,10 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_add_c_sv"); + bool embedded (schema_catalog::exists (*db)); // 1 - base version @@ -73,7 +78,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (!p->str); assert (p->num == 999); @@ -101,7 +106,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str && *p->str == "abc"); assert (p->num == 123); diff --git a/odb-tests/evolution/add-column/testscript b/odb-tests/evolution/add-column/testscript new file mode 100644 index 0000000..f4e3d99 --- /dev/null +++ b/odb-tests/evolution/add-column/testscript @@ -0,0 +1,54 @@ +# file : evolution/add-column/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + $* 1 &odb-test.db; + $* 2; + $* 3 +} diff --git a/odb-tests/evolution/add-foreign-key/buildfile b/odb-tests/evolution/add-foreign-key/buildfile new file mode 100644 index 0000000..0fe5468 --- /dev/null +++ b/odb-tests/evolution/add-foreign-key/buildfile @@ -0,0 +1,64 @@ +# file : evolution/add-foreign-key/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} +import libodb_db = libodb-$db%lib{odb-$db} +import libcommon = lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb and libcommon +# libraries are resolved for the odb_compile ad hoc rule (see build/root.build +# for details). +# +libue{test-meta}: $libodb $libcommon + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libodb_db + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_add_fk_ \ + --schema-version-table evo_add_fk_sv \ + --generate-schema \ + --generate-query \ + --at-once \ + --changelog $out_base/model.xml \ + --fkeys-deferrable-mode not_deferrable + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/add-foreign-key/driver.cxx b/odb-tests/evolution/add-foreign-key/driver.cxx index 177b615..dae9a9c 100644 --- a/odb-tests/evolution/add-foreign-key/driver.cxx +++ b/odb-tests/evolution/add-foreign-key/driver.cxx @@ -4,22 +4,24 @@ // Test adding a foreign key. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/config.hxx> // DATABASE_XXX -#include <common/common.hxx> +#include <libcommon/config.hxx> // DATABASE_XXX +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -28,7 +30,10 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_add_fk_sv"); + bool embedded (schema_catalog::exists (*db)); // 1 - base version @@ -83,7 +88,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->o1 == 0 && p->o2 == 0); @@ -122,7 +127,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->o1->id_ == 1); assert (p->o2->id_ == 1); t.commit (); diff --git a/odb-tests/evolution/add-foreign-key/model.hxx b/odb-tests/evolution/add-foreign-key/model.hxx index f5fe26d..17cd85f 100644 --- a/odb-tests/evolution/add-foreign-key/model.hxx +++ b/odb-tests/evolution/add-foreign-key/model.hxx @@ -9,7 +9,7 @@ #include <odb/core.hxx> -#include <common/config.hxx> // DATABASE_XXX +#include <libcommon/config.hxx> // DATABASE_XXX #pragma db model version(1, MODEL_VERSION) diff --git a/odb-tests/evolution/add-foreign-key/testscript b/odb-tests/evolution/add-foreign-key/testscript new file mode 100644 index 0000000..5447082 --- /dev/null +++ b/odb-tests/evolution/add-foreign-key/testscript @@ -0,0 +1,54 @@ +# file : evolution/add-foreign-key/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + $* 1 &odb-test.db; + $* 2; + $* 3 +} diff --git a/odb-tests/evolution/add-index/buildfile b/odb-tests/evolution/add-index/buildfile new file mode 100644 index 0000000..9835d1e --- /dev/null +++ b/odb-tests/evolution/add-index/buildfile @@ -0,0 +1,63 @@ +# file : evolution/add-index/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} + +import libs = libodb-$db%lib{odb-$db} +import libs += lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_add_i_ \ + --schema-version-table evo_add_i_sv \ + --generate-schema \ + --generate-query \ + --at-once \ + --changelog $out_base/model.xml + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/add-index/driver.cxx b/odb-tests/evolution/add-index/driver.cxx index 689504e..679aa4c 100644 --- a/odb-tests/evolution/add-index/driver.cxx +++ b/odb-tests/evolution/add-index/driver.cxx @@ -4,21 +4,23 @@ // Test adding a new index. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/common.hxx> +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -27,7 +29,10 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_add_i_sv"); + bool embedded (schema_catalog::exists (*db)); // 1 - base version @@ -128,8 +133,8 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p0 (db->load<object> (0)); - auto_ptr<object> p1 (db->load<object> (1)); + unique_ptr<object> p0 (db->load<object> (0)); + unique_ptr<object> p1 (db->load<object> (1)); assert (p0->num == 123); assert (p1->num == 234); diff --git a/odb-tests/evolution/add-index/testscript b/odb-tests/evolution/add-index/testscript new file mode 100644 index 0000000..ceb17ff --- /dev/null +++ b/odb-tests/evolution/add-index/testscript @@ -0,0 +1,54 @@ +# file : evolution/add-index/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + $* 1 &odb-test.db; + $* 2; + $* 3 +} diff --git a/odb-tests/evolution/add-table/buildfile b/odb-tests/evolution/add-table/buildfile new file mode 100644 index 0000000..d17cd70 --- /dev/null +++ b/odb-tests/evolution/add-table/buildfile @@ -0,0 +1,63 @@ +# file : evolution/add-table/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} + +import libs = libodb-$db%lib{odb-$db} +import libs += lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_add_t_ \ + --schema-version-table evo_add_t_sv \ + --generate-schema \ + --generate-query \ + --at-once \ + --changelog $out_base/model.xml + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/add-table/driver.cxx b/odb-tests/evolution/add-table/driver.cxx index 67b0f0e..36f4d15 100644 --- a/odb-tests/evolution/add-table/driver.cxx +++ b/odb-tests/evolution/add-table/driver.cxx @@ -4,22 +4,24 @@ // Test adding a new table (object, container). // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/config.hxx> // DATABASE_XXX -#include <common/common.hxx> +#include <libcommon/config.hxx> // DATABASE_XXX +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -28,7 +30,10 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_add_t_sv"); + bool embedded (schema_catalog::exists (*db)); // 1 - base version diff --git a/odb-tests/evolution/add-table/testscript b/odb-tests/evolution/add-table/testscript new file mode 100644 index 0000000..9317e37 --- /dev/null +++ b/odb-tests/evolution/add-table/testscript @@ -0,0 +1,54 @@ +# file : evolution/add-table/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + $* 1 &odb-test.db; + $* 2; + $* 3 +} diff --git a/odb-tests/evolution/alter-column/buildfile b/odb-tests/evolution/alter-column/buildfile new file mode 100644 index 0000000..08b0ed7 --- /dev/null +++ b/odb-tests/evolution/alter-column/buildfile @@ -0,0 +1,63 @@ +# file : evolution/alter-column/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} +import libodb_db = libodb-$db%lib{odb-$db} +import libcommon = lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb and libcommon +# libraries are resolved for the odb_compile ad hoc rule (see build/root.build +# for details). +# +libue{test-meta}: $libodb $libcommon + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libodb_db + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_alter_c_ \ + --schema-version-table evo_alter_c_sv \ + --generate-schema \ + --generate-query \ + --at-once \ + --changelog $out_base/model.xml + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/alter-column/driver.cxx b/odb-tests/evolution/alter-column/driver.cxx index be63f05..f307546 100644 --- a/odb-tests/evolution/alter-column/driver.cxx +++ b/odb-tests/evolution/alter-column/driver.cxx @@ -4,21 +4,23 @@ // Test altering a column. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/common.hxx> +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -27,7 +29,9 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_alter_c_sv"); // SQLite doesn't support altering of columns. // @@ -80,7 +84,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (!p->str); assert (p->num && *p->num == 123); @@ -110,7 +114,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str && *p->str == "abc"); assert (!p->num); diff --git a/odb-tests/evolution/alter-column/model.hxx b/odb-tests/evolution/alter-column/model.hxx index fc6661c..8378887 100644 --- a/odb-tests/evolution/alter-column/model.hxx +++ b/odb-tests/evolution/alter-column/model.hxx @@ -10,7 +10,7 @@ #include <odb/core.hxx> #include <odb/nullable.hxx> -#include <common/config.hxx> // DATABASE_XXX +#include <libcommon/config.hxx> // DATABASE_XXX #pragma db model version(1, MODEL_VERSION) diff --git a/odb-tests/evolution/alter-column/testscript b/odb-tests/evolution/alter-column/testscript new file mode 100644 index 0000000..83e1a0f --- /dev/null +++ b/odb-tests/evolution/alter-column/testscript @@ -0,0 +1,55 @@ +# file : evolution/alter-column/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + # Note that SQLite doesn't support altering of columns and so the driver is + # trivial. We, however, still run it once for good measure. + # + $* 1 +} diff --git a/odb-tests/evolution/combined/buildfile b/odb-tests/evolution/combined/buildfile new file mode 100644 index 0000000..0ccce68 --- /dev/null +++ b/odb-tests/evolution/combined/buildfile @@ -0,0 +1,64 @@ +# file : evolution/combined/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} +import libodb_db = libodb-$db%lib{odb-$db} +import libcommon = lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb and libcommon +# libraries are resolved for the odb_compile ad hoc rule (see build/root.build +# for details). +# +libue{test-meta}: $libodb $libcommon + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libodb_db + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_comb_ \ + --schema-version-table evo_comb_sv \ + --generate-schema \ + --generate-query \ + --at-once \ + --changelog $out_base/model.xml \ + --sqlite-override-null + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/combined/driver.cxx b/odb-tests/evolution/combined/driver.cxx index 88453c3..027bddd 100644 --- a/odb-tests/evolution/combined/driver.cxx +++ b/odb-tests/evolution/combined/driver.cxx @@ -4,21 +4,23 @@ // Combined schema evolution test. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/common.hxx> +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -27,7 +29,10 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_comb_sv"); + bool embedded (schema_catalog::exists (*db)); // 1 - base version @@ -89,7 +94,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> ("1")); + unique_ptr<object> p (db->load<object> ("1")); assert (p->ac1 == 999); assert (!p->ac2); @@ -126,7 +131,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> ("1")); + unique_ptr<object> p (db->load<object> ("1")); // Check post-migration. // diff --git a/odb-tests/evolution/combined/model.hxx b/odb-tests/evolution/combined/model.hxx index e924943..5f1180b 100644 --- a/odb-tests/evolution/combined/model.hxx +++ b/odb-tests/evolution/combined/model.hxx @@ -11,7 +11,7 @@ #include <odb/core.hxx> #include <odb/nullable.hxx> -#include <common/config.hxx> // DATABASE_XXX +#include <libcommon/config.hxx> // DATABASE_XXX #pragma db model version(1, MODEL_VERSION) diff --git a/odb-tests/evolution/combined/testscript b/odb-tests/evolution/combined/testscript new file mode 100644 index 0000000..a7bb826 --- /dev/null +++ b/odb-tests/evolution/combined/testscript @@ -0,0 +1,54 @@ +# file : evolution/combined/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + $* 1 &odb-test.db; + $* 2; + $* 3 +} diff --git a/odb-tests/evolution/data/buildfile b/odb-tests/evolution/data/buildfile new file mode 100644 index 0000000..d013cab --- /dev/null +++ b/odb-tests/evolution/data/buildfile @@ -0,0 +1,63 @@ +# file : evolution/data/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} + +import libs = libodb-$db%lib{odb-$db} +import libs += lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_data_ \ + --schema-version-table evo_data_sv \ + --generate-schema \ + --generate-query \ + --at-once \ + --changelog $out_base/model.xml + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/data/driver.cxx b/odb-tests/evolution/data/driver.cxx index 73cc852..966c72e 100644 --- a/odb-tests/evolution/data/driver.cxx +++ b/odb-tests/evolution/data/driver.cxx @@ -4,22 +4,24 @@ // Test data migration support. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/config.hxx> // DATABASE_XXX, HAVE_CXX11 -#include <common/common.hxx> +#include <libcommon/config.hxx> // DATABASE_XXX +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -29,7 +31,7 @@ migrate1 (database& db) using namespace v2; using namespace v3; - auto_ptr<object1> o1 (db.load<object1> (1)); + unique_ptr<object1> o1 (db.load<object1> (1)); object2 o2 (1); o2.num = o1->num; db.persist (o2); @@ -41,7 +43,7 @@ migrate2 (database& db) using namespace v2; using namespace v3; - auto_ptr<object1> o1 (db.load<object1> (2)); + unique_ptr<object1> o1 (db.load<object1> (2)); object2 o2 (2); o2.num = o1->num; db.persist (o2); @@ -54,23 +56,24 @@ main (int argc, char* argv[]) { schema_catalog::data_migration_function<3, 1> (&migrate1); -#ifdef HAVE_CXX11 schema_catalog::data_migration_function<3, 1> ( [] (database& db) { using namespace v2; using namespace v3; - auto_ptr<object1> o1 (db.load<object1> (11)); + unique_ptr<object1> o1 (db.load<object1> (11)); object2 o2 (11); o2.num = o1->num; db.persist (o2); }); -#endif try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_data_sv"); + bool embedded (schema_catalog::exists (*db)); // 1 - base version @@ -109,13 +112,12 @@ main (int argc, char* argv[]) db->persist (o1); } -#ifdef HAVE_CXX11 { object1 o1 (11); o1.num = 123; db->persist (o1); } -#endif + t.commit (); } break; @@ -143,21 +145,20 @@ main (int argc, char* argv[]) transaction t (db->begin ()); { - auto_ptr<object2> o2 (db->load<object2> (1)); + unique_ptr<object2> o2 (db->load<object2> (1)); assert (o2->num == 123); } { - auto_ptr<object2> o2 (db->load<object2> (2)); + unique_ptr<object2> o2 (db->load<object2> (2)); assert (o2->num == 123); } -#ifdef HAVE_CXX11 { - auto_ptr<object2> o2 (db->load<object2> (11)); + unique_ptr<object2> o2 (db->load<object2> (11)); assert (o2->num == 123); } -#endif + t.commit (); } diff --git a/odb-tests/evolution/data/testscript b/odb-tests/evolution/data/testscript new file mode 100644 index 0000000..5c91396 --- /dev/null +++ b/odb-tests/evolution/data/testscript @@ -0,0 +1,54 @@ +# file : evolution/data/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + $* 1 &odb-test.db; + $* 2; + $* 3 +} diff --git a/odb-tests/evolution/drop-column/buildfile b/odb-tests/evolution/drop-column/buildfile new file mode 100644 index 0000000..c508f76 --- /dev/null +++ b/odb-tests/evolution/drop-column/buildfile @@ -0,0 +1,64 @@ +# file : evolution/drop-column/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} + +import libs = libodb-$db%lib{odb-$db} +import libs += lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_drop_c_ \ + --schema-version-table evo_drop_c_sv \ + --generate-schema \ + --generate-query \ + --at-once \ + --changelog $out_base/model.xml \ + --sqlite-override-null + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/drop-column/driver.cxx b/odb-tests/evolution/drop-column/driver.cxx index 7f0c253..6f2a735 100644 --- a/odb-tests/evolution/drop-column/driver.cxx +++ b/odb-tests/evolution/drop-column/driver.cxx @@ -4,21 +4,23 @@ // Test dropping a column. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/common.hxx> +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -27,7 +29,10 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_drop_c_sv"); + bool embedded (schema_catalog::exists (*db)); // 1 - base version @@ -79,7 +84,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str == "abc"); assert (p->num == 123); @@ -104,7 +109,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str == "" && p->ptr == 0); db->erase<object1> (value (1, 2)); // SQLite logical delete test. t.commit (); diff --git a/odb-tests/evolution/drop-column/testscript b/odb-tests/evolution/drop-column/testscript new file mode 100644 index 0000000..abb81a8 --- /dev/null +++ b/odb-tests/evolution/drop-column/testscript @@ -0,0 +1,54 @@ +# file : evolution/drop-column/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + $* 1 &odb-test.db; + $* 2; + $* 3 +} diff --git a/odb-tests/evolution/drop-foreign-key/buildfile b/odb-tests/evolution/drop-foreign-key/buildfile new file mode 100644 index 0000000..6d1441e --- /dev/null +++ b/odb-tests/evolution/drop-foreign-key/buildfile @@ -0,0 +1,64 @@ +# file : evolution/drop-foreign-key/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} +import libodb_db = libodb-$db%lib{odb-$db} +import libcommon = lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb and libcommon +# libraries are resolved for the odb_compile ad hoc rule (see build/root.build +# for details). +# +libue{test-meta}: $libodb $libcommon + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libodb_db + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_drop_fk_ \ + --schema-version-table evo_drop_fk_sv \ + --generate-schema \ + --generate-query \ + --at-once \ + --changelog $out_base/model.xml \ + --fkeys-deferrable-mode not_deferrable + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/drop-foreign-key/driver.cxx b/odb-tests/evolution/drop-foreign-key/driver.cxx index f829562..c2829c4 100644 --- a/odb-tests/evolution/drop-foreign-key/driver.cxx +++ b/odb-tests/evolution/drop-foreign-key/driver.cxx @@ -4,21 +4,23 @@ // Test dropping a foreign key. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/common.hxx> +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -27,7 +29,9 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_drop_fk_sv"); // SQLite doesn't support dropping of foreign keys. // @@ -97,7 +101,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->o1 == 2); assert (p->o2 == 3); @@ -122,7 +126,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->o1 == 2); assert (p->o2 == 3); t.commit (); diff --git a/odb-tests/evolution/drop-foreign-key/model.hxx b/odb-tests/evolution/drop-foreign-key/model.hxx index eed8c46..a74d061 100644 --- a/odb-tests/evolution/drop-foreign-key/model.hxx +++ b/odb-tests/evolution/drop-foreign-key/model.hxx @@ -9,7 +9,7 @@ #include <odb/core.hxx> -#include <common/config.hxx> // DATABASE_XXX +#include <libcommon/config.hxx> // DATABASE_XXX #pragma db model version(1, MODEL_VERSION) diff --git a/odb-tests/evolution/drop-foreign-key/testscript b/odb-tests/evolution/drop-foreign-key/testscript new file mode 100644 index 0000000..637093b --- /dev/null +++ b/odb-tests/evolution/drop-foreign-key/testscript @@ -0,0 +1,55 @@ +# file : evolution/drop-foreign-key/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + # Note that SQLite doesn't support dropping of foreign keys and so the + # driver is trivial. We, however, still run it once for good measure. + # + $* 1 +} diff --git a/odb-tests/evolution/drop-index/buildfile b/odb-tests/evolution/drop-index/buildfile new file mode 100644 index 0000000..16cf57e --- /dev/null +++ b/odb-tests/evolution/drop-index/buildfile @@ -0,0 +1,63 @@ +# file : evolution/drop-index/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} + +import libs = libodb-$db%lib{odb-$db} +import libs += lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_drop_i_ \ + --schema-version-table evo_drop_i_sv \ + --generate-schema \ + --generate-query \ + --at-once \ + --changelog $out_base/model.xml + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/drop-index/driver.cxx b/odb-tests/evolution/drop-index/driver.cxx index 5ad1cd4..515591d 100644 --- a/odb-tests/evolution/drop-index/driver.cxx +++ b/odb-tests/evolution/drop-index/driver.cxx @@ -4,21 +4,23 @@ // Test dropping an index. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/common.hxx> +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -27,7 +29,10 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_drop_i_sv"); + bool embedded (schema_catalog::exists (*db)); // 1 - base version @@ -115,9 +120,9 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p0 (db->load<object> (0)); - auto_ptr<object> p1 (db->load<object> (1)); - auto_ptr<object> p2 (db->load<object> (2)); + unique_ptr<object> p0 (db->load<object> (0)); + unique_ptr<object> p1 (db->load<object> (1)); + unique_ptr<object> p2 (db->load<object> (2)); assert (p0->num == 123); assert (p1->num == 234); diff --git a/odb-tests/evolution/drop-index/testscript b/odb-tests/evolution/drop-index/testscript new file mode 100644 index 0000000..3bb6271 --- /dev/null +++ b/odb-tests/evolution/drop-index/testscript @@ -0,0 +1,54 @@ +# file : evolution/drop-index/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + $* 1 &odb-test.db; + $* 2; + $* 3 +} diff --git a/odb-tests/evolution/drop-table/buildfile b/odb-tests/evolution/drop-table/buildfile new file mode 100644 index 0000000..373ae9f --- /dev/null +++ b/odb-tests/evolution/drop-table/buildfile @@ -0,0 +1,63 @@ +# file : evolution/drop-table/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} + +import libs = libodb-$db%lib{odb-$db} +import libs += lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_drop_t_ \ + --schema-version-table evo_drop_t_sv \ + --generate-schema \ + --generate-query \ + --at-once \ + --changelog $out_base/model.xml + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/drop-table/driver.cxx b/odb-tests/evolution/drop-table/driver.cxx index 81cec55..8ef2e47 100644 --- a/odb-tests/evolution/drop-table/driver.cxx +++ b/odb-tests/evolution/drop-table/driver.cxx @@ -4,21 +4,23 @@ // Test dropping a table (object, container). // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/common.hxx> +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -27,7 +29,10 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_drop_t_sv"); + bool embedded (schema_catalog::exists (*db)); // 1 - base version @@ -137,7 +142,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str == "abc"); t.commit (); } diff --git a/odb-tests/evolution/drop-table/testscript b/odb-tests/evolution/drop-table/testscript new file mode 100644 index 0000000..a67ec7d --- /dev/null +++ b/odb-tests/evolution/drop-table/testscript @@ -0,0 +1,54 @@ +# file : evolution/drop-table/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + $* 1 &odb-test.db; + $* 2; + $* 3 +} diff --git a/odb-tests/evolution/embedded/buildfile b/odb-tests/evolution/embedded/buildfile new file mode 100644 index 0000000..095e476 --- /dev/null +++ b/odb-tests/evolution/embedded/buildfile @@ -0,0 +1,59 @@ +# file : evolution/embedded/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} + +import libs = libodb-$db%lib{odb-$db} +import libs += lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_embedded_ \ + --schema-version-table evo_embedded_sv \ + --generate-schema \ + --schema-format embedded \ + --generate-query \ + --at-once \ + --changelog $out_base/model.xml + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration +<{hxx ixx cxx}{test3-odb}>: odb_options += --omit-create + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/embedded/driver.cxx b/odb-tests/evolution/embedded/driver.cxx index 1816a5c..ac317cc 100644 --- a/odb-tests/evolution/embedded/driver.cxx +++ b/odb-tests/evolution/embedded/driver.cxx @@ -4,16 +4,15 @@ // Test embedded schema migration. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/config.hxx> // DATABASE_XXX -#include <common/common.hxx> +#include <libcommon/config.hxx> // DATABASE_XXX +#include <libcommon/common.hxx> #ifdef DATABASE_PGSQL # include <odb/pgsql/connection.hxx> @@ -24,6 +23,9 @@ #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -32,7 +34,9 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_embedded_sv"); // 1 - base version // 2 - migration @@ -113,7 +117,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object1> o1 (db->load<object1> (1)); + unique_ptr<object1> o1 (db->load<object1> (1)); object2 o2 (1); o2.num = o1->num; db->persist (o2); @@ -143,7 +147,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object2> o2 (db->load<object2> (1)); + unique_ptr<object2> o2 (db->load<object2> (1)); assert (o2->num == 123); t.commit (); } @@ -156,9 +160,9 @@ main (int argc, char* argv[]) transaction t (db->begin ()); #ifdef DATABASE_ORACLE - db->execute ("DROP TABLE \"schema_version\""); + db->execute ("DROP TABLE \"evo_embedded_sv\""); #else - db->execute ("DROP TABLE schema_version"); + db->execute ("DROP TABLE evo_embedded_sv"); #endif t.commit (); } diff --git a/odb-tests/evolution/embedded/testscript b/odb-tests/evolution/embedded/testscript new file mode 100644 index 0000000..3ddf983 --- /dev/null +++ b/odb-tests/evolution/embedded/testscript @@ -0,0 +1,21 @@ +# file : evolution/embedded/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + $* 1; + $* 2; + $* 3 +} +else +{ + $* 1 &odb-test.db; + $* 2; + $* 3 +} diff --git a/odb-tests/evolution/soft-add/buildfile b/odb-tests/evolution/soft-add/buildfile new file mode 100644 index 0000000..6a61697 --- /dev/null +++ b/odb-tests/evolution/soft-add/buildfile @@ -0,0 +1,64 @@ +# file : evolution/soft-add/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} + +import libs = libodb-$db%lib{odb-$db} +import libs += lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_soft_a_ \ + --schema-version-table evo_soft_a_sv \ + --generate-schema \ + --generate-query \ + --generate-prepared \ + --at-once \ + --changelog $out_base/model.xml + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/soft-add/driver.cxx b/odb-tests/evolution/soft-add/driver.cxx index c70edcb..a18c6a2 100644 --- a/odb-tests/evolution/soft-add/driver.cxx +++ b/odb-tests/evolution/soft-add/driver.cxx @@ -4,22 +4,24 @@ // Test soft-add functionality. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/config.hxx> // DATABASE_XXX -#include <common/common.hxx> +#include <libcommon/config.hxx> // DATABASE_XXX +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -28,7 +30,10 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_soft_a_sv"); + bool embedded (schema_catalog::exists (*db)); // 1 - base version @@ -85,7 +90,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str == "" && p->num == 123 && p->vec.empty () && p->ptr == 0); t.commit (); @@ -123,7 +128,7 @@ main (int argc, char* argv[]) transaction t (db->begin ()); db->persist (o); db->persist (*o.ptr); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "" && p->num == 234 && p->vec.empty () && p->ptr == 0); t.commit (); @@ -139,7 +144,7 @@ main (int argc, char* argv[]) transaction t (db->begin ()); db->erase<object1> (2); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "" && p->num == 235 && p->vec.empty () && p->ptr == 0); t.commit (); @@ -166,7 +171,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (o.id)); + unique_ptr<object> p (db->load<object> (o.id)); assert (p->str == ""); t.commit (); } @@ -176,7 +181,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (o.id)); + unique_ptr<object> p (db->load<object> (o.id)); assert (p->str == ""); t.commit (); } @@ -202,7 +207,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<base> p (db->load<base> (1)); + unique_ptr<base> p (db->load<base> (1)); assert (static_cast<object&> (*p).str == ""); db->erase (o); t.commit (); @@ -228,7 +233,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->vec[0].str == "" && p->vec[0].num == 123); t.commit (); } @@ -239,7 +244,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->vec[0].str == "" && p->vec[0].num == 234); t.commit (); } @@ -250,7 +255,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->vec[0].str == "" && p->vec[0].num == 235); t.commit (); } @@ -321,7 +326,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); try { @@ -383,7 +388,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); assert (p->str == "" && p->num == 123 && p->vec.empty ()); t.commit (); @@ -418,7 +423,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "" && p->num == 234 && p->vec.empty ()); t.commit (); @@ -431,7 +436,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "" && p->num == 234 && p->vec.empty ()); t.commit (); @@ -442,7 +447,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "" && p->num == 235 && p->vec.empty ()); t.commit (); @@ -476,7 +481,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (static_cast<object*> (db->load<base> (1))); + unique_ptr<object> p (static_cast<object*> (db->load<base> (1))); assert (p->bstr == "" && p->dstr == "" && p->num == 123); t.commit (); } @@ -530,7 +535,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->bstr == "" && p->dstr == "" && p->num == 234); t.commit (); } @@ -542,7 +547,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->bstr == "" && p->dstr == "" && p->num == 235); t.commit (); } @@ -575,7 +580,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<base> p (db->load<base> (1)); + unique_ptr<base> p (db->load<base> (1)); try { @@ -637,7 +642,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<base> p (db->load<base> (1)); + unique_ptr<base> p (db->load<base> (1)); db->load (*p, p->s); object& o (static_cast<object&> (*p)); assert (o.bstr == "" && o.dstr == "" && o.num == 123); @@ -695,7 +700,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->bstr == "" && p->dstr == "" && p->num == 234); t.commit (); @@ -709,7 +714,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->bstr == "" && p->dstr == "" && p->num == 235); t.commit (); @@ -729,7 +734,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (b); - auto_ptr<base> p (db->load<base> (3)); + unique_ptr<base> p (db->load<base> (3)); db->load (*p, p->s); assert (p->bstr == ""); t.commit (); @@ -741,7 +746,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (b); - auto_ptr<base> p (db->load<base> (3)); + unique_ptr<base> p (db->load<base> (3)); db->load (*p, p->s); assert (p->bstr == ""); t.commit (); @@ -774,7 +779,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str == "" && p->num == 123); t.commit (); } @@ -805,7 +810,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "" && p->num == 234); t.commit (); } @@ -818,7 +823,7 @@ main (int argc, char* argv[]) unsigned long long v (o.v_); db->update (o); assert (o.v_ != v); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "" && p->num == 235 && p->v_ == o.v_); t.commit (); } @@ -910,7 +915,7 @@ main (int argc, char* argv[]) } { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (id)); + unique_ptr<object> p (db->load<object> (id)); assert (p->str == "" && p->num == 123); t.commit (); } @@ -941,7 +946,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (o.id)); + unique_ptr<object> p (db->load<object> (o.id)); assert (p->str == "" && p->num == 234); t.commit (); } @@ -952,7 +957,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (o.id)); + unique_ptr<object> p (db->load<object> (o.id)); assert (p->str == "" && p->num == 235); t.commit (); } @@ -984,7 +989,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->num == 123 && p->vec.empty ()); t.commit (); } @@ -1007,7 +1012,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->num == 234 && p->vec.empty ()); t.commit (); } @@ -1018,7 +1023,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->num == 235 && p->vec.empty ()); t.commit (); } @@ -1050,7 +1055,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); assert (p->num == 123 && p->vec.empty ()); t.commit (); @@ -1076,7 +1081,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->num == 234 && p->vec.empty ()); t.commit (); @@ -1088,7 +1093,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->num == 234 && p->vec.empty ()); t.commit (); @@ -1099,7 +1104,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->num == 235 && p->vec.empty ()); t.commit (); @@ -1135,7 +1140,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); p->str = "abc"; p->vec.push_back (123); delete p->ptr; @@ -1146,7 +1151,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123 && p->ptr->id_ == 1); t.commit (); @@ -1177,7 +1182,7 @@ main (int argc, char* argv[]) transaction t (db->begin ()); db->persist (o); db->persist (*o.ptr); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "bcd" && p->num == 234 && p->vec[0] == 234 && p->ptr->id_ == 2); t.commit (); @@ -1193,7 +1198,7 @@ main (int argc, char* argv[]) transaction t (db->begin ()); db->erase<object1> (2); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "bcde" && p->num == 235 && p->vec[0] == 235 && p->ptr == 0); t.commit (); @@ -1216,7 +1221,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); p->vec.modify (0).str = "abc"; db->update (*p); t.commit (); @@ -1224,7 +1229,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->vec[0].str == "abc" && p->vec[0].num == 123); t.commit (); } @@ -1235,7 +1240,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->vec[0].str == "bcd" && p->vec[0].num == 234); t.commit (); } @@ -1246,7 +1251,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->vec[0].str == "bcde" && p->vec[0].num == 235); t.commit (); } @@ -1268,7 +1273,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); p->str = "abc"; db->update (*p); t.commit (); @@ -1296,7 +1301,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); p->str = "abc"; p->vec.push_back (123); @@ -1306,7 +1311,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123); t.commit (); @@ -1333,7 +1338,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "bcd" && p->num == 234 && p->vec[0] == 234); t.commit (); @@ -1346,7 +1351,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "bcde" && p->num == 235 && p->vec[0] == 235); t.commit (); @@ -1369,7 +1374,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); p->str = "abc"; p->vec.push_back (123); @@ -1379,7 +1384,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123); t.commit (); @@ -1406,7 +1411,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "bcd" && p->num == 234 && p->vec[0] == 234); t.commit (); @@ -1419,7 +1424,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "bcde" && p->num == 235 && p->vec[0] == 235); t.commit (); @@ -1442,7 +1447,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); p->bstr = "ab"; p->dstr = "abc"; db->update (*p); @@ -1451,7 +1456,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (static_cast<object*> (db->load<base> (1))); + unique_ptr<object> p (static_cast<object*> (db->load<base> (1))); assert (p->bstr == "ab" && p->dstr == "abc" && p->num == 123); t.commit (); } @@ -1477,7 +1482,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->bstr == "bc" && p->dstr == "bcd" && p->num == 234); t.commit (); } @@ -1489,7 +1494,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->bstr == "bcd" && p->dstr == "bcde" && p->num == 235); t.commit (); } @@ -1511,7 +1516,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); p->bstr = "ab"; p->dstr = "abc"; @@ -1521,7 +1526,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<base> p (db->load<base> (1)); + unique_ptr<base> p (db->load<base> (1)); db->load (*p, p->s); object& o (static_cast<object&> (*p)); assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123); @@ -1550,7 +1555,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->bstr == "bc" && p->dstr == "bcd" && p->num == 234); t.commit (); @@ -1564,7 +1569,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->bstr == "bcd" && p->dstr == "bcde" && p->num == 235); t.commit (); @@ -1587,7 +1592,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); p->bstr = "ab"; p->dstr = "abc"; @@ -1597,7 +1602,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<base> p (db->load<base> (1)); + unique_ptr<base> p (db->load<base> (1)); db->load (*p, p->s); object& o (static_cast<object&> (*p)); assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123); @@ -1626,7 +1631,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->bstr == "bc" && p->dstr == "bcd" && p->num == 234); t.commit (); @@ -1640,7 +1645,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->bstr == "bcd" && p->dstr == "bcde" && p->num == 235); t.commit (); @@ -1663,7 +1668,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); p->str = "abc"; db->update (*p); t.commit (); @@ -1671,7 +1676,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str == "abc" && p->num == 123); t.commit (); } @@ -1694,7 +1699,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "bcd" && p->num == 234); t.commit (); } @@ -1707,7 +1712,7 @@ main (int argc, char* argv[]) unsigned long long v (o.v_); db->update (o); assert (o.v_ != v); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "bcde" && p->num == 235 && p->v_ == o.v_); t.commit (); } @@ -1785,7 +1790,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (id)); + unique_ptr<object> p (db->load<object> (id)); assert (p->str == "abc" && p->num == 123); t.commit (); } @@ -1805,7 +1810,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (o.id)); + unique_ptr<object> p (db->load<object> (o.id)); assert (p->str == "bcd" && p->num == 234); t.commit (); } @@ -1816,7 +1821,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (o.id)); + unique_ptr<object> p (db->load<object> (o.id)); assert (p->str == "bcde" && p->num == 235); t.commit (); } @@ -1838,7 +1843,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); p->vec.push_back (123); db->update (*p); t.commit (); @@ -1846,7 +1851,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->num == 123 && p->vec[0] == 123); t.commit (); } @@ -1869,7 +1874,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->num == 234 && p->vec[0] == 234); t.commit (); } @@ -1880,7 +1885,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->num == 235 && p->vec[0] == 235); t.commit (); } @@ -1902,7 +1907,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); p->vec.push_back (123); db->update (*p, p->s); @@ -1911,7 +1916,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); assert (p->num == 123 && p->vec[0] == 123); t.commit (); @@ -1937,7 +1942,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->num == 234 && p->vec[0] == 234); t.commit (); @@ -1949,7 +1954,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->num == 235 && p->vec[0] == 235); t.commit (); @@ -1984,7 +1989,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123 && p->ptr->id_ == 1); t.commit (); @@ -2001,7 +2006,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->vec[0].str == "abc" && p->vec[0].num == 123); t.commit (); } @@ -2037,7 +2042,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123); t.commit (); @@ -2054,7 +2059,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123); t.commit (); @@ -2071,7 +2076,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (static_cast<object*> (db->load<base> (1))); + unique_ptr<object> p (static_cast<object*> (db->load<base> (1))); assert (p->bstr == "ab" && p->dstr == "abc" && p->num == 123); t.commit (); } @@ -2087,7 +2092,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<base> p (db->load<base> (1)); + unique_ptr<base> p (db->load<base> (1)); db->load (*p, p->s); object& o (static_cast<object&> (*p)); assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123); @@ -2105,7 +2110,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<base> p (db->load<base> (1)); + unique_ptr<base> p (db->load<base> (1)); db->load (*p, p->s); object& o (static_cast<object&> (*p)); assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123); @@ -2123,7 +2128,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str == "abc" && p->num == 123); t.commit (); } @@ -2179,7 +2184,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->num == 123 && p->vec[0] == 123); t.commit (); } @@ -2195,7 +2200,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); assert (p->num == 123 && p->vec[0] == 123); t.commit (); diff --git a/odb-tests/evolution/soft-add/testscript b/odb-tests/evolution/soft-add/testscript new file mode 100644 index 0000000..9563f33 --- /dev/null +++ b/odb-tests/evolution/soft-add/testscript @@ -0,0 +1,54 @@ +# file : evolution/soft-add/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + $* 1 &odb-test.db; + $* 2; + $* 3 +} diff --git a/odb-tests/evolution/soft-delete/buildfile b/odb-tests/evolution/soft-delete/buildfile new file mode 100644 index 0000000..1d98505 --- /dev/null +++ b/odb-tests/evolution/soft-delete/buildfile @@ -0,0 +1,65 @@ +# file : evolution/soft-delete/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} + +import libs = libodb-$db%lib{odb-$db} +import libs += lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_soft_d_ \ + --schema-version-table evo_soft_d_sv \ + --generate-schema \ + --generate-query \ + --generate-prepared \ + --at-once \ + --changelog $out_base/model.xml \ + --sqlite-override-null + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/soft-delete/driver.cxx b/odb-tests/evolution/soft-delete/driver.cxx index e41a70c..ea9e7f0 100644 --- a/odb-tests/evolution/soft-delete/driver.cxx +++ b/odb-tests/evolution/soft-delete/driver.cxx @@ -4,22 +4,24 @@ // Test soft-delete functionality. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/config.hxx> // DATABASE_XXX -#include <common/common.hxx> +#include <libcommon/config.hxx> // DATABASE_XXX +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -28,7 +30,10 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_soft_d_sv"); + bool embedded (schema_catalog::exists (*db)); // 1 - base version @@ -339,7 +344,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->num == 123); t.commit (); } @@ -355,7 +360,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123 && p->ptr->id_ == 1); t.commit (); @@ -386,7 +391,7 @@ main (int argc, char* argv[]) transaction t (db->begin ()); db->persist (o); db->persist (*o.ptr); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "bcd" && p->num == 234 && p->vec[0] == 234 && p->ptr->id_ == 2); t.commit (); @@ -402,7 +407,7 @@ main (int argc, char* argv[]) transaction t (db->begin ()); db->erase<object1> (2); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "bcde" && p->num == 235 && p->vec[0] == 235 && p->ptr == 0); t.commit (); @@ -425,7 +430,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->vec[0].str == "abc" && p->vec[0].num == 123); t.commit (); } @@ -436,7 +441,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->vec[0].str == "bcd" && p->vec[0].num == 234); t.commit (); } @@ -447,7 +452,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->vec[0].str == "bcde" && p->vec[0].num == 235); t.commit (); } @@ -489,7 +494,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123); t.commit (); @@ -516,7 +521,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "bcd" && p->num == 234 && p->vec[0] == 234); t.commit (); @@ -529,7 +534,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "bcde" && p->num == 235 && p->vec[0] == 235); t.commit (); @@ -552,7 +557,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); assert (p->str == "abc" && p->num == 123 && p->vec[0] == 123); t.commit (); @@ -579,7 +584,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "bcd" && p->num == 234 && p->vec[0] == 234); t.commit (); @@ -592,7 +597,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "bcde" && p->num == 235 && p->vec[0] == 235); t.commit (); @@ -615,7 +620,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (static_cast<object*> (db->load<base> (1))); + unique_ptr<object> p (static_cast<object*> (db->load<base> (1))); assert (p->bstr == "ab" && p->dstr == "abc" && p->num == 123); t.commit (); } @@ -641,7 +646,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->bstr == "bc" && p->dstr == "bcd" && p->num == 234); t.commit (); } @@ -653,7 +658,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->bstr == "bcd" && p->dstr == "bcde" && p->num == 235); t.commit (); } @@ -675,7 +680,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<base> p (db->load<base> (1)); + unique_ptr<base> p (db->load<base> (1)); db->load (*p, p->s); object& o (static_cast<object&> (*p)); assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123); @@ -704,7 +709,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->bstr == "bc" && p->dstr == "bcd" && p->num == 234); t.commit (); @@ -718,7 +723,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->bstr == "bcd" && p->dstr == "bcde" && p->num == 235); t.commit (); @@ -741,7 +746,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<base> p (db->load<base> (1)); + unique_ptr<base> p (db->load<base> (1)); db->load (*p, p->s); object& o (static_cast<object&> (*p)); assert (o.bstr == "ab" && o.dstr == "abc" && o.num == 123); @@ -770,7 +775,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->bstr == "bc" && p->dstr == "bcd" && p->num == 234); t.commit (); @@ -784,7 +789,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->bstr == "bcd" && p->dstr == "bcde" && p->num == 235); t.commit (); @@ -807,7 +812,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str == "abc" && p->num == 123); t.commit (); } @@ -830,7 +835,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "bcd" && p->num == 234); t.commit (); } @@ -843,7 +848,7 @@ main (int argc, char* argv[]) unsigned long long v (o.v_); db->update (o); assert (o.v_ != v); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "bcde" && p->num == 235 && p->v_ == o.v_); t.commit (); } @@ -919,7 +924,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (id)); + unique_ptr<object> p (db->load<object> (id)); assert (p->str == "abc" && p->num == 123); t.commit (); } @@ -931,7 +936,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (o.id)); + unique_ptr<object> p (db->load<object> (o.id)); assert (p->str == "bcd" && p->num == 234); t.commit (); } @@ -942,7 +947,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (o.id)); + unique_ptr<object> p (db->load<object> (o.id)); assert (p->str == "bcde" && p->num == 235); t.commit (); } @@ -964,7 +969,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->v->str == "abc" && p->num == 123 && p->v->vec[0] == 123); t.commit (); @@ -992,7 +997,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->v->str == "bcd" && p->num == 234 && p->v->vec[0] == 234); t.commit (); @@ -1005,7 +1010,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->v->str == "bcde" && p->num == 235 && p->v->vec[0] == 235); t.commit (); @@ -1028,7 +1033,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->num == 123 && p->vec[0] == 123); t.commit (); } @@ -1051,7 +1056,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->num == 234 && p->vec[0] == 234); t.commit (); } @@ -1062,7 +1067,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->num == 235 && p->vec[0] == 235); t.commit (); } @@ -1084,7 +1089,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); assert (p->num == 123 && p->vec[0] == 123); t.commit (); @@ -1110,7 +1115,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->num == 234 && p->vec[0] == 234); t.commit (); @@ -1122,7 +1127,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->num == 235 && p->vec[0] == 235); t.commit (); @@ -1155,7 +1160,7 @@ main (int argc, char* argv[]) try { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); // No such table. + unique_ptr<object> p (db->load<object> (1)); // No such table. assert (false); } catch (const odb::exception&) {} @@ -1171,7 +1176,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str == "" && p->num == 123 && p->vec.empty () && p->ptr == 0); t.commit (); @@ -1214,7 +1219,7 @@ main (int argc, char* argv[]) transaction t (db->begin ()); db->persist (o); db->persist (*o.ptr); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "" && p->num == 234 && p->vec.empty () && p->ptr == 0); t.commit (); @@ -1230,7 +1235,7 @@ main (int argc, char* argv[]) transaction t (db->begin ()); db->erase<object1> (2); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "" && p->num == 235 && p->vec.empty () && p->ptr == 0); t.commit (); @@ -1257,7 +1262,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (o.id)); + unique_ptr<object> p (db->load<object> (o.id)); assert (p->str == ""); t.commit (); } @@ -1267,7 +1272,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (o.id)); + unique_ptr<object> p (db->load<object> (o.id)); assert (p->str == ""); t.commit (); } @@ -1287,7 +1292,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<base> p (db->load<base> (1)); + unique_ptr<base> p (db->load<base> (1)); assert (static_cast<object&> (*p).str == ""); t.commit (); } @@ -1303,7 +1308,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->vec[0].str == "" && p->vec[0].num == 123); t.commit (); } @@ -1314,7 +1319,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->vec[0].str == "" && p->vec[0].num == 234); t.commit (); } @@ -1325,7 +1330,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->vec[0].str == "" && p->vec[0].num == 235); t.commit (); } @@ -1380,7 +1385,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); // Logical delete in SQLite. // @@ -1434,7 +1439,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); assert (p->str == "" && p->num == 123 && p->vec.empty ()); t.commit (); @@ -1474,7 +1479,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "" && p->num == 234 && p->vec.empty ()); t.commit (); @@ -1487,7 +1492,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "" && p->num == 234 && p->vec.empty ()); t.commit (); @@ -1498,7 +1503,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->str == "" && p->num == 235 && p->vec.empty ()); t.commit (); @@ -1521,7 +1526,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (static_cast<object*> (db->load<base> (1))); + unique_ptr<object> p (static_cast<object*> (db->load<base> (1))); assert (p->bstr == "" && p->dstr == "" && p->num == 123); t.commit (); } @@ -1585,7 +1590,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->bstr == "" && p->dstr == "" && p->num == 234); t.commit (); } @@ -1597,7 +1602,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->bstr == "" && p->dstr == "" && p->num == 235); t.commit (); } @@ -1619,7 +1624,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<base> p (db->load<base> (1)); + unique_ptr<base> p (db->load<base> (1)); // Logical delete in SQLite. // @@ -1673,7 +1678,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<base> p (db->load<base> (1)); + unique_ptr<base> p (db->load<base> (1)); db->load (*p, p->s); object& o (static_cast<object&> (*p)); assert (o.bstr == "" && o.dstr == "" && o.num == 123); @@ -1741,7 +1746,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->bstr == "" && p->dstr == "" && p->num == 234); t.commit (); @@ -1755,7 +1760,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (static_cast<base&> (o)); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->bstr == "" && p->dstr == "" && p->num == 235); t.commit (); @@ -1775,7 +1780,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (b); - auto_ptr<base> p (db->load<base> (3)); + unique_ptr<base> p (db->load<base> (3)); db->load (*p, p->s); assert (p->bstr == ""); t.commit (); @@ -1787,7 +1792,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (b); - auto_ptr<base> p (db->load<base> (3)); + unique_ptr<base> p (db->load<base> (3)); db->load (*p, p->s); assert (p->bstr == ""); t.commit (); @@ -1804,7 +1809,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->str == "" && p->num == 123); t.commit (); } @@ -1840,7 +1845,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "" && p->num == 234); t.commit (); } @@ -1853,7 +1858,7 @@ main (int argc, char* argv[]) unsigned long long v (o.v_); db->update (o); assert (o.v_ != v); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->str == "" && p->num == 235 && p->v_ == o.v_); t.commit (); } @@ -1955,7 +1960,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (id)); + unique_ptr<object> p (db->load<object> (id)); assert (p->str == "" && p->num == 123); t.commit (); } @@ -1967,7 +1972,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (o.id)); + unique_ptr<object> p (db->load<object> (o.id)); assert (p->str == "" && p->num == 234); t.commit (); } @@ -1978,7 +1983,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (o.id)); + unique_ptr<object> p (db->load<object> (o.id)); assert (p->str == "" && p->num == 235); t.commit (); } @@ -2000,7 +2005,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->v.get () == 0 && p->num == 123); t.commit (); } @@ -2035,7 +2040,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->v.get () == 0 && p->num == 234); t.commit (); } @@ -2045,7 +2050,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->v.get () == 0 && p->num == 235); t.commit (); } @@ -2067,7 +2072,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); assert (p->num == 123 && p->vec.empty ()); t.commit (); } @@ -2090,7 +2095,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->num == 234 && p->vec.empty ()); t.commit (); } @@ -2101,7 +2106,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); assert (p->num == 235 && p->vec.empty ()); t.commit (); } @@ -2123,7 +2128,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (1)); + unique_ptr<object> p (db->load<object> (1)); db->load (*p, p->s); assert (p->num == 123 && p->vec.empty ()); t.commit (); @@ -2149,7 +2154,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->persist (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->num == 234 && p->vec.empty ()); t.commit (); @@ -2161,7 +2166,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->num == 234 && p->vec.empty ()); t.commit (); @@ -2172,7 +2177,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); db->update (o); - auto_ptr<object> p (db->load<object> (2)); + unique_ptr<object> p (db->load<object> (2)); db->load (*p, p->s); assert (p->num == 235 && p->vec.empty ()); t.commit (); diff --git a/odb-tests/evolution/soft-delete/model.hxx b/odb-tests/evolution/soft-delete/model.hxx index 65083dd..093aadf 100644 --- a/odb-tests/evolution/soft-delete/model.hxx +++ b/odb-tests/evolution/soft-delete/model.hxx @@ -5,10 +5,8 @@ # error model.hxx included directly #endif -#include <common/config.hxx> // HAVE_CXX11 - #include <string> -#include <memory> // std::auto_ptr/unique_ptr +#include <memory> // unique_ptr #include <odb/core.hxx> #include <odb/vector.hxx> @@ -449,11 +447,7 @@ namespace MODEL_NAMESPACE(MODEL_VERSION) #pragma db id unsigned long id_; -#ifdef HAVE_CXX11 std::unique_ptr<value> v; -#else - std::auto_ptr<value> v; -#endif unsigned long num; }; diff --git a/odb-tests/evolution/soft-delete/testscript b/odb-tests/evolution/soft-delete/testscript new file mode 100644 index 0000000..615bdb1 --- /dev/null +++ b/odb-tests/evolution/soft-delete/testscript @@ -0,0 +1,54 @@ +# file : evolution/soft-delete/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + $* 1 &odb-test.db; + $* 2; + $* 3 +} diff --git a/odb-tests/evolution/template/driver.cxx b/odb-tests/evolution/template/driver.cxx deleted file mode 100644 index b278acd..0000000 --- a/odb-tests/evolution/template/driver.cxx +++ /dev/null @@ -1,124 +0,0 @@ -// file : evolution/template/driver.cxx -// license : GNU GPL v2; see accompanying LICENSE file - -// PLACE TEST DESCRIPTION HERE -// - -#include <memory> // std::auto_ptr -#include <cassert> -#include <iostream> - -#include <odb/database.hxx> -#include <odb/transaction.hxx> -#include <odb/schema-catalog.hxx> - -#include <common/common.hxx> - -#include "test2.hxx" -#include "test3.hxx" -#include "test2-odb.hxx" -#include "test3-odb.hxx" - -using namespace std; -using namespace odb::core; - -int -main (int argc, char* argv[]) -{ - try - { - auto_ptr<database> db (create_database (argc, argv, false)); - bool embedded (schema_catalog::exists (*db)); - - // 1 - base version - // 2 - migration - // 3 - current version - // - unsigned short pass (*argv[argc - 1] - '0'); - - switch (pass) - { - case 1: - { - using namespace v2; - - if (embedded) - { - transaction t (db->begin ()); - schema_catalog::drop_schema (*db); - schema_catalog::create_schema (*db, "", false); - schema_catalog::migrate_schema (*db, 2); - t.commit (); - } - - { - transaction t (db->begin ()); - dummy d (1); - db->persist (d); - t.commit (); - } - break; - } - case 2: - { - using namespace v3; - - if (embedded) - { - transaction t (db->begin ()); - schema_catalog::migrate_schema_pre (*db, 3); - t.commit (); - } - - { - transaction t (db->begin ()); - auto_ptr<dummy> p (db->load<dummy> (1)); - t.commit (); - } - - if (embedded) - { - transaction t (db->begin ()); - schema_catalog::migrate_schema_post (*db, 3); - t.commit (); - } - break; - } - case 3: - { - using namespace v3; - - object o; - - { - transaction t (db->begin ()); - db->persist (o); - t.commit (); - } - - { - transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (o.id_)); - t.commit (); - } - - { - transaction t (db->begin ()); - auto_ptr<dummy> p (db->load<dummy> (1)); - t.commit (); - } - break; - } - default: - { - cerr << "unknown pass number '" << argv[argc - 1] << "'" << endl; - return 1; - } - } - } - catch (const odb::exception& e) - { - cerr << e.what () << endl; - return 1; - } -} diff --git a/odb-tests/evolution/template/model.hxx b/odb-tests/evolution/template/model.hxx deleted file mode 100644 index 182c81f..0000000 --- a/odb-tests/evolution/template/model.hxx +++ /dev/null @@ -1,40 +0,0 @@ -// file : evolution/template/model.hxx -// license : GNU GPL v2; see accompanying LICENSE file - -#ifndef MODEL_VERSION -# error model.hxx included directly -#endif - -#include <odb/core.hxx> - -#pragma db model version(1, MODEL_VERSION) - -#define MODEL_NAMESPACE_IMPL(V) v##V -#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V) - -namespace MODEL_NAMESPACE(MODEL_VERSION) -{ -#if MODEL_VERSION == 3 - #pragma db object - struct object - { - #pragma db id auto - unsigned long id_; - }; -#endif - - // The presence of this object makes sure that there are no empty - // changesets and we get the complete set of migration files. - // - #pragma db object - struct dummy - { - dummy (unsigned long id = 0): id_ (id) {} - - #pragma db id - unsigned long id_; - }; -} - -#undef MODEL_NAMESPACE -#undef MODEL_NAMESPACE_IMPL diff --git a/odb-tests/evolution/template/template-vc10.vcxproj b/odb-tests/evolution/template/template-vc10.vcxproj deleted file mode 100644 index c0ebe18..0000000 --- a/odb-tests/evolution/template/template-vc10.vcxproj +++ /dev/null @@ -1,196 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{__uuid__()}</ProjectGuid> - <Keyword>Win32Proj</Keyword> - <RootNamespace>__value__(name)</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(Platform)\$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(Platform)\$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <PrecompiledHeader> - </PrecompiledHeader> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <PrecompiledHeader> - </PrecompiledHeader> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - </Link> - </ItemDefinitionGroup> - <ItemGroup> -__custom_build_entry__( -test1.hxx, -odb test1.hxx, -odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options1) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test1.hxx, -test1-odb.hxx;test1-odb.ixx;test1-odb.cxx;test1.sql;model.xml, -model.hxx) -__custom_build_entry__( -test2.hxx, -odb test2.hxx, -odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options2) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test2.hxx, -test2-odb.hxx;test2-odb.ixx;test2-odb.cxx;test2.sql;model.xml, -test1-odb.hxx;model.hxx) -__custom_build_entry__( -test3.hxx, -odb test3.hxx, -odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options3) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1600 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test3.hxx, -test3-odb.hxx;test3-odb.ixx;test3-odb.cxx;test3.sql;test3-002-pre.sql;test3-002-post.sql;test3-003-pre.sql;test3-003-post.sql, -test2-odb.hxx;model.hxx) - </ItemGroup> - <ItemGroup> -__header_entry__(test1-odb.hxx) -__header_entry__(test1-odb.ixx) -__header_entry__(test2-odb.hxx) -__header_entry__(test2-odb.ixx) -__header_entry__(test3-odb.hxx) -__header_entry__(test3-odb.ixx) -__header_entries__(extra_headers) - </ItemGroup> - <ItemGroup> -__source_entry__(driver.cxx) -__source_entry__(test1-odb.cxx) -__source_entry__(test2-odb.cxx) -__source_entry__(test3-odb.cxx) -__source_entries__(extra_sources) - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> diff --git a/odb-tests/evolution/template/template-vc10.vcxproj.filters b/odb-tests/evolution/template/template-vc10.vcxproj.filters deleted file mode 100644 index d6ac66e..0000000 --- a/odb-tests/evolution/template/template-vc10.vcxproj.filters +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{__uuid__()}</UniqueIdentifier> - <Extensions>cxx</Extensions> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{__uuid__()}</UniqueIdentifier> - <Extensions>h;hxx;ixx;txx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> -__header_filter_entry__(test1.hxx) -__header_filter_entry__(test1-odb.hxx) -__header_filter_entry__(test1-odb.ixx) -__header_filter_entry__(test2.hxx) -__header_filter_entry__(test2-odb.hxx) -__header_filter_entry__(test2-odb.ixx) -__header_filter_entry__(test3.hxx) -__header_filter_entry__(test3-odb.hxx) -__header_filter_entry__(test3-odb.ixx) -__header_filter_entries__(extra_headers) - </ItemGroup> - <ItemGroup> -__source_filter_entry__(driver.cxx) -__source_filter_entry__(test1-odb.cxx) -__source_filter_entry__(test2-odb.cxx) -__source_filter_entry__(test3-odb.cxx) -__source_filter_entries__(extra_sources) - </ItemGroup> -</Project> diff --git a/odb-tests/evolution/template/template-vc11.vcxproj b/odb-tests/evolution/template/template-vc11.vcxproj deleted file mode 100644 index f51fd0c..0000000 --- a/odb-tests/evolution/template/template-vc11.vcxproj +++ /dev/null @@ -1,200 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{__uuid__()}</ProjectGuid> - <Keyword>Win32Proj</Keyword> - <RootNamespace>__value__(name)</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v110</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v110</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v110</PlatformToolset> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v110</PlatformToolset> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(Platform)\$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(Platform)\$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <PrecompiledHeader> - </PrecompiledHeader> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <PrecompiledHeader> - </PrecompiledHeader> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - </Link> - </ItemDefinitionGroup> - <ItemGroup> -__custom_build_entry__( -test1.hxx, -odb test1.hxx, -odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options1) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test1.hxx, -test1-odb.hxx;test1-odb.ixx;test1-odb.cxx;test1.sql;model.xml, -model.hxx) -__custom_build_entry__( -test2.hxx, -odb test2.hxx, -odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options2) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test2.hxx, -test2-odb.hxx;test2-odb.ixx;test2-odb.cxx;test2.sql;model.xml, -test1-odb.hxx;model.hxx) -__custom_build_entry__( -test3.hxx, -odb test3.hxx, -odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options3) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test3.hxx, -test3-odb.hxx;test3-odb.ixx;test3-odb.cxx;test3.sql;test3-002-pre.sql;test3-002-post.sql;test3-003-pre.sql;test3-003-post.sql, -test2-odb.hxx;model.hxx) - </ItemGroup> - <ItemGroup> -__header_entry__(test1-odb.hxx) -__header_entry__(test1-odb.ixx) -__header_entry__(test2-odb.hxx) -__header_entry__(test2-odb.ixx) -__header_entry__(test3-odb.hxx) -__header_entry__(test3-odb.ixx) -__header_entries__(extra_headers) - </ItemGroup> - <ItemGroup> -__source_entry__(driver.cxx) -__source_entry__(test1-odb.cxx) -__source_entry__(test2-odb.cxx) -__source_entry__(test3-odb.cxx) -__source_entries__(extra_sources) - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> diff --git a/odb-tests/evolution/template/template-vc11.vcxproj.filters b/odb-tests/evolution/template/template-vc11.vcxproj.filters deleted file mode 100644 index d6ac66e..0000000 --- a/odb-tests/evolution/template/template-vc11.vcxproj.filters +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{__uuid__()}</UniqueIdentifier> - <Extensions>cxx</Extensions> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{__uuid__()}</UniqueIdentifier> - <Extensions>h;hxx;ixx;txx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> -__header_filter_entry__(test1.hxx) -__header_filter_entry__(test1-odb.hxx) -__header_filter_entry__(test1-odb.ixx) -__header_filter_entry__(test2.hxx) -__header_filter_entry__(test2-odb.hxx) -__header_filter_entry__(test2-odb.ixx) -__header_filter_entry__(test3.hxx) -__header_filter_entry__(test3-odb.hxx) -__header_filter_entry__(test3-odb.ixx) -__header_filter_entries__(extra_headers) - </ItemGroup> - <ItemGroup> -__source_filter_entry__(driver.cxx) -__source_filter_entry__(test1-odb.cxx) -__source_filter_entry__(test2-odb.cxx) -__source_filter_entry__(test3-odb.cxx) -__source_filter_entries__(extra_sources) - </ItemGroup> -</Project> diff --git a/odb-tests/evolution/template/template-vc12.vcxproj b/odb-tests/evolution/template/template-vc12.vcxproj deleted file mode 100644 index 9562323..0000000 --- a/odb-tests/evolution/template/template-vc12.vcxproj +++ /dev/null @@ -1,204 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{__uuid__()}</ProjectGuid> - <Keyword>Win32Proj</Keyword> - <RootNamespace>__value__(name)</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <LinkIncremental>true</LinkIncremental> - <OutDir>$(Platform)\$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <LinkIncremental>false</LinkIncremental> - <OutDir>$(Platform)\$(Configuration)\</OutDir> - <TargetName>driver</TargetName> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - <SDLCheck>true</SDLCheck> - </ClCompile> - <Link> - <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - <SDLCheck>true</SDLCheck> - </ClCompile> - <Link> - <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-d.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <PrecompiledHeader> - </PrecompiledHeader> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - <SDLCheck>true</SDLCheck> - </ClCompile> - <Link> - <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <PrecompiledHeader> - </PrecompiledHeader> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)\..\libcommon</AdditionalIncludeDirectories> - <DisableSpecificWarnings>4068;4355;4800;4290;%(DisableSpecificWarnings)</DisableSpecificWarnings> - <SDLCheck>true</SDLCheck> - </ClCompile> - <Link> - <AdditionalDependencies>$(SolutionDir)\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - </Link> - </ItemDefinitionGroup> - <ItemGroup> -__custom_build_entry__( -test1.hxx, -odb test1.hxx, -odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options1) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test1.hxx, -test1-odb.hxx;test1-odb.ixx;test1-odb.cxx;test1.sql;model.xml, -model.hxx) -__custom_build_entry__( -test2.hxx, -odb test2.hxx, -odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options2) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test2.hxx, -test2-odb.hxx;test2-odb.ixx;test2-odb.cxx;test2.sql;model.xml, -test1-odb.hxx;model.hxx) -__custom_build_entry__( -test3.hxx, -odb test3.hxx, -odb.exe --std c++11 --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options3) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1700 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test3.hxx, -test3-odb.hxx;test3-odb.ixx;test3-odb.cxx;test3.sql;test3-002-pre.sql;test3-002-post.sql;test3-003-pre.sql;test3-003-post.sql, -test2-odb.hxx;model.hxx) - </ItemGroup> - <ItemGroup> -__header_entry__(test1-odb.hxx) -__header_entry__(test1-odb.ixx) -__header_entry__(test2-odb.hxx) -__header_entry__(test2-odb.ixx) -__header_entry__(test3-odb.hxx) -__header_entry__(test3-odb.ixx) -__header_entries__(extra_headers) - </ItemGroup> - <ItemGroup> -__source_entry__(driver.cxx) -__source_entry__(test1-odb.cxx) -__source_entry__(test2-odb.cxx) -__source_entry__(test3-odb.cxx) -__source_entries__(extra_sources) - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> diff --git a/odb-tests/evolution/template/template-vc12.vcxproj.filters b/odb-tests/evolution/template/template-vc12.vcxproj.filters deleted file mode 100644 index d6ac66e..0000000 --- a/odb-tests/evolution/template/template-vc12.vcxproj.filters +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{__uuid__()}</UniqueIdentifier> - <Extensions>cxx</Extensions> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{__uuid__()}</UniqueIdentifier> - <Extensions>h;hxx;ixx;txx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> -__header_filter_entry__(test1.hxx) -__header_filter_entry__(test1-odb.hxx) -__header_filter_entry__(test1-odb.ixx) -__header_filter_entry__(test2.hxx) -__header_filter_entry__(test2-odb.hxx) -__header_filter_entry__(test2-odb.ixx) -__header_filter_entry__(test3.hxx) -__header_filter_entry__(test3-odb.hxx) -__header_filter_entry__(test3-odb.ixx) -__header_filter_entries__(extra_headers) - </ItemGroup> - <ItemGroup> -__source_filter_entry__(driver.cxx) -__source_filter_entry__(test1-odb.cxx) -__source_filter_entry__(test2-odb.cxx) -__source_filter_entry__(test3-odb.cxx) -__source_filter_entries__(extra_sources) - </ItemGroup> -</Project> diff --git a/odb-tests/evolution/template/template-vc8.vcproj b/odb-tests/evolution/template/template-vc8.vcproj deleted file mode 100644 index d6c5f15..0000000 --- a/odb-tests/evolution/template/template-vc8.vcproj +++ /dev/null @@ -1,372 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="__value__(name)" - ProjectGUID="{__uuid__()}" - RootNamespace="__value__(name)" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290" - Optimization="0" - AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="4" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common-d.lib odb-__value__(database)-d.lib odb-d.lib" - OutputFile="$(OutDir)\driver.exe" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290" - AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon" - PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common.lib odb-__value__(database).lib odb.lib" - OutputFile="$(OutDir)\driver.exe" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290" - Optimization="0" - AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common-d.lib odb-__value__(database)-d.lib odb-d.lib" - OutputFile="$(OutDir)\driver.exe" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290" - AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon" - PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common.lib odb-__value__(database).lib odb.lib" - OutputFile="$(OutDir)\driver.exe" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cxx" - UniqueIdentifier="{__uuid__()}" - > -__source_entry__(driver.cxx) -__source_entry__(test1-odb.cxx) -__source_entry__(test2-odb.cxx) -__source_entry__(test3-odb.cxx) -__source_entries__(extra_sources) - </Filter> - <Filter - Name="Header Files" - Filter="h;hxx;ixx;txx" - UniqueIdentifier="{__uuid__()}" - > -__file_entry_custom_build__( -test1.hxx, -odb test1.hxx, -odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options1) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test1.hxx, -test1-odb.hxx;test1-odb.ixx;test1-odb.cxx;test1.sql;model.xml, -model.hxx) -__file_entry__(test1-odb.hxx) -__file_entry__(test1-odb.ixx) -__file_entry_custom_build__( -test2.hxx, -odb test2.hxx, -odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options2) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test2.hxx, -test2-odb.hxx;test2-odb.ixx;test2-odb.cxx;test2.sql;model.xml, -test1-odb.hxx;model.hxx) -__file_entry__(test2-odb.hxx) -__file_entry__(test2-odb.ixx) -__file_entry_custom_build__( -test3.hxx, -odb test3.hxx, -odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options3) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1400 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test3.hxx, -test3-odb.hxx;test3-odb.ixx;test3-odb.cxx;test3.sql;test3-002-pre.sql;test3-002-post.sql;test3-003-pre.sql;test3-003-post.sql, -test2-odb.hxx;model.hxx) -__file_entry__(test3-odb.hxx) -__file_entry__(test3-odb.ixx) -__file_entries__(extra_headers) - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/odb-tests/evolution/template/template-vc9.vcproj b/odb-tests/evolution/template/template-vc9.vcproj deleted file mode 100644 index 9177928..0000000 --- a/odb-tests/evolution/template/template-vc9.vcproj +++ /dev/null @@ -1,379 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9.00" - Name="__value__(name)" - ProjectGUID="{__uuid__()}" - RootNamespace="__value__(name)" - Keyword="Win32Proj" - TargetFrameworkVersion="196613" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290" - Optimization="0" - AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="4" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common-d.lib odb-__value__(database)-d.lib odb-d.lib" - OutputFile="$(OutDir)\driver.exe" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon" - PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H" - RuntimeLibrary="2" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(SolutionDir)\..\libcommon\lib\common.lib odb-__value__(database).lib odb.lib" - OutputFile="$(OutDir)\driver.exe" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290" - Optimization="0" - AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common-d.lib odb-__value__(database)-d.lib odb-d.lib" - OutputFile="$(OutDir)\driver.exe" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/wd4068 /wd4355 /wd4800 /wd4290" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="$(SolutionDir)\..\libcommon" - PreprocessorDefinitions="WIN32;_CONSOLE;__upcase__(database_)__upcase__(__value__(database));HAVE_CONFIG_VC_H" - RuntimeLibrary="2" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(SolutionDir)\..\libcommon\lib64\common.lib odb-__value__(database).lib odb.lib" - OutputFile="$(OutDir)\driver.exe" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cxx" - UniqueIdentifier="{__uuid__()}" - > -__source_entry__(driver.cxx) -__source_entry__(test1-odb.cxx) -__source_entry__(test2-odb.cxx) -__source_entry__(test3-odb.cxx) -__source_entries__(extra_sources) - </Filter> - <Filter - Name="Header Files" - Filter="h;hxx;ixx;txx" - UniqueIdentifier="{__uuid__()}" - > -__file_entry_custom_build__( -test1.hxx, -odb test1.hxx, -odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options1) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test1.hxx, -test1-odb.hxx;test1-odb.ixx;test1-odb.cxx;test1.sql;model.xml, -model.hxx) -__file_entry__(test1-odb.hxx) -__file_entry__(test1-odb.ixx) -__file_entry_custom_build__( -test2.hxx, -odb test2.hxx, -odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options2) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test2.hxx, -test2-odb.hxx;test2-odb.ixx;test2-odb.cxx;test2.sql;model.xml, -test1-odb.hxx;model.hxx) -__file_entry__(test2-odb.hxx) -__file_entry__(test2-odb.ixx) -__file_entry_custom_build__( -test3.hxx, -odb test3.hxx, -odb.exe --database __value__(database) __xml__(__shell_quotes__(__value__(odb_options3) --changelog model.xml -DHAVE_CONFIG_VC_H -DODB_MSC_VER=1500 __upcase__(-Ddatabase_)__upcase__(__value__(database)) -I$(SolutionDir)\..\libcommon)) test3.hxx, -test3-odb.hxx;test3-odb.ixx;test3-odb.cxx;test3.sql;test3-002-pre.sql;test3-002-post.sql;test3-003-pre.sql;test3-003-post.sql, -test2-odb.hxx;model.hxx) -__file_entry__(test3-odb.hxx) -__file_entry__(test3-odb.ixx) -__file_entries__(extra_headers) - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/odb-tests/evolution/template/test1.hxx b/odb-tests/evolution/template/test1.hxx deleted file mode 100644 index 238b686..0000000 --- a/odb-tests/evolution/template/test1.hxx +++ /dev/null @@ -1,9 +0,0 @@ -// file : evolution/template/test1.hxx -// license : GNU GPL v2; see accompanying LICENSE file - -#ifndef TEST1_HXX -#define TEST1_HXX - -#pragma db model version(1, 1) - -#endif // TEST1_HXX diff --git a/odb-tests/evolution/template/test2.hxx b/odb-tests/evolution/template/test2.hxx deleted file mode 100644 index ec982f5..0000000 --- a/odb-tests/evolution/template/test2.hxx +++ /dev/null @@ -1,11 +0,0 @@ -// file : evolution/template/test2.hxx -// license : GNU GPL v2; see accompanying LICENSE file - -#ifndef TEST2_HXX -#define TEST2_HXX - -#define MODEL_VERSION 2 -#include "model.hxx" -#undef MODEL_VERSION - -#endif // TEST2_HXX diff --git a/odb-tests/evolution/template/test3.hxx b/odb-tests/evolution/template/test3.hxx deleted file mode 100644 index 50f3882..0000000 --- a/odb-tests/evolution/template/test3.hxx +++ /dev/null @@ -1,11 +0,0 @@ -// file : evolution/template/test3.hxx -// license : GNU GPL v2; see accompanying LICENSE file - -#ifndef TEST3_HXX -#define TEST3_HXX - -#define MODEL_VERSION 3 -#include "model.hxx" -#undef MODEL_VERSION - -#endif // TEST3_HXX diff --git a/odb-tests/evolution/version/buildfile b/odb-tests/evolution/version/buildfile new file mode 100644 index 0000000..f11559f --- /dev/null +++ b/odb-tests/evolution/version/buildfile @@ -0,0 +1,63 @@ +# file : evolution/version/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') + assert (!$multi) "multi-database mode is not supported by this test" + +db = ($databases[0]) + +import libodb = libodb%lib{odb} + +import libs = libodb-$db%lib{odb-$db} +import libs += lib{common} + +hdrs = test1 test2 test3 + +exe{driver}: {hxx cxx}{* -*-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +for h: $hdrs + exe{driver}: {hxx ixx cxx}{$h-odb}: hxx{$h} libue{test-meta} hxx{model} + +# Make sure testN.hxx are compiled serially since they share the changelog. +# +# @@ TODO: make order-only when supported by build2. +# +{hxx ixx cxx}{test3-odb}: {hxx ixx cxx}{test2-odb}: {hxx ixx cxx}{test1-odb} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix evo_version_ \ + --schema-version-table evo_version_sv \ + --generate-schema \ + --generate-query \ + --at-once \ + --changelog $out_base/model.xml + +<{hxx ixx cxx}{test1-odb}>: odb_options += --init-changelog +<{hxx ixx cxx}{test2-odb}>: odb_options += --omit-create --suppress-migration + +<{hxx ixx cxx}{test3-odb}>: +{ + odb_options += --omit-create + schema_versions = 002 003 +} + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc + +testscript@./: +{ + db = $db + schemas = $hdrs +} diff --git a/odb-tests/evolution/version/driver.cxx b/odb-tests/evolution/version/driver.cxx index 236c9b4..cc1b4b9 100644 --- a/odb-tests/evolution/version/driver.cxx +++ b/odb-tests/evolution/version/driver.cxx @@ -4,22 +4,24 @@ // Test schema version access via the database instance. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/transaction.hxx> #include <odb/schema-catalog.hxx> -#include <common/config.hxx> // DATABASE_XXX -#include <common/common.hxx> +#include <libcommon/config.hxx> // DATABASE_XXX +#include <libcommon/common.hxx> #include "test2.hxx" #include "test3.hxx" #include "test2-odb.hxx" #include "test3-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace odb::core; @@ -28,7 +30,10 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv, false)); + unique_ptr<database> db (create_database (argc, argv, false)); + + db->schema_version_table ("evo_version_sv"); + bool embedded (schema_catalog::exists (*db)); // 1 - base version @@ -87,7 +92,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object1> o1 (db->load<object1> (1)); + unique_ptr<object1> o1 (db->load<object1> (1)); object2 o2 (1); o2.num = o1->num; db->persist (o2); @@ -118,7 +123,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object2> o2 (db->load<object2> (1)); + unique_ptr<object2> o2 (db->load<object2> (1)); assert (o2->num == 123); t.commit (); } @@ -131,9 +136,9 @@ main (int argc, char* argv[]) transaction t (db->begin ()); #ifdef DATABASE_ORACLE - db->execute ("DROP TABLE \"schema_version\""); + db->execute ("DROP TABLE \"evo_version_sv\""); #else - db->execute ("DROP TABLE schema_version"); + db->execute ("DROP TABLE evo_version_sv"); #endif t.commit (); } diff --git a/odb-tests/evolution/version/testscript b/odb-tests/evolution/version/testscript new file mode 100644 index 0000000..1a41b2d --- /dev/null +++ b/odb-tests/evolution/version/testscript @@ -0,0 +1,54 @@ +# file : evolution/version/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../$db-schema.testscript + +test.arguments += $($(db)_options) + +: basics +: +if! $sqlite +{ + ss =; # Schema modification base file names. + + # Drop everything. + # + for s: $schemas + ss =+ $s + end; + + # Add base schema. + # + ss += test3-002-pre test3-002-post; + + # Add migration. + # + ss += test3-003-pre test3-003-post; + + # Run tests. + # + for s: $ss + f = $out_base/"$s".sql + + if $mysql + cat $f | $create_schema_cmd + elif $pgsql + $create_schema_cmd -f $f + end + + if ($s == 'test3-002-post') + $* 1 + elif ($s == 'test3-003-pre') + $* 2 + elif ($s == 'test3-003-post') + $* 3 + end + end +} +else +{ + $* 1 &odb-test.db; + $* 2; + $* 3 +} diff --git a/odb-tests/mysql/custom/buildfile b/odb-tests/mysql/custom/buildfile index 4934e7c..f18b16b 100644 --- a/odb-tests/mysql/custom/buildfile +++ b/odb-tests/mysql/custom/buildfile @@ -1,8 +1,11 @@ # file : mysql/custom/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($mysql && !$multi || $build.meta_operation == 'dist') \ -"mysql should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($mysql) "mysql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} diff --git a/odb-tests/mysql/database/buildfile b/odb-tests/mysql/database/buildfile index 304034e..5731f6f 100644 --- a/odb-tests/mysql/database/buildfile +++ b/odb-tests/mysql/database/buildfile @@ -1,8 +1,11 @@ # file : mysql/database/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($mysql && !$multi || $build.meta_operation == 'dist') \ -"mysql should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($mysql) "mysql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libs = libodb-mysql%lib{odb-mysql} diff --git a/odb-tests/mysql/index/buildfile b/odb-tests/mysql/index/buildfile index 9cadce3..0ad9d8f 100644 --- a/odb-tests/mysql/index/buildfile +++ b/odb-tests/mysql/index/buildfile @@ -1,8 +1,11 @@ # file : mysql/index/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($mysql && !$multi || $build.meta_operation == 'dist') \ -"mysql should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($mysql) "mysql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} diff --git a/odb-tests/mysql/native/buildfile b/odb-tests/mysql/native/buildfile index 57c3c30..1ae0212 100644 --- a/odb-tests/mysql/native/buildfile +++ b/odb-tests/mysql/native/buildfile @@ -1,8 +1,11 @@ # file : mysql/native/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($mysql && !$multi || $build.meta_operation == 'dist') \ -"mysql should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($mysql) "mysql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libs = libodb-mysql%lib{odb-mysql} import libs += lib{common} diff --git a/odb-tests/mysql/truncation/buildfile b/odb-tests/mysql/truncation/buildfile index fbd936b..94c7429 100644 --- a/odb-tests/mysql/truncation/buildfile +++ b/odb-tests/mysql/truncation/buildfile @@ -1,8 +1,11 @@ # file : mysql/truncation/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($mysql && !$multi || $build.meta_operation == 'dist') \ -"mysql should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($mysql) "mysql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} diff --git a/odb-tests/mysql/types/buildfile b/odb-tests/mysql/types/buildfile index 112a81f..9065b7d 100644 --- a/odb-tests/mysql/types/buildfile +++ b/odb-tests/mysql/types/buildfile @@ -1,8 +1,11 @@ # file : mysql/types/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($mysql && !$multi || $build.meta_operation == 'dist') \ -"mysql should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($mysql) "mysql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} diff --git a/odb-tests/pgsql/bulk/buildfile b/odb-tests/pgsql/bulk/buildfile index 6984edb..1885fdd 100644 --- a/odb-tests/pgsql/bulk/buildfile +++ b/odb-tests/pgsql/bulk/buildfile @@ -3,9 +3,8 @@ if ($build.meta_operation != 'dist') { - assert ($pgsql && !$multi) \ - "pgsql should be configured via config.odb_tests.database variable as a single database" - + assert ($pgsql) "pgsql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" assert ($pgsql_bulk) "bulk operations are disabled for pgsql" } diff --git a/odb-tests/pgsql/custom/buildfile b/odb-tests/pgsql/custom/buildfile index a5c6717..b3032fa 100644 --- a/odb-tests/pgsql/custom/buildfile +++ b/odb-tests/pgsql/custom/buildfile @@ -1,8 +1,11 @@ # file : pgsql/custom/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($pgsql && !$multi || $build.meta_operation == 'dist') \ -"pgsql should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($pgsql) "pgsql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} diff --git a/odb-tests/pgsql/database/buildfile b/odb-tests/pgsql/database/buildfile index 6977ea6..217cc1f 100644 --- a/odb-tests/pgsql/database/buildfile +++ b/odb-tests/pgsql/database/buildfile @@ -1,8 +1,11 @@ # file : pgsql/database/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($pgsql && !$multi || $build.meta_operation == 'dist') \ -"pgsql should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($pgsql) "pgsql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libs = libodb-pgsql%lib{odb-pgsql} diff --git a/odb-tests/pgsql/index/buildfile b/odb-tests/pgsql/index/buildfile index a84ed9a..1ae888c 100644 --- a/odb-tests/pgsql/index/buildfile +++ b/odb-tests/pgsql/index/buildfile @@ -1,8 +1,11 @@ # file : pgsql/index/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($pgsql && !$multi || $build.meta_operation == 'dist') \ -"pgsql should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($pgsql) "pgsql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} diff --git a/odb-tests/pgsql/native/buildfile b/odb-tests/pgsql/native/buildfile index ec4c80c..da034db 100644 --- a/odb-tests/pgsql/native/buildfile +++ b/odb-tests/pgsql/native/buildfile @@ -1,8 +1,11 @@ # file : pgsql/native/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($pgsql && !$multi || $build.meta_operation == 'dist') \ -"pgsql should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($pgsql) "pgsql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libs = libodb-pgsql%lib{odb-pgsql} import libs += lib{common} diff --git a/odb-tests/pgsql/truncation/buildfile b/odb-tests/pgsql/truncation/buildfile index 2f2f3a2..4f3823f 100644 --- a/odb-tests/pgsql/truncation/buildfile +++ b/odb-tests/pgsql/truncation/buildfile @@ -1,8 +1,11 @@ # file : pgsql/truncation/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($pgsql && !$multi || $build.meta_operation == 'dist') \ -"pgsql should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($pgsql) "pgsql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} diff --git a/odb-tests/pgsql/types/buildfile b/odb-tests/pgsql/types/buildfile index 64f0c02..cb861cb 100644 --- a/odb-tests/pgsql/types/buildfile +++ b/odb-tests/pgsql/types/buildfile @@ -1,8 +1,11 @@ # file : pgsql/types/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($pgsql && !$multi || $build.meta_operation == 'dist') \ -"pgsql should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($pgsql) "pgsql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} import libcommon = lib{common} diff --git a/odb-tests/sqlite-schema.testscript b/odb-tests/sqlite-schema.testscript new file mode 100644 index 0000000..687f594 --- /dev/null +++ b/odb-tests/sqlite-schema.testscript @@ -0,0 +1,5 @@ +# Note that we currently don't manipulate the data using the sqlite3 utility. +# The database schema is created implicitly by the database object creation +# function called by the test driver. +# +#create_schema_cmd = diff --git a/odb-tests/sqlite/attach/buildfile b/odb-tests/sqlite/attach/buildfile index 959f050..bff5435 100644 --- a/odb-tests/sqlite/attach/buildfile +++ b/odb-tests/sqlite/attach/buildfile @@ -1,8 +1,11 @@ # file : sqlite/attach/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($sqlite && !$multi || $build.meta_operation == 'dist') \ -"sqlite should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($sqlite) "sqlite should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} diff --git a/odb-tests/sqlite/auto/buildfile b/odb-tests/sqlite/auto/buildfile index 2c70b7c..46bcc39 100644 --- a/odb-tests/sqlite/auto/buildfile +++ b/odb-tests/sqlite/auto/buildfile @@ -1,8 +1,11 @@ # file : sqlite/auto/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($sqlite && !$multi || $build.meta_operation == 'dist') \ -"sqlite should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($sqlite) "sqlite should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} diff --git a/odb-tests/sqlite/custom/buildfile b/odb-tests/sqlite/custom/buildfile index 3325762..de199b4 100644 --- a/odb-tests/sqlite/custom/buildfile +++ b/odb-tests/sqlite/custom/buildfile @@ -1,8 +1,11 @@ # file : sqlite/custom/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($sqlite && !$multi || $build.meta_operation == 'dist') \ -"sqlite should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($sqlite) "sqlite should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} diff --git a/odb-tests/sqlite/database/buildfile b/odb-tests/sqlite/database/buildfile index e74ab1a..01e4c38 100644 --- a/odb-tests/sqlite/database/buildfile +++ b/odb-tests/sqlite/database/buildfile @@ -1,8 +1,11 @@ # file : sqlite/database/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($sqlite && !$multi || $build.meta_operation == 'dist') \ -"sqlite should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($sqlite) "sqlite should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libs = libodb-sqlite%lib{odb-sqlite} diff --git a/odb-tests/sqlite/native/buildfile b/odb-tests/sqlite/native/buildfile index 49aa05b..76f6b53 100644 --- a/odb-tests/sqlite/native/buildfile +++ b/odb-tests/sqlite/native/buildfile @@ -1,8 +1,11 @@ # file : sqlite/native/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($sqlite && !$multi || $build.meta_operation == 'dist') \ -"sqlite should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($sqlite) "sqlite should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libs = libodb-sqlite%lib{odb-sqlite} import libs += lib{common} diff --git a/odb-tests/sqlite/stream/buildfile b/odb-tests/sqlite/stream/buildfile index fb8f605..e5baeb5 100644 --- a/odb-tests/sqlite/stream/buildfile +++ b/odb-tests/sqlite/stream/buildfile @@ -1,8 +1,11 @@ # file : sqlite/stream/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($sqlite && !$multi || $build.meta_operation == 'dist') \ -"sqlite should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($sqlite) "sqlite should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} import libodb_sqlite = libodb-sqlite%lib{odb-sqlite} diff --git a/odb-tests/sqlite/transaction/buildfile b/odb-tests/sqlite/transaction/buildfile index e29092d..1653c29 100644 --- a/odb-tests/sqlite/transaction/buildfile +++ b/odb-tests/sqlite/transaction/buildfile @@ -1,8 +1,11 @@ # file : sqlite/transaction/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($sqlite && !$multi || $build.meta_operation == 'dist') \ -"sqlite should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($sqlite) "sqlite should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} diff --git a/odb-tests/sqlite/truncation/buildfile b/odb-tests/sqlite/truncation/buildfile index 9a014e6..232b030 100644 --- a/odb-tests/sqlite/truncation/buildfile +++ b/odb-tests/sqlite/truncation/buildfile @@ -1,8 +1,11 @@ # file : sqlite/truncation/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($sqlite && !$multi || $build.meta_operation == 'dist') \ -"sqlite should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($sqlite) "sqlite should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} diff --git a/odb-tests/sqlite/types/buildfile b/odb-tests/sqlite/types/buildfile index 1bf719d..305ecba 100644 --- a/odb-tests/sqlite/types/buildfile +++ b/odb-tests/sqlite/types/buildfile @@ -1,8 +1,11 @@ # file : sqlite/types/buildfile # license : GNU GPL v2; see accompanying LICENSE file -assert ($sqlite && !$multi || $build.meta_operation == 'dist') \ -"sqlite should be configured via config.odb_tests.database variable as a single database" +if ($build.meta_operation != 'dist') +{ + assert ($sqlite) "sqlite should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} import libodb = libodb%lib{odb} |