packages feed

relational-query-HDBC 0.7.0.1 → 0.7.1.0

raw patch · 4 files changed

+51/−1 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Database.HDBC.Record: foldlFetch :: FromSql SqlValue a => (b -> a -> IO b) -> b -> ExecutedStatement a -> IO b
+ Database.HDBC.Record: forFetch :: FromSql SqlValue a => ExecutedStatement a -> (a -> IO b) -> IO [b]
+ Database.HDBC.Record.Persistable: instance Database.Record.FromSql.FromSql Database.HDBC.SqlValue.SqlValue GHC.Word.Word16
+ Database.HDBC.Record.Persistable: instance Database.Record.FromSql.FromSql Database.HDBC.SqlValue.SqlValue GHC.Word.Word8
+ Database.HDBC.Record.Persistable: instance Database.Record.KeyConstraint.HasColumnConstraint Database.Record.KeyConstraint.NotNull GHC.Word.Word16
+ Database.HDBC.Record.Persistable: instance Database.Record.KeyConstraint.HasColumnConstraint Database.Record.KeyConstraint.NotNull GHC.Word.Word8
+ Database.HDBC.Record.Persistable: instance Database.Record.Persistable.PersistableWidth GHC.Word.Word16
+ Database.HDBC.Record.Persistable: instance Database.Record.Persistable.PersistableWidth GHC.Word.Word8
+ Database.HDBC.Record.Persistable: instance Database.Record.ToSql.ToSql Database.HDBC.SqlValue.SqlValue GHC.Word.Word16
+ Database.HDBC.Record.Persistable: instance Database.Record.ToSql.ToSql Database.HDBC.SqlValue.SqlValue GHC.Word.Word8
+ Database.HDBC.Record.Persistable: instance Database.Relational.Scalar.ScalarDegree GHC.Word.Word16
+ Database.HDBC.Record.Persistable: instance Database.Relational.Scalar.ScalarDegree GHC.Word.Word8
+ Database.HDBC.Record.Query: foldlFetch :: FromSql SqlValue a => (b -> a -> IO b) -> b -> ExecutedStatement a -> IO b
+ Database.HDBC.Record.Query: forFetch :: FromSql SqlValue a => ExecutedStatement a -> (a -> IO b) -> IO [b]
+ Database.HDBC.SqlValueExtra: instance Data.Convertible.Base.Convertible Database.HDBC.SqlValue.SqlValue GHC.Word.Word16
+ Database.HDBC.SqlValueExtra: instance Data.Convertible.Base.Convertible Database.HDBC.SqlValue.SqlValue GHC.Word.Word8
+ Database.HDBC.SqlValueExtra: instance Data.Convertible.Base.Convertible GHC.Word.Word16 Database.HDBC.SqlValue.SqlValue
+ Database.HDBC.SqlValueExtra: instance Data.Convertible.Base.Convertible GHC.Word.Word8 Database.HDBC.SqlValue.SqlValue

Files

ChangeLog.md view
@@ -1,5 +1,10 @@ <!-- -*- Markdown -*- --> +## 0.7.1.0++- add convertible instances of Word8 type and Word16 type.+- add foldlFetch and forFetch.+ ## 0.7.0.1  - update haddock about bracketed-prepare operations.
relational-query-HDBC.cabal view
@@ -1,5 +1,5 @@ name:                relational-query-HDBC-version:             0.7.0.1+version:             0.7.1.0 synopsis:            HDBC instance of relational-query and typed query interface for HDBC description:         This package contains the HDBC instance of relational-query and                      the typed query interface for HDBC.
src/Database/HDBC/Record/Query.hs view
@@ -23,6 +23,9 @@   runPreparedQuery',   runQuery', +  -- * Fetch loop+  foldlFetch, forFetch,+   -- * Fetch with Lazy-IO   -- $fetchWithLazyIO   fetchAll,@@ -31,7 +34,10 @@   runQuery,   ) where +import Control.Applicative ((<$>))+import Data.Monoid (mempty, (<>)) import Data.Maybe (listToMaybe)+import Data.DList (toList) import Database.HDBC (IConnection, Statement, SqlValue) import qualified Database.HDBC as HDBC @@ -125,6 +131,32 @@   z <- listToUnique recs   HDBC.finish $ executed es   return z++-- | Fetch fold-left loop convenient for+--   the sequence of cursor-solid lock actions.+--   Each action is executed after each fetch.+foldlFetch :: FromSql SqlValue a+           => (b -> a -> IO b)    -- ^ action executed after each fetch+           -> b                   -- ^ zero element of result+           -> ExecutedStatement a -- ^ statement to fetch from+           -> IO b+foldlFetch f z st =+    go z+  where+    go ac = do+      let step = (go =<<) . f ac+      maybe (return ac) step =<< fetch st++-- | Fetch loop convenient for+--   the sequence of cursor-solid lock actions.+--   Each action is executed after each fetch.+forFetch :: FromSql SqlValue a+         => ExecutedStatement a -- ^ statement to fetch from+         -> (a -> IO b)         -- ^ action executed after each fetch+         -> IO [b]+forFetch st action =+  toList <$>+  foldlFetch (\ac x -> ((ac <>) . pure) <$> action x) mempty st  -- | /Lazy-IO/ version of 'runStatement''. runStatement :: FromSql SqlValue a => BoundStatement a -> IO [a]
src/Database/HDBC/SqlValueExtra.hs view
@@ -14,6 +14,7 @@  import Data.Convertible (Convertible(safeConvert), ConvertResult) import Data.Int (Int8, Int16, Int32)+import Data.Word (Word8, Word16) import Database.HDBC (SqlValue)  -- Convert from narrower width than Int32@@ -35,4 +36,16 @@   safeConvert = safeConvertFromIntegral32  instance Convertible SqlValue Int16 where+  safeConvert = safeConvertToIntegral32++instance Convertible Word8 SqlValue where+  safeConvert = safeConvertFromIntegral32++instance Convertible SqlValue Word8 where+  safeConvert = safeConvertToIntegral32++instance Convertible Word16 SqlValue where+  safeConvert = safeConvertFromIntegral32++instance Convertible SqlValue Word16 where   safeConvert = safeConvertToIntegral32