aboutsummaryrefslogtreecommitdiff
path: root/qt/driver.cxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-03-22 10:49:56 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-04-22 17:54:50 +0200
commit8e29be9f2229a6c618f95b725502f7082f02d50a (patch)
tree77eb79933015300a398a10135122534bfa5abaa3 /qt/driver.cxx
parentd206125ed2d85891d946c3c12c9b7eb95d5af41e (diff)
Add Qt profile example
Diffstat (limited to 'qt/driver.cxx')
-rw-r--r--qt/driver.cxx45
1 files changed, 45 insertions, 0 deletions
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 <constantin@codesynthesis.com>
+// copyright : not copyrighted - public domain
+
+#include <memory> // std::auto_ptr
+#include <iostream>
+
+#include <odb/database.hxx>
+#include <odb/session.hxx>
+#include <odb/transaction.hxx>
+
+#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<database> 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;
+ }
+}