diff options
Diffstat (limited to 'odb-tests/common/pragma')
-rw-r--r-- | odb-tests/common/pragma/buildfile | 39 | ||||
-rw-r--r-- | odb-tests/common/pragma/driver.cxx | 27 | ||||
-rw-r--r-- | odb-tests/common/pragma/test.hxx | 40 | ||||
-rw-r--r-- | odb-tests/common/pragma/testscript | 49 |
4 files changed, 155 insertions, 0 deletions
diff --git a/odb-tests/common/pragma/buildfile b/odb-tests/common/pragma/buildfile new file mode 100644 index 0000000..a2eeaa0 --- /dev/null +++ b/odb-tests/common/pragma/buildfile @@ -0,0 +1,39 @@ +# file : common/pragma/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +import libodb = libodb%lib{odb} + +libs = + +for db: $databases + import libs += libodb-$db%lib{odb-$db} + +import libs += lib{common} + +exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{test-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 + +<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta} + +for db: $databases +{ + exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi + <{hxx ixx cxx}{test-odb-$db}>: hxx{test} libue{test-meta} +} + +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 pragma_ + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{database-client}: include = adhoc diff --git a/odb-tests/common/pragma/driver.cxx b/odb-tests/common/pragma/driver.cxx new file mode 100644 index 0000000..a9cc6e0 --- /dev/null +++ b/odb-tests/common/pragma/driver.cxx @@ -0,0 +1,27 @@ +// file : common/pragma/driver.cxx +// license : GNU GPL v2; see accompanying LICENSE file + +// Test #pragma db parsing. +// + +#include <memory> +#include <iostream> + +#include <odb/exceptions.hxx> +#include <odb/transaction.hxx> + +#include <libcommon/common.hxx> + +#include "test.hxx" +#include "test-odb.hxx" + +#undef NDEBUG +#include <cassert> + +using namespace std; +using namespace odb::core; + +int +main () +{ +} diff --git a/odb-tests/common/pragma/test.hxx b/odb-tests/common/pragma/test.hxx new file mode 100644 index 0000000..6877e73 --- /dev/null +++ b/odb-tests/common/pragma/test.hxx @@ -0,0 +1,40 @@ +// file : common/template/test.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef TEST_HXX +#define TEST_HXX + +#include <odb/core.hxx> + +#pragma db value(bool) type ("INTEGER") + +struct x {int i;}; +#pragma db value (x) + +namespace N +{ + #pragma db object + struct object1 + { + object1 () {} + + #pragma db id + unsigned long id_; + + #pragma db member type ("INTEGER") + bool b_; + }; + + struct object2 + { + object2 () {} + + unsigned long id_; + }; + + #pragma db object (object2) +} + +PRAGMA_DB (member (N::object2::id_) id auto); + +#endif // TEST_HXX diff --git a/odb-tests/common/pragma/testscript b/odb-tests/common/pragma/testscript new file mode 100644 index 0000000..c2697f5 --- /dev/null +++ b/odb-tests/common/pragma/testscript @@ -0,0 +1,49 @@ +# file : common/include/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript + +: mysql +: +if $mysql +{ + .include ../../mysql.testscript + + $* +} + +: sqlite +: +if $sqlite +{ + .include ../../sqlite.testscript + + $* &!odb-test.db +} + +: pgsql +: +if $pgsql +{ + .include ../../pgsql.testscript + + $* +} + +: oracle +: +if $oracle +{ + .include ../../oracle.testscript + + $* +} + +: mssql +: +if $mssql +{ + .include ../../mssql.testscript + + $* +} |