From 59e3ebcafb1dc4d54484143fc926ef8377bdb154 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 26 Nov 2014 15:04:56 +0200 Subject: Implement optimistic concurrency support in bulk operations Bulk update and SQL Server ROWVERSION not yet supported. --- common/bulk/test.hxx | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'common/bulk/test.hxx') 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 // HAVE_CXX11 +#include // HAVE_CXX11, DATABASE_* #include #include // 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 -- cgit v1.1