From 53ad8ff1422266a89e667dddc0c73b2d0f91a373 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 27 Aug 2021 19:23:39 +0100 Subject: Support binding date/time values to MySQL --- lib/input/mysqlBindings.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib/input/mysqlBindings.cpp (limited to 'lib/input/mysqlBindings.cpp') diff --git a/lib/input/mysqlBindings.cpp b/lib/input/mysqlBindings.cpp new file mode 100644 index 0000000..3895821 --- /dev/null +++ b/lib/input/mysqlBindings.cpp @@ -0,0 +1,28 @@ +#include "mysqlBindings.h" + +namespace MyGrate::Input { + MYSQL_TIME & + operator<<(MYSQL_TIME & t, const Date & dt) + { + t.year = dt.year; + t.month = dt.month; + t.day = dt.day; + return t; + } + + MYSQL_TIME & + operator<<(MYSQL_TIME & t, const Time & dt) + { + t.hour = dt.hour; + t.minute = dt.minute; + t.second = dt.second; + return t; + } + + MYSQL_TIME & + operator<<(MYSQL_TIME & t, const DateTime & dt) + { + return t << (Date)dt << (Time)dt; + } + +} -- cgit v1.2.3