From c27104f6b93fb314bf4deab87fa97490ffac0420 Mon Sep 17 00:00:00 2001 From: randomdan Date: Mon, 3 Mar 2014 20:57:27 +0000 Subject: Adds native support for time_duration as a variable type Pass/retrieve boost::posix_time ptime and time_duration into/out of the db tier --- libdbpp/Jamfile.jam | 2 ++ libdbpp/column.h | 6 +++--- libdbpp/command.h | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libdbpp/Jamfile.jam b/libdbpp/Jamfile.jam index ba60a55..387afd6 100644 --- a/libdbpp/Jamfile.jam +++ b/libdbpp/Jamfile.jam @@ -2,6 +2,7 @@ alias glibmm : : : : "`pkg-config --cflags glibmm-2.4`" "`pkg-config --libs glibmm-2.4`" ; +lib boost_date_time : : boost_date_time ; lib dbpp : [ glob *.cpp ] : @@ -10,4 +11,5 @@ lib dbpp : : : . glibmm + boost_date_time ; diff --git a/libdbpp/column.h b/libdbpp/column.h index c0b3c37..80bec8c 100644 --- a/libdbpp/column.h +++ b/libdbpp/column.h @@ -2,8 +2,7 @@ #define DB_COLUMN_H #include -#include -#include +#include namespace DB { class HandleField { @@ -12,7 +11,8 @@ namespace DB { virtual void string(const char *, size_t len) = 0; virtual void integer(int64_t) = 0; virtual void floatingpoint(double) = 0; - virtual void timestamp(const struct tm &) = 0; + virtual void interval(const boost::posix_time::time_duration &) = 0; + virtual void timestamp(const boost::posix_time::ptime &) = 0; }; class Command; class Column { diff --git a/libdbpp/command.h b/libdbpp/command.h index 40b5e2a..df621d2 100644 --- a/libdbpp/command.h +++ b/libdbpp/command.h @@ -2,6 +2,7 @@ #define DB_COMMAND_H #include +#include namespace DB { class Command { @@ -21,8 +22,8 @@ namespace DB { virtual void bindParamS(unsigned int i, const Glib::ustring &) = 0; - virtual void bindParamT(unsigned int i, const struct tm *) = 0; - virtual void bindParamT(unsigned int i, time_t) = 0; + virtual void bindParamT(unsigned int i, const boost::posix_time::time_duration &) = 0; + virtual void bindParamT(unsigned int i, const boost::posix_time::ptime &) = 0; virtual void bindNull(unsigned int i) = 0; -- cgit v1.2.3