diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-07-25 11:32:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-07-25 11:32:54 +0200 |
commit | fa31e7c6a729a5e9772bfd775d19501996652f30 (patch) | |
tree | ab229424af42249109be404c9c22d02f98efe1fe /pgsql | |
parent | 4f59995242d894baa041a8171d420a18b43ceb8c (diff) |
Fix PostgreSQL test template to do the same as in other databases
Diffstat (limited to 'pgsql')
-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 |