git.iko.soy/typeable/postgresql-simple
on master help sign in
Fix boolean rendering, and some code cleanups
commit3ecf655be5589fb88ce792f2ded728102a2aec2b authorLeon P Smith <leon@melding-monads.com> dateMon 26 Dec 2011, 01:00 (15 years ago) parent74bc853
2 files changed+6−9
src/Database/PostgreSQL/Simple/Param.hs+2−1 src/Database/PostgreSQL/Simple/Result.hs+4−8
src/Database/PostgreSQL/Simple/Param.hs+2−1
@@ -104,7 +104,8 @@ instance Param Null where
104104 {-# INLINE render #-}
105105
106106instance Param Bool where
107− render = Plain . integral . fromEnum
107+ render True = Plain (fromByteString "true")
108+ render False = Plain (fromByteString "false")
108109 {-# INLINE render #-}
109110
110111instance Param Int8 where
src/Database/PostgreSQL/Simple/Result.hs+4−8
@@ -44,8 +44,7 @@ import Data.Time.Clock (UTCTime)
4444import Data.Time.Format (parseTime)
4545import Data.Time.LocalTime (TimeOfDay, makeTimeOfDayValid)
4646import Data.Typeable (TypeRep, Typeable, typeOf)
47−import Data.Word ({- Word, Word8, Word16, Word32, -} Word64)
48−-- import Database.MySQL.Base.Types (Field(..), Type(..))
47+import Data.Word (Word64)
4948import Database.PostgreSQL.Simple.Internal
5049import Database.PostgreSQL.Simple.Field (Field(..), RawResult(..))
5150import Database.PostgreSQL.Simple.BuiltinTypes
@@ -200,12 +199,9 @@ mkCompat = Compat . shiftL 1 . fromEnum
200199
201200compat :: Compat -> Compat -> Bool
202201compat (Compat a) (Compat b) = a .&. b /= 0
203−{--
204−okText, ok8, ok16, ok32, ok64, okWord :: Compat
205−--}
202+
203+okText, ok16, ok32, ok64 :: Compat
206204okText = mkCompats [Name,Text,Char,Bpchar,Varchar]
207−{--}
208−--ok8 = mkCompats [Tiny]
209205ok16 = mkCompats [Int2]
210206ok32 = mkCompats [Int2,Int4]
211207ok64 = mkCompats [Int2,Int4,Int8]
@@ -214,7 +210,7 @@ okInt = ok32
214210#else
215211okInt = ok64
216212#endif
217−--}
213+
218214doConvert :: forall a . (Typeable a)
219215 => Field -> Compat -> (ByteString -> Either SomeException a)
220216 -> Maybe ByteString -> Either SomeException a