diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-07-14 10:27:18 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-07-14 10:32:25 +0200 |
commit | abd136caee7de39b6b6a5e38c48febc50a25dd1f (patch) | |
tree | 68af3df290df297b9365d30ce06585385db2ac37 | |
parent | c4958231d9399091b4f4a7e4c45c24ce6beb3ae8 (diff) |
Inline PostgreSQL traits implementation and remove cxx file
-rw-r--r-- | mapping/makefile | 2 | ||||
-rw-r--r-- | mapping/traits-pgsql.cxx | 19 | ||||
-rw-r--r-- | mapping/traits-pgsql.hxx | 6 |
3 files changed, 7 insertions, 20 deletions
diff --git a/mapping/makefile b/mapping/makefile index b3c029d..1b50fe2 100644 --- a/mapping/makefile +++ b/mapping/makefile @@ -5,7 +5,7 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make -cxx_tun := driver.cxx traits-pgsql.cxx +cxx_tun := driver.cxx odb_hdr := person.hxx cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o)) cxx_od := $(cxx_obj:.o=.o.d) diff --git a/mapping/traits-pgsql.cxx b/mapping/traits-pgsql.cxx deleted file mode 100644 index 026e15f..0000000 --- a/mapping/traits-pgsql.cxx +++ /dev/null @@ -1,19 +0,0 @@ -// file : mapping/traits-pgsql.cxx -// author : Constantin Michael <constantin@codesynthesis.com> -// copyright : not copyrighted - public domain - -#include "traits-pgsql.hxx" - -namespace odb -{ - namespace pgsql - { - namespace - { - tm pg_epoch_tm = {0, 0, 0, 1, 1, 100, 0, 0, 0, 0, 0}; - } - - const time_t value_traits<date, id_date>::pg_epoch_tt ( - mktime (&pg_epoch_tm)); - } -} diff --git a/mapping/traits-pgsql.hxx b/mapping/traits-pgsql.hxx index 6ee396d..92ce4c4 100644 --- a/mapping/traits-pgsql.hxx +++ b/mapping/traits-pgsql.hxx @@ -74,6 +74,9 @@ namespace odb return; } + tm pg_epoch_tm = {0, 0, 0, 1, 1, 100, 0, 0, 0, 0, 0}; + time_t pg_epoch_tt (mktime (&pg_epoch_tm)); + time_t v_tt (pg_epoch_tt + static_cast<time_t> (details::endian_traits::ntoh (i)) * seconds_per_day); @@ -97,6 +100,9 @@ namespace odb time_t v_tt (mktime (&v_tm)); + tm pg_epoch_tm = {0, 0, 0, 1, 1, 100, 0, 0, 0, 0, 0}; + time_t pg_epoch_tt (mktime (&pg_epoch_tm)); + i = details::endian_traits::hton ( static_cast<int> ((v_tt - pg_epoch_tt) / seconds_per_day)); } |