From f7980c3b005a6b9680d8f83b852b2e33d6ccf4ee Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 29 Oct 2015 19:06:16 +0200 Subject: Fix UUID char[16] query_type alias Instead of pre-decaying it to const char*, let the normal decay do it for us. This fixes a compilation issue when used with dynamic multi- database support. --- mssql/types/driver.cxx | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'mssql') diff --git a/mssql/types/driver.cxx b/mssql/types/driver.cxx index 09e13c5..90f9708 100644 --- a/mssql/types/driver.cxx +++ b/mssql/types/driver.cxx @@ -130,11 +130,43 @@ main (int argc, char* argv[]) assert (o == *o1); } - // Test short/long data in queries. - // typedef mssql::query query; typedef odb::result result; + // Test UUID in queries. + // + { + char uuid[16]; + memcpy (uuid, o.uuid_, 16); + + transaction t (db->begin ()); + + { + result r (db->query (query::uuid == uuid)); + assert (size (r) == 1); + } + + { + result r (db->query (query::uuid == query::_val (uuid))); + assert (size (r) == 1); + } + + { + result r (db->query (query::uuid == query::_ref (uuid))); + assert (size (r) == 1); + } + + { + const char* d (uuid); + result r (db->query (query::uuid == d)); + assert (size (r) == 1); + } + + t.commit (); + } + + // Test short/long data in queries. + // { transaction t (db->begin ()); -- cgit v1.1