From 7fa7720c87f25f89163adf5ad3831f48a4290fa1 Mon Sep 17 00:00:00 2001 From: niXman Date: Sat, 7 Oct 2017 13:20:30 +0300 Subject: [PATCH] support for date/datetime/timestamp types added for ppgen --- include/sqlpp11/ppgen/colops/datetime.h | 7 ++++++- include/sqlpp11/ppgen/colops/timestamp.h | 2 +- tests/Ppgen.cpp | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/sqlpp11/ppgen/colops/datetime.h b/include/sqlpp11/ppgen/colops/datetime.h index ecc134bf..15ef632b 100644 --- a/include/sqlpp11/ppgen/colops/datetime.h +++ b/include/sqlpp11/ppgen/colops/datetime.h @@ -29,9 +29,14 @@ #ifndef _sqlpp__ppgen__colops__datetime_h #define _sqlpp__ppgen__colops__datetime_h +#define SQLPP_DECLARE_COLUMN_GET_TRAITS_LAZY_date \ + PROC_date +#define SQLPP_DECLARE_COLUMN_GEN_TRAITS_PROC_date(...) \ + ::sqlpp::day_point + #define SQLPP_DECLARE_COLUMN_GET_TRAITS_LAZY_datetime \ PROC_datetime #define SQLPP_DECLARE_COLUMN_GEN_TRAITS_PROC_datetime(...) \ - [datetime is not implemented] + ::sqlpp::time_point #endif // _sqlpp__ppgen__colops__datetime_h diff --git a/include/sqlpp11/ppgen/colops/timestamp.h b/include/sqlpp11/ppgen/colops/timestamp.h index 6c0899ae..080be5fc 100644 --- a/include/sqlpp11/ppgen/colops/timestamp.h +++ b/include/sqlpp11/ppgen/colops/timestamp.h @@ -32,6 +32,6 @@ #define SQLPP_DECLARE_COLUMN_GET_TRAITS_LAZY_timestamp \ PROC_timestamp #define SQLPP_DECLARE_COLUMN_GEN_TRAITS_PROC_timestamp(...) \ - [timestamp is not implemented] + ::sqlpp::time_point #endif // _sqlpp__ppgen__colops__timestamp_h diff --git a/tests/Ppgen.cpp b/tests/Ppgen.cpp index 3fa5d3eb..9093e473 100644 --- a/tests/Ppgen.cpp +++ b/tests/Ppgen.cpp @@ -60,6 +60,9 @@ SQLPP_DECLARE_TABLE( (id , int , SQLPP_PRIMARY_KEY) (name , varchar(255), SQLPP_NULL ) (fatal, bool , SQLPP_NOT_NULL ) + (date0, date , SQLPP_NULL ) + (date1, datetime , SQLPP_NULL ) + (date2, timestamp , SQLPP_NULL ) ) // clang-format on