Permalink
Browse files

Support for UTCTime parameters in queries

  • Loading branch information...
1 parent c4b7d23 commit a1c824219804795bde6f0fc6e2027bf0d5391828 @gzh gzh committed Apr 30, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 Database/HDBC/MySQL/Connection.hsc
View
11 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 a1c8242

Please sign in to comment.