persistent 2.1.1.7 → 2.1.2
raw patch · 6 files changed
+25/−4 lines, 6 files
Files
- ChangeLog.md +5/−0
- Database/Persist/Class.hs +1/−0
- Database/Persist/Class/PersistField.hs +1/−0
- Database/Persist/Class/PersistStore.hs +12/−0
- Database/Persist/Sql/Run.hs +5/−3
- persistent.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,8 @@+## 2.1.2++* Error with `Double`s without a decimal part [#378](https://github.com/yesodweb/persistent/issues/378)+* `runSqlPool` does not perform timeout checks.+ ## 2.1.1.6 * One extra feature for #939: use `logDebugN` instead
Database/Persist/Class.hs view
@@ -6,6 +6,7 @@ , getJust , belongsTo , belongsToJust+ , insertEntity -- * PersistUnique , PersistUnique (..)
Database/Persist/Class/PersistField.hs view
@@ -156,6 +156,7 @@ toPersistValue = PersistDouble fromPersistValue (PersistDouble d) = Right d fromPersistValue (PersistRational r) = Right $ fromRational r+ fromPersistValue (PersistInt64 i) = Right $ fromIntegral i fromPersistValue x = Left $ T.pack $ "Expected Double, received: " ++ show x instance (HasResolution a) => PersistField (Fixed a) where
Database/Persist/Class/PersistStore.hs view
@@ -10,6 +10,7 @@ , getJust , belongsTo , belongsToJust+ , insertEntity , ToBackendKey(..) ) where @@ -182,3 +183,14 @@ ) => (ent1 -> Key ent2) -> ent1 -> ReaderT backend m ent2 belongsToJust getForeignKey model = getJust $ getForeignKey model++-- | like @insert@, but returns the complete @Entity@+insertEntity ::+ ( PersistStore backend+ , PersistEntity e+ , backend ~ PersistEntityBackend e+ , MonadIO m+ ) => e -> ReaderT backend m (Entity e)+insertEntity e = do+ eid <- insert e+ return $ Entity eid e
Database/Persist/Sql/Run.hs view
@@ -25,10 +25,12 @@ -- | Get a connection from the pool, run the given action, and then return the -- connection to the pool.+--+-- Note: This function previously timed out after 2 seconds, but this behavior+-- was buggy and caused more problems than it solved. Since version 2.1.2, it+-- performs no timeout checks. runSqlPool :: MonadBaseControl IO m => SqlPersistT m a -> Pool SqlBackend -> m a-runSqlPool r pconn = do- mres <- withResourceTimeout 2000000 pconn $ runSqlConn r- maybe (throwIO Couldn'tGetSQLConnection) return mres+runSqlPool r pconn = withResource pconn $ runSqlConn r -- | Like 'withResource', but times out the operation if resource -- allocation does not complete within the given timeout period.
persistent.cabal view
@@ -1,5 +1,5 @@ name: persistent-version: 2.1.1.7+version: 2.1.2 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>