From 42a45c8f42888ab6138c45e3b2cbfec50edf6d03 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Fri, 25 Mar 2011 17:48:23 +0200 Subject: Add Qt example boilerplate code --- qt/driver.cxx | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'qt/driver.cxx') 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 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) { -- cgit v1.1