persistent-sqlite 2.6.3.2 → 2.6.4
raw patch · 4 files changed
+27/−7 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Database.Sqlite: stepConn :: Connection -> Statement -> IO StepResult
- Database.Sqlite: step :: Connection -> Statement -> IO StepResult
+ Database.Sqlite: step :: Statement -> IO StepResult
Files
- ChangeLog.md +6/−0
- Database/Persist/Sqlite.hs +4/−4
- Database/Sqlite.hs +16/−2
- persistent-sqlite.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,11 @@+## 2.6.4++* Adds a new function `stepConn`, which uses an additional parameter to give more detailed error messages [#750](https://github.com/yesodweb/persistent/pull/750)+* Restores the previous function signature of `step`, which was accidentally changed in 2.6.3.2+ ## 2.6.3.2 +* This release accidentally broke API, and is deprecated on Hackage. * Provide more detailed error messages when using the `step` function [#730](https://github.com/yesodweb/persistent/pull/730) ## 2.6.3.1
Database/Persist/Sqlite.hs view
@@ -136,7 +136,7 @@ -- Turn on the write-ahead log -- https://github.com/yesodweb/persistent/issues/363 turnOnWal <- Sqlite.prepare conn "PRAGMA journal_mode=WAL;"- _ <- Sqlite.step conn turnOnWal+ _ <- Sqlite.stepConn conn turnOnWal Sqlite.reset conn turnOnWal Sqlite.finalize turnOnWal @@ -144,7 +144,7 @@ -- Turn on foreign key constraints -- https://github.com/yesodweb/persistent/issues/646 turnOnFK <- Sqlite.prepare conn "PRAGMA foreign_keys = on;"- _ <- Sqlite.step conn turnOnFK+ _ <- Sqlite.stepConn conn turnOnFK Sqlite.reset conn turnOnFK Sqlite.finalize turnOnFK @@ -253,7 +253,7 @@ execute' :: Sqlite.Connection -> Sqlite.Statement -> [PersistValue] -> IO Int64 execute' conn stmt vals = flip finally (liftIO $ Sqlite.reset conn stmt) $ do Sqlite.bind stmt vals- _ <- Sqlite.step conn stmt+ _ <- Sqlite.stepConn conn stmt Sqlite.changes conn withStmt'@@ -269,7 +269,7 @@ return pull where pull = do- x <- liftIO $ Sqlite.step conn stmt+ x <- liftIO $ Sqlite.stepConn conn stmt case x of Sqlite.Done -> return () Sqlite.Row -> do
Database/Sqlite.hs view
@@ -18,6 +18,7 @@ close, prepare, step,+ stepConn, reset, finalize, bindBlob,@@ -254,8 +255,21 @@ stepError (Statement statement) = do error <- stepC statement return $ decodeError error-step :: Connection -> Statement -> IO StepResult-step database statement = do++-- | Execute a database statement. It's recommended to use 'stepConn' instead, because it gives better error messages.+step :: Statement -> IO StepResult+step statement = do+ error <- stepError statement+ case error of+ ErrorRow -> return Row+ ErrorDone -> return Done+ _ -> sqlError Nothing "step" error++-- | Execute a database statement. This function uses the 'Connection' passed to it to give better error messages than 'step'.+--+-- @since 2.6.4+stepConn :: Connection -> Statement -> IO StepResult+stepConn database statement = do error <- stepError statement case error of ErrorRow -> return Row
persistent-sqlite.cabal view
@@ -1,5 +1,5 @@ name: persistent-sqlite-version: 2.6.3.2+version: 2.6.4 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>