From 8e29be9f2229a6c618f95b725502f7082f02d50a Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Tue, 22 Mar 2011 10:49:56 +0200 Subject: Add Qt profile example --- qt/driver.cxx | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 qt/driver.cxx (limited to 'qt/driver.cxx') diff --git a/qt/driver.cxx b/qt/driver.cxx new file mode 100644 index 0000000..14f0c0e --- /dev/null +++ b/qt/driver.cxx @@ -0,0 +1,45 @@ +// file : qt/driver.cxx +// author : Constantin Michael +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include + +#include +#include +#include + +#include "database.hxx" // create_database + +#include "employee.hxx" +#include "employee-odb.hxx" + +using namespace std; +using namespace odb::core; + +int +main (int argc, char* argv[]) +{ + try + { + auto_ptr db (create_database (argc, argv)); + + employee e; + e.name = "John Doe"; + + QChar* c = e.name.data (); + + while (!c->isNull ()) + { + cout << c->toAscii (); + ++c; + } + + cout << endl; + } + catch (const odb::exception& e) + { + cerr << e.what () << endl; + return 1; + } +} -- cgit v1.1