groundhog-mysql 0.4.0.1 → 0.4.0.2
raw patch · 2 files changed
+21/−14 lines, 2 filesdep ~groundhog
Dependency ranges changed: groundhog
Files
- Database/Groundhog/MySQL.hs +18/−11
- groundhog-mysql.cabal +3/−3
Database/Groundhog/MySQL.hs view
@@ -2,6 +2,7 @@ module Database.Groundhog.MySQL ( withMySQLPool , withMySQLConn+ , createMySQLPool , runDbConn , MySQL(..) , module Database.Groundhog@@ -60,13 +61,13 @@ type PhantomDb (DbPersist MySQL m) = MySQL insert v = insert' v insert_ v = insert_' v- insertBy u v = H.insertBy escapeS queryRawTyped' u v- insertByAll v = H.insertByAll escapeS queryRawTyped' v+ insertBy u v = H.insertBy escapeS queryRawTyped' "<=>?" u v+ insertByAll v = H.insertByAll escapeS queryRawTyped' "<=>?" v replace k v = H.replace escapeS queryRawTyped' executeRaw' insertIntoConstructorTable k v select options = H.select escapeS queryRawTyped' noLimit renderCond' options selectAll = H.selectAll escapeS queryRawTyped' get k = H.get escapeS queryRawTyped' k- getBy k = H.getBy escapeS queryRawTyped' k+ getBy k = H.getBy escapeS queryRawTyped' "<=>?" k update upds cond = H.update escapeS executeRaw' renderCond' upds cond delete cond = H.delete escapeS executeRaw' renderCond' cond deleteByKey k = H.deleteByKey escapeS executeRaw' k@@ -97,16 +98,22 @@ Just src -> return (fst $ fromPurePersistValues proxy src) withMySQLPool :: (MonadBaseControl IO m, MonadIO m)- => MySQL.ConnectInfo- -> Int -- ^ number of connections to open- -> (Pool MySQL -> m a)- -> m a-withMySQLPool s connCount f = liftIO (createPool (open' s) close' 1 20 connCount) >>= f+ => MySQL.ConnectInfo+ -> Int -- ^ number of connections to open+ -> (Pool MySQL -> m a)+ -> m a+withMySQLPool s connCount f = createMySQLPool s connCount >>= f +createMySQLPool :: MonadIO m+ => MySQL.ConnectInfo+ -> Int -- ^ number of connections to open+ -> m (Pool MySQL)+createMySQLPool s connCount = liftIO $ createPool (open' s) close' 1 20 connCount+ withMySQLConn :: (MonadBaseControl IO m, MonadIO m)- => MySQL.ConnectInfo- -> (MySQL -> m a)- -> m a+ => MySQL.ConnectInfo+ -> (MySQL -> m a)+ -> m a withMySQLConn s = bracket (liftIO $ open' s) (liftIO . close') instance Savepoint MySQL where
groundhog-mysql.cabal view
@@ -1,5 +1,5 @@ name: groundhog-mysql-version: 0.4.0.1+version: 0.4.0.2 license: BSD3 license-file: LICENSE author: Boris Lykah <lykahb@gmail.com>@@ -7,7 +7,7 @@ synopsis: MySQL backend for the groundhog library. description: This package uses mysql-simple and mysql category: Database-stability: Non-stable+stability: Stable cabal-version: >= 1.6 build-type: Simple @@ -17,7 +17,7 @@ , mysql >= 0.1.1.3 && < 0.2 , bytestring >= 0.9 , transformers >= 0.2.1- , groundhog >= 0.4.0 && < 0.5.0+ , groundhog >= 0.4.0.2 && < 0.5.0 , monad-control >= 0.3 , monad-logger >= 0.3 , containers >= 0.2