diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/query/driver.cxx | 27 | ||||
-rw-r--r-- | common/query/test.hxx | 10 | ||||
-rw-r--r-- | common/query/test.std | 92 |
3 files changed, 67 insertions, 62 deletions
diff --git a/common/query/driver.cxx b/common/query/driver.cxx index b94bed6..df631f4 100644 --- a/common/query/driver.cxx +++ b/common/query/driver.cxx @@ -444,26 +444,47 @@ main (int argc, char* argv[]) transaction t (db->begin ()); result r; + result::iterator i; + // Oracle does not support LOB comparisons. + // #ifndef DATABASE_ORACLE // == // r = db->query<person> (query::public_key == key2); - result::iterator i (r.begin ()); + i = r.begin (); assert (i != r.end ()); + assert (i->public_key_ == key2); + assert (++i == r.end ()); #endif // is_null // r = db->query<person> (query::public_key.is_null ()); - print (r); + + i = r.begin (); + assert (i != r.end ()); + + assert (i->first_name_ == "Johansen" && i->last_name_ == "Johansen"); + assert (++i == r.end ()); // is_not_null // r = db->query<person> (query::public_key.is_not_null ()); - print (r); + + i = r.begin (); + assert (i != r.end ()); + + assert (i->first_name_ == "John" && i->last_name_ == "Doe"); + assert (++i != r.end ()); + + assert (i->first_name_ == "Jane" && i->last_name_ == "Doe"); + assert (++i != r.end ()); + + assert (i->first_name_ == "Joe" && i->last_name_ == "Dirt"); + assert (++i == r.end ()); t.commit (); } diff --git a/common/query/test.hxx b/common/query/test.hxx index db09f32..eab7048 100644 --- a/common/query/test.hxx +++ b/common/query/test.hxx @@ -74,16 +74,6 @@ operator<< (std::ostream& os, const person& p) os << ' ' << p.last_name_ << ' ' << p.age_ << (p.married_ ? " married" : " single"); - if (p.public_key_ && p.public_key_->size () > 0) - { - os << ' '; - - for (std::size_t i (0), e (p.public_key_->size () - 1); i < e; ++i) - os << (unsigned int)(*p.public_key_)[i] << '-'; - - os << (unsigned int)p.public_key_->back (); - } - return os; } diff --git a/common/query/test.std b/common/query/test.std index f351eab..23f9029 100644 --- a/common/query/test.std +++ b/common/query/test.std @@ -1,7 +1,7 @@ test 001 -John Doe 30 married 35-3-21 -Jane Doe 29 married 19-19-84 -Joe Squeaky Dirt 31 single 8-98-53 +John Doe 30 married +Jane Doe 29 married +Joe Squeaky Dirt 31 single Johansen J Johansen 32 single test 002 Jane Doe 29 married @@ -10,96 +10,90 @@ Joe Squeaky Dirt 31 single Johansen J Johansen 32 single test 003 -John Doe 30 married 35-3-21 +John Doe 30 married test 004 -John Doe 30 married 35-3-21 +John Doe 30 married test 005 -John Doe 30 married 35-3-21 +John Doe 30 married -Joe Squeaky Dirt 31 single 8-98-53 +Joe Squeaky Dirt 31 single test 006 -John Doe 30 married 35-3-21 -Jane Doe 29 married 19-19-84 +John Doe 30 married +Jane Doe 29 married -Joe Squeaky Dirt 31 single 8-98-53 +Joe Squeaky Dirt 31 single Johansen J Johansen 32 single test 007 -John Doe 30 married 35-3-21 -Jane Doe 29 married 19-19-84 +John Doe 30 married +Jane Doe 29 married -Joe Squeaky Dirt 31 single 8-98-53 +Joe Squeaky Dirt 31 single Johansen J Johansen 32 single test 008 -John Doe 30 married 35-3-21 -Jane Doe 29 married 19-19-84 +John Doe 30 married +Jane Doe 29 married -Joe Squeaky Dirt 31 single 8-98-53 +Joe Squeaky Dirt 31 single -John Doe 30 married 35-3-21 -Jane Doe 29 married 19-19-84 +John Doe 30 married +Jane Doe 29 married test 009 -John Doe 30 married 35-3-21 -Jane Doe 29 married 19-19-84 +John Doe 30 married +Jane Doe 29 married -Joe Squeaky Dirt 31 single 8-98-53 +Joe Squeaky Dirt 31 single Johansen J Johansen 32 single -John Doe 30 married 35-3-21 -Jane Doe 29 married 19-19-84 +John Doe 30 married +Jane Doe 29 married -Joe Squeaky Dirt 31 single 8-98-53 +Joe Squeaky Dirt 31 single Johansen J Johansen 32 single -John Doe 30 married 35-3-21 -Jane Doe 29 married 19-19-84 +John Doe 30 married +Jane Doe 29 married -Joe Squeaky Dirt 31 single 8-98-53 +Joe Squeaky Dirt 31 single Johansen J Johansen 32 single test 010 -Jane Doe 29 married 19-19-84 +Jane Doe 29 married -John Doe 30 married 35-3-21 -Jane Doe 29 married 19-19-84 -Joe Squeaky Dirt 31 single 8-98-53 +John Doe 30 married +Jane Doe 29 married +Joe Squeaky Dirt 31 single -Jane Doe 29 married 19-19-84 +Jane Doe 29 married -Joe Squeaky Dirt 31 single 8-98-53 +Joe Squeaky Dirt 31 single Johansen J Johansen 32 single -Jane Doe 29 married 19-19-84 -John Doe 30 married 35-3-21 +Jane Doe 29 married +John Doe 30 married test 011 -John Doe 30 married 35-3-21 -Jane Doe 29 married 19-19-84 +John Doe 30 married +Jane Doe 29 married -John Doe 30 married 35-3-21 -Jane Doe 29 married 19-19-84 -Joe Squeaky Dirt 31 single 8-98-53 +John Doe 30 married +Jane Doe 29 married +Joe Squeaky Dirt 31 single test 012 Johansen J Johansen 32 single test 013 -Joe Squeaky Dirt 31 single 8-98-53 +Joe Squeaky Dirt 31 single test 014 test 015 -John Doe 30 married 35-3-21 -Jane Doe 29 married 19-19-84 +John Doe 30 married +Jane Doe 29 married test 016 -Johansen J Johansen 32 single - -John Doe 30 married 35-3-21 -Jane Doe 29 married 19-19-84 -Joe Squeaky Dirt 31 single 8-98-53 - |