diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-01-14 16:01:06 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-01-14 16:01:06 +0200 |
commit | 5e113195591a9f8dccbb8f5f743cdd7776906b08 (patch) | |
tree | 74eb23894a9a85f3255b95cd7e998a405a6464c5 /odb/mssql/statement.ixx | |
parent | 9844c8efeaa64f62e4bfbd739088d93df97d8fc8 (diff) |
Add support for MSSQL ROWVERSION
ODB can now use ROWVERSION column as an optimistic concurrency version.
Diffstat (limited to 'odb/mssql/statement.ixx')
-rw-r--r-- | odb/mssql/statement.ixx | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/odb/mssql/statement.ixx b/odb/mssql/statement.ixx new file mode 100644 index 0000000..d27e961 --- /dev/null +++ b/odb/mssql/statement.ixx @@ -0,0 +1,49 @@ +// file : odb/mssql/statement.ixx +// copyright : Copyright (c) 2005-2012 Code Synthesis Tools CC +// license : ODB NCUEL; see accompanying LICENSE file + +namespace odb +{ + namespace mssql + { + inline unsigned long long insert_statement:: + version () + { + unsigned long long r; + + // The value is in the big-endian format. + // + unsigned char* p (reinterpret_cast<unsigned char*> (&r)); + p[0] = version_[7]; + p[1] = version_[6]; + p[2] = version_[5]; + p[3] = version_[4]; + p[4] = version_[3]; + p[5] = version_[2]; + p[6] = version_[1]; + p[7] = version_[0]; + + return r; + } + + inline unsigned long long update_statement:: + version () + { + unsigned long long r; + + // The value is in the big-endian format. + // + unsigned char* p (reinterpret_cast<unsigned char*> (&r)); + p[0] = version_[7]; + p[1] = version_[6]; + p[2] = version_[5]; + p[3] = version_[4]; + p[4] = version_[3]; + p[5] = version_[2]; + p[6] = version_[1]; + p[7] = version_[0]; + + return r; + } + } +} |