aboutsummaryrefslogtreecommitdiff
path: root/qt/driver.cxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-03-25 17:48:23 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-04-22 17:54:50 +0200
commit42a45c8f42888ab6138c45e3b2cbfec50edf6d03 (patch)
tree9ae39bb2552ae26d96837033f6ac205dc236a11c /qt/driver.cxx
parent8e29be9f2229a6c618f95b725502f7082f02d50a (diff)
Add Qt example boilerplate code
Diffstat (limited to 'qt/driver.cxx')
-rw-r--r--qt/driver.cxx21
1 files changed, 10 insertions, 11 deletions
diff --git a/qt/driver.cxx b/qt/driver.cxx
index 14f0c0e..1d4e2b3 100644
--- a/qt/driver.cxx
+++ b/qt/driver.cxx
@@ -11,8 +11,8 @@
#include "database.hxx" // create_database
-#include "employee.hxx"
-#include "employee-odb.hxx"
+#include "person.hxx"
+#include "person-odb.hxx"
using namespace std;
using namespace odb::core;
@@ -24,18 +24,17 @@ main (int argc, char* argv[])
{
auto_ptr<database> db (create_database (argc, argv));
- employee e;
- e.name = "John Doe";
+ person p1;
+ p1.name = "Constantin Michael";
+ p1.date_of_birth.setDate (1979, 03, 07);
- QChar* c = e.name.data ();
-
- while (!c->isNull ())
+ // Persist.
+ //
{
- cout << c->toAscii ();
- ++c;
+ transaction t (db->begin ());
+ db->persist (p1);
+ t.commit ();
}
-
- cout << endl;
}
catch (const odb::exception& e)
{