summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-07-17 17:14:23 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-07-17 17:14:23 -0400
commitb3621d4658f2c841681abb4250858c6a82489af2 (patch)
treea6896bb2d44036f1bb88bcf26c766cc7ace921d1 /src
parentc3d4d3e0a6a72dfff9f4f62ec01c319cb18a4130 (diff)
Fix month off-by-one for MySQL timestamps
Diffstat (limited to 'src')
-rw-r--r--src/mysql.sml7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mysql.sml b/src/mysql.sml
index 77f95f8d..75c48b9a 100644
--- a/src/mysql.sml
+++ b/src/mysql.sml
@@ -666,7 +666,7 @@ fun p_getcol {loc, wontLeakStrings = _, col = i, typ = t} =
string ";",
newline,
newline,
- string "struct tm t = {mt->second, mt->minute, mt->hour, mt->day, mt->month, mt->year, 0, 0, -1};",
+ string "struct tm t = {mt->second, mt->minute, mt->hour, mt->day, mt->month-1, mt->year, 0, 0, -1};",
newline,
string "mktime(&t);",
newline,
@@ -1046,7 +1046,10 @@ fun queryPrepared {loc, id, query, inputs, cols, doCols, nested} =
string ": error converting to MySQL time\");",
newline,
oneField "year" "year",
- oneField "month" "mon",
+ box [string "in_buffer",
+ string (Int.toString i),
+ string ".month = tms.tm_mon + 1;",
+ newline],
oneField "day" "mday",
oneField "hour" "hour",
oneField "minute" "min",