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 | |
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.
-rw-r--r-- | mssql/types/driver.cxx | 36 | ||||
-rw-r--r-- | pgsql/types/driver.cxx | 35 |
2 files changed, 69 insertions, 2 deletions
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<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 short/long data in queries. + // { transaction t (db->begin ()); 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. // { |