diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-08-27 19:23:39 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-08-27 19:23:39 +0100 |
commit | 53ad8ff1422266a89e667dddc0c73b2d0f91a373 (patch) | |
tree | 3b7e2415cd6d815758580cf54b0ae0d653d47d4e /lib/input/mysqlBindings.cpp | |
parent | Mark some empty base implementations not tested (diff) | |
download | mygrate-53ad8ff1422266a89e667dddc0c73b2d0f91a373.tar.bz2 mygrate-53ad8ff1422266a89e667dddc0c73b2d0f91a373.tar.xz mygrate-53ad8ff1422266a89e667dddc0c73b2d0f91a373.zip |
Support binding date/time values to MySQL
Diffstat (limited to 'lib/input/mysqlBindings.cpp')
-rw-r--r-- | lib/input/mysqlBindings.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
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; + } + +} |