diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2014-11-26 15:04:56 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-11-26 15:04:56 +0200 |
commit | 59e3ebcafb1dc4d54484143fc926ef8377bdb154 (patch) | |
tree | e832c9eff072039b19d8bf67e74d1796b03ff860 /common/bulk/test.hxx | |
parent | 3d022058bc8b61c14c2d16e760ea1393d775c0d0 (diff) |
Implement optimistic concurrency support in bulk operations
Bulk update and SQL Server ROWVERSION not yet supported.
Diffstat (limited to 'common/bulk/test.hxx')
-rw-r--r-- | common/bulk/test.hxx | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/common/bulk/test.hxx b/common/bulk/test.hxx index 526762f..c0955f1 100644 --- a/common/bulk/test.hxx +++ b/common/bulk/test.hxx @@ -5,7 +5,7 @@ #ifndef TEST_HXX #define TEST_HXX -#include <common/config.hxx> // HAVE_CXX11 +#include <common/config.hxx> // HAVE_CXX11, DATABASE_* #include <string> #include <memory> // std::auto_ptr, std::unique_ptr @@ -189,4 +189,50 @@ namespace test6 #endif } +// Test optimistic concurrency. +// +#pragma db namespace table("t7_") +namespace test7 +{ + #pragma db object optimistic bulk(3) + struct object + { + object (unsigned int n_ = 0, std::string s_ = "") + : id (0), v (0), n (n_), s (s_) {} + + #pragma db id auto + unsigned long long id; + + #pragma db version + unsigned long long v; + + unsigned int n; + std::string s; + }; +} + +// Test SQL Server optimistic concurrency with ROWVERSION. +// +#ifdef DATABASE_MSSQL +#pragma db namespace table("t8_") +namespace test8 +{ + #pragma db object optimistic bulk(3) + struct object + { + object (unsigned int n_ = 0, std::string s_ = "") + : id (0), v (0), n (n_), s (s_) {} + + #pragma db id + unsigned long long id; + + #pragma db version type("ROWVERSION") + unsigned long long v; + + unsigned int n; + std::string s; + }; +} +#endif + #endif // TEST_HXX |