diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-10-29 19:06:16 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-10-29 19:06:16 +0200 |
commit | f7980c3b005a6b9680d8f83b852b2e33d6ccf4ee (patch) | |
tree | df5ad25775bd27506807be02b7c2baac8b8d754e /pgsql | |
parent | e3587e1967f6b0a3888ca1d4e075b642ac8f5bb4 (diff) |
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.
Diffstat (limited to 'pgsql')
-rw-r--r-- | pgsql/types/driver.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
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<object> query; + typedef odb::result<object> result; + + // Test UUID in queries. + // + { + char uuid[16]; + memcpy (uuid, o.uuid_, 16); + + transaction t (db->begin ()); + + { + result r (db->query<object> (query::uuid == uuid)); + assert (size (r) == 1); + } + + { + result r (db->query<object> (query::uuid == query::_val (uuid))); + assert (size (r) == 1); + } + + { + result r (db->query<object> (query::uuid == query::_ref (uuid))); + assert (size (r) == 1); + } + + { + const char* d (uuid); + result r (db->query<object> (query::uuid == d)); + assert (size (r) == 1); + } + + t.commit (); + } + // Test char array. // { |