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. --- pgsql/types/driver.cxx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'pgsql') diff --git a/pgsql/types/driver.cxx b/pgsql/types/driver.cxx index 35b7278..79e624e 100644 --- a/pgsql/types/driver.cxx +++ b/pgsql/types/driver.cxx @@ -86,6 +86,41 @@ main (int argc, char* argv[]) assert (o == *o1); } + typedef pgsql::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 char array. // { -- cgit v1.1