diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-04-25 19:49:33 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-05-03 14:33:32 +0300 |
commit | 68ff3d1fa1c8eb86bf89b7b9cbad78a45f362672 (patch) | |
tree | cdaaf84ceeb7f5c4ee7e06f84fed383a18d40350 /odb-tests/mssql/stored-proc | |
parent | 6fad72ea59dca2f2cc9e431bcc5a026bda17fdf2 (diff) |
Add support for testing of libodb-mssql to odb-tests
Diffstat (limited to 'odb-tests/mssql/stored-proc')
-rw-r--r-- | odb-tests/mssql/stored-proc/buildfile | 34 | ||||
-rw-r--r-- | odb-tests/mssql/stored-proc/driver.cxx | 14 | ||||
-rw-r--r-- | odb-tests/mssql/stored-proc/testscript | 29 |
3 files changed, 71 insertions, 6 deletions
diff --git a/odb-tests/mssql/stored-proc/buildfile b/odb-tests/mssql/stored-proc/buildfile new file mode 100644 index 0000000..c92eabd --- /dev/null +++ b/odb-tests/mssql/stored-proc/buildfile @@ -0,0 +1,34 @@ +# file : mssql/stored-proc/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') +{ + assert ($mssql) "mssql should be configured for this test" + assert (!$multi) "multi-database mode is not supported by this test" +} + +import libodb = libodb%lib{odb} + +import libs = libodb-mssql%lib{odb-mssql} +import libs += lib{common} + +exe{driver}: {hxx cxx}{* -*-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} + +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 mssql_stored_proc_ \ + --generate-schema \ + --default-database common \ + --generate-query + +cxx.poptions =+ "-I$out_base" "-I$src_base" diff --git a/odb-tests/mssql/stored-proc/driver.cxx b/odb-tests/mssql/stored-proc/driver.cxx index 2389798..36f8d82 100644 --- a/odb-tests/mssql/stored-proc/driver.cxx +++ b/odb-tests/mssql/stored-proc/driver.cxx @@ -4,18 +4,20 @@ // Test SQL Server stored procedure support. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/mssql/database.hxx> #include <odb/mssql/transaction.hxx> -#include <common/common.hxx> +#include <libcommon/common.hxx> #include "test.hxx" #include "test-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; namespace mssql = odb::mssql; using namespace mssql; @@ -43,7 +45,7 @@ main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_specific_database<database> (argc, argv)); + unique_ptr<database> db (create_specific_database<database> (argc, argv)); object o1 (1, "a"); object o2 (2, "b"); @@ -139,7 +141,7 @@ main (int argc, char* argv[]) db->query_one<insert_object> ( query::_val (4) + "," + query::_val ("d")); - auto_ptr<object> o (db->load<object> (4)); + unique_ptr<object> o (db->load<object> (4)); cout << o->num << " " << o->str << endl << endl; @@ -154,7 +156,7 @@ main (int argc, char* argv[]) db->query_one<no_result> ( "EXEC insert_object_id" + query::_val (5) + "," + query::_val ("e")); - auto_ptr<object> o (db->load<object> (5)); + unique_ptr<object> o (db->load<object> (5)); cout << o->num << " " << o->str << endl << endl; diff --git a/odb-tests/mssql/stored-proc/testscript b/odb-tests/mssql/stored-proc/testscript new file mode 100644 index 0000000..0de46a7 --- /dev/null +++ b/odb-tests/mssql/stored-proc/testscript @@ -0,0 +1,29 @@ +# file : mssql/stored-proc/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../mssql.testscript + ++$create_schema + +: basics +: +$* >>EOO + 1 a + 2 b + 3 c + + a + b + + 1 3 + + 4 d + + 5 e + + 123 6 + + 123 7 + + EOO |