Permalink
Browse files

Merge pull request #1 from gzh/master

Support for UTCTime values in query parameters
  • Loading branch information...
2 parents c4b7d23 + a1c8242 commit 674e30d520cdee98987515766057cfaf5017e8bb @bos bos committed May 12, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 Database/HDBC/MySQL/Connection.hsc
@@ -419,8 +419,12 @@ bindOfSqlValue (Types.SqlWord64 n) = do
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
@@ -455,9 +459,6 @@ bindOfSqlValue (Types.SqlLocalTime _) =
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"

0 comments on commit 674e30d

Please sign in to comment.