From 9844c8efeaa64f62e4bfbd739088d93df97d8fc8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 13 Jan 2013 12:04:52 +0200 Subject: Implement set_image() for id_rowversion --- odb/mssql/traits.hxx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'odb/mssql/traits.hxx') diff --git a/odb/mssql/traits.hxx b/odb/mssql/traits.hxx index d1399aa..a74b002 100644 --- a/odb/mssql/traits.hxx +++ b/odb/mssql/traits.hxx @@ -1494,8 +1494,23 @@ namespace odb v = 0; } - // There is no set_image() since it is impossible to insert an - // explicit value into a rowversion column. + static void + set_image (unsigned char* i, bool& is_null, unsigned long long v) + { + is_null = false; + + // The value is in the big-endian format. + // + const unsigned char* p (reinterpret_cast (&v)); + i[0] = p[7]; + i[1] = p[6]; + i[2] = p[5]; + i[3] = p[4]; + i[4] = p[3]; + i[5] = p[2]; + i[6] = p[1]; + i[7] = p[0]; + } }; // -- cgit v1.1