packages feed

persistent 0.2.0.2 → 0.2.1

raw patch · 2 files changed

+12/−8 lines, 2 files

Files

Database/Persist/Base.hs view
@@ -44,6 +44,7 @@ import qualified Data.ByteString.Lazy as L import Data.Enumerator import qualified Control.Exception as E+import Data.Bits (bitSize)  -- | A raw value which can be stored in any backend and can be marshalled to -- and from a 'PersistField'.@@ -62,7 +63,8 @@ -- datatypes, eg SqlString instead of SqlVarchar. Different SQL databases may -- have different translations for these types. data SqlType = SqlString-             | SqlInteger+             | SqlInt32+             | SqlInteger -- ^ 8-byte integer; should be renamed SqlInt64              | SqlReal              | SqlBool              | SqlDay@@ -112,25 +114,27 @@     toPersistValue = PersistInt64 . fromIntegral     fromPersistValue (PersistInt64 i) = Right $ fromIntegral i     fromPersistValue x = Left $ "Expected Integer, received: " ++ show x-    sqlType _ = SqlInteger+    sqlType x = case bitSize x of+                    32 -> SqlInt32+                    _ -> SqlInteger  instance PersistField Int8 where     toPersistValue = PersistInt64 . fromIntegral     fromPersistValue (PersistInt64 i) = Right $ fromIntegral i     fromPersistValue x = Left $ "Expected Integer, received: " ++ show x-    sqlType _ = SqlInteger+    sqlType _ = SqlInt32  instance PersistField Int16 where     toPersistValue = PersistInt64 . fromIntegral     fromPersistValue (PersistInt64 i) = Right $ fromIntegral i     fromPersistValue x = Left $ "Expected Integer, received: " ++ show x-    sqlType _ = SqlInteger+    sqlType _ = SqlInt32  instance PersistField Int32 where     toPersistValue = PersistInt64 . fromIntegral     fromPersistValue (PersistInt64 i) = Right $ fromIntegral i     fromPersistValue x = Left $ "Expected Integer, received: " ++ show x-    sqlType _ = SqlInteger+    sqlType _ = SqlInt32  instance PersistField Int64 where     toPersistValue = PersistInt64 . fromIntegral@@ -142,13 +146,13 @@     toPersistValue = PersistInt64 . fromIntegral     fromPersistValue (PersistInt64 i) = Right $ fromIntegral i     fromPersistValue x = Left $ "Expected Wordeger, received: " ++ show x-    sqlType _ = SqlInteger+    sqlType _ = SqlInt32  instance PersistField Word16 where     toPersistValue = PersistInt64 . fromIntegral     fromPersistValue (PersistInt64 i) = Right $ fromIntegral i     fromPersistValue x = Left $ "Expected Wordeger, received: " ++ show x-    sqlType _ = SqlInteger+    sqlType _ = SqlInt32  instance PersistField Word32 where     toPersistValue = PersistInt64 . fromIntegral
persistent.cabal view
@@ -1,5 +1,5 @@ name:            persistent-version:         0.2.0.2+version:         0.2.1 license:         BSD3 license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>