aboutsummaryrefslogtreecommitdiff
path: root/qt
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-04-24 09:15:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-04-24 09:15:55 +0200
commit9bfd22d3bfe7ca6985579de6c178d8ea5ee83cfe (patch)
tree36b58532e531ae10de17f1d70bab0c1cbefa038d /qt
parentac3cd9c34d260c6bbf615ed6e0413d0989f5a6e2 (diff)
Make Qt example consistent with Boost example
Use the same dates and the same query.
Diffstat (limited to 'qt')
-rw-r--r--qt/driver.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/qt/driver.cxx b/qt/driver.cxx
index 8889b96..3042b48 100644
--- a/qt/driver.cxx
+++ b/qt/driver.cxx
@@ -40,14 +40,14 @@ main (int argc, char* argv[])
QSharedPointer<Employee> john (
new Employee ("John",
"Doe",
- QDate (1974, 5, 23),
+ QDate (1975, 1, 1),
QByteArray ("\0xF1\0x00\0x34\0x45\0x00\0xDE", 6),
er));
QSharedPointer<Employee> jane (
new Employee ("Jane",
"Doe",
- QDate (1983, 1, 18),
+ QDate (1976, 2, 2),
QByteArray ("\0xD7\0x00\0x14", 3),
er));
@@ -79,14 +79,14 @@ main (int argc, char* argv[])
QSharedPointer<Employee> john (
new Employee ("John",
"Smith",
- QDate (1954, 8, 1),
+ QDate (1977, 3, 3),
QByteArray ("\0x23\0xFD\0x8F\0x00", 4),
er));
QSharedPointer<Employee> jane (
new Employee ("Jane",
"Smith",
- QDate (1976, 12, 31),
+ QDate (1978, 4, 4),
QByteArray ("0x00\0x32\0x00\0x01\0x00", 5),
er));
@@ -148,7 +148,8 @@ main (int argc, char* argv[])
t.commit ();
}
- // Search for Complex Systems Inc employees.
+ // Search for Complex Systems Inc employees that were born before
+ // April 1978.
//
{
typedef odb::query<Employee> query;
@@ -158,10 +159,12 @@ main (int argc, char* argv[])
transaction t (db->begin ());
result r (db->query<Employee> (
- query::employer::name == "Complex Systems Inc"));
+ query::employer::name == "Complex Systems Inc" &&
+ query::born < QDate (1978, 4, 1)));
for (result::iterator i (r.begin ()); i != r.end (); ++i)
- cout << i->first () << " " << i->last () << endl;
+ cout << i->first () << " " << i->last ()
+ << " " << i->born ().toString () << endl;
t.commit ();
}