From fa31e7c6a729a5e9772bfd775d19501996652f30 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 25 Jul 2012 11:32:54 +0200 Subject: Fix PostgreSQL test template to do the same as in other databases --- pgsql/template/driver.cxx | 22 ++++++++++++++++++++-- pgsql/template/makefile | 1 + pgsql/template/test.hxx | 18 ++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) (limited to 'pgsql') 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 #include +#include +#include + +#include + +#include "test.hxx" +#include "test-odb.hxx" + using namespace std; +using namespace odb::core; int -main () +main (int argc, char* argv[]) { try { + auto_ptr 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 + +#pragma db object +struct object +{ + object (unsigned long id) + : id_ (id) + { + } + + object () + { + } + + #pragma db id + unsigned long id_; +}; + #endif // TEST_HXX -- cgit v1.1