Commits

Bryan O'Sullivan committed 3bf7b31 Merge

Merge pull request #1 from gzh/master

Support for UTCTime values in query parameters

Comments (0)

Files changed (1)

Database/HDBC/MySQL/Connection.hsc

   buf_ <- new n
   bindOfSqlValue' (8::Int) buf_ #{const MYSQL_TYPE_LONGLONG} Unsigned
 
-bindOfSqlValue (Types.SqlEpochTime epoch) = do
-  let t = utcToMysqlTime $ posixSecondsToUTCTime (fromIntegral epoch)
+bindOfSqlValue (Types.SqlEpochTime epoch) = 
+  bindOfSqlValue (Types.SqlUTCTime t)
+    where t = posixSecondsToUTCTime (fromIntegral epoch)
+                                            
+bindOfSqlValue (Types.SqlUTCTime utct) = do
+  let t = utcToMysqlTime utct
   buf_ <- new t
   bindOfSqlValue' (#{const sizeof(MYSQL_TIME)}::Int) buf_ #{const MYSQL_TYPE_DATETIME} Signed
       where utcToMysqlTime :: UTCTime -> MYSQL_TIME
 bindOfSqlValue (Types.SqlZonedTime _) =
     error "SqlZonedTime: bind type not implemented"
 
-bindOfSqlValue (Types.SqlUTCTime _) =
-    error "SqlUTCTime: bind type not implemented"
-
 bindOfSqlValue (Types.SqlDiffTime _) =
     error "SqlDiffTime: bind type not implemented"