diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-09-14 15:19:16 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-09-14 15:19:16 +0200 |
commit | 349178ecf6c69be63bd81ce81d310404574cb373 (patch) | |
tree | fccbd90c0cae4f43389ec830c9d7924c30c62113 /template/driver.cxx | |
parent | 22dd2e8a904d26c18f6e4c634e14b21a8aaddc7d (diff) |
Establish base build system
Diffstat (limited to 'template/driver.cxx')
-rw-r--r-- | template/driver.cxx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/template/driver.cxx b/template/driver.cxx new file mode 100644 index 0000000..e9dab52 --- /dev/null +++ b/template/driver.cxx @@ -0,0 +1,39 @@ +// file : hello/driver.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : not copyrighted - public domain + +#include <memory> // std::auto_ptr +#include <iostream> + +#include <odb/database.hxx> +#include <odb/transaction.hxx> + +#include "database.hxx" // create_database + +#include "person.hxx" +#include "person-odb.hxx" + +using namespace std; +using namespace odb; + +int +main (int argc, char* argv[]) +{ + try + { + auto_ptr<database> db (create_database (argc, argv)); + + { + person p ("John", "Doe", 21); + + transaction t (db->begin_transaction ()); + db->persist (p); + t.commit (); + } + } + catch (const odb::exception& e) + { + cerr << e.what () << endl; + return 1; + } +} |