From d87a78e24d5988cfa3556707b7beffd1b0c15901 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 11 Sep 2012 13:55:48 +0200 Subject: Add support for mapping std::array to BLOB and char[16] to UUID types --- mssql/types/driver.cxx | 2 ++ mssql/types/test.hxx | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'mssql') diff --git a/mssql/types/driver.cxx b/mssql/types/driver.cxx index 2d32429..3f5577f 100644 --- a/mssql/types/driver.cxx +++ b/mssql/types/driver.cxx @@ -97,6 +97,8 @@ main (int argc, char* argv[]) o.guid_.Data3 = 0x4E4D; memcpy (&o.guid_.Data4, "\xB2\x2F\x56\x44\x3C\xFA\x54\x3F", 8); #endif + memcpy (o.uuid_, "\x6F\x84\x6D\x41\xC8\x9A\x4E\x4D\xB2\x2F" + "\x56\x44\x3C\xFA\x54\x3F", 16); // Persist. // diff --git a/mssql/types/test.hxx b/mssql/types/test.hxx index b89a621..d735acf 100644 --- a/mssql/types/test.hxx +++ b/mssql/types/test.hxx @@ -241,6 +241,9 @@ struct object GUID guid_; #endif + #pragma db type ("UNIQUEIDENTIFIER") + char uuid_[16]; + bool operator== (const object& y) const { @@ -301,7 +304,7 @@ struct object #ifdef _WIN32 && std::memcmp (&guid_, &y.guid_, sizeof (guid_)) == 0 #endif - ; + && std::memcmp (uuid_, y.uuid_, sizeof (uuid_)) == 0; } }; -- cgit v1.1