From abd136caee7de39b6b6a5e38c48febc50a25dd1f Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Thu, 14 Jul 2011 10:27:18 +0200 Subject: Inline PostgreSQL traits implementation and remove cxx file --- mapping/makefile | 2 +- mapping/traits-pgsql.cxx | 19 ------------------- mapping/traits-pgsql.hxx | 6 ++++++ 3 files changed, 7 insertions(+), 20 deletions(-) delete mode 100644 mapping/traits-pgsql.cxx (limited to 'mapping') 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 -// 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::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 (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 ((v_tt - pg_epoch_tt) / seconds_per_day)); } -- cgit v1.1