diff options
Diffstat (limited to 'pgsql/template')
-rw-r--r-- | pgsql/template/driver.cxx | 22 | ||||
-rw-r--r-- | pgsql/template/makefile | 1 | ||||
-rw-r--r-- | pgsql/template/test.hxx | 18 |
3 files changed, 39 insertions, 2 deletions
diff --git a/pgsql/template/driver.cxx b/pgsql/template/driver.cxx index 755aaeb..329c91c 100644 --- a/pgsql/template/driver.cxx +++ b/pgsql/template/driver.cxx @@ -9,17 +9,35 @@ #include <cassert> #include <iostream> +#include <odb/pgsql/database.hxx> +#include <odb/pgsql/transaction.hxx> + +#include <common/common.hxx> + +#include "test.hxx" +#include "test-odb.hxx" + using namespace std; +using namespace odb::core; int -main () +main (int argc, char* argv[]) { try { + auto_ptr<database> db (create_database (argc, argv)); + + // + // cout << "test 001" << endl; + { + transaction t (db->begin ()); + t.commit (); + } } - catch (...) + catch (const odb::exception& e) { + cerr << e.what () << endl; return 1; } } diff --git a/pgsql/template/makefile b/pgsql/template/makefile index eb43706..aab7437 100644 --- a/pgsql/template/makefile +++ b/pgsql/template/makefile @@ -62,6 +62,7 @@ $(dist): # Test. # $(test): $(driver) $(src_base)/test.std + $(call schema) $(call message,test $<,$< --options-file $(dcf_root)/db.options \ >$(out_base)/test.out) $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out) diff --git a/pgsql/template/test.hxx b/pgsql/template/test.hxx index 9916172..7f7bb99 100644 --- a/pgsql/template/test.hxx +++ b/pgsql/template/test.hxx @@ -5,4 +5,22 @@ #ifndef TEST_HXX #define TEST_HXX +#include <odb/core.hxx> + +#pragma db object +struct object +{ + object (unsigned long id) + : id_ (id) + { + } + + object () + { + } + + #pragma db id + unsigned long id_; +}; + #endif // TEST_HXX |