packages feed

groundhog-postgresql 0.4.0.1 → 0.4.0.2

raw patch · 2 files changed

+22/−17 lines, 2 filesdep ~groundhog

Dependency ranges changed: groundhog

Files

Database/Groundhog/Postgresql.hs view
@@ -2,6 +2,7 @@ module Database.Groundhog.Postgresql     ( withPostgresqlPool     , withPostgresqlConn+    , createPostgresqlPool     , runDbConn     , Postgresql(..)     , module Database.Groundhog@@ -59,13 +60,13 @@   type PhantomDb (DbPersist Postgresql m) = Postgresql   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' " IS NOT DISTINCT FROM ?" u v+  insertByAll v = H.insertByAll escapeS queryRawTyped' " IS NOT DISTINCT FROM ?" v   replace k v = H.replace escapeS queryRawTyped' executeRaw' (insertIntoConstructorTable False) k v   select options = H.select escapeS queryRawTyped' "" 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' " IS NOT DISTINCT FROM ?" 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@@ -95,21 +96,25 @@       Nothing  -> return Nothing       Just src -> return (fst $ fromPurePersistValues proxy src) ---{-# SPECIALIZE withPostgresqlPool :: String -> Int -> (Pool Postgresql -> IO a) -> IO a #-} withPostgresqlPool :: (MonadBaseControl IO m, MonadIO m)-               => String -- ^ connection string-               -> Int -- ^ number of connections to open-               -> (Pool Postgresql -> m a)-               -> m a-withPostgresqlPool s connCount f = liftIO (createPool (open' s) close' 1 20 connCount) >>= f+                   => String -- ^ connection string+                   -> Int -- ^ number of connections to open+                   -> (Pool Postgresql -> m a)+                   -> m a+withPostgresqlPool s connCount f = createPostgresqlPool s connCount >>= f -{-# SPECIALIZE withPostgresqlConn :: String -> (Postgresql -> IO a) -> IO a #-} withPostgresqlConn :: (MonadBaseControl IO m, MonadIO m)-               => String -- ^ connection string-               -> (Postgresql -> m a)-               -> m a+                   => String -- ^ connection string+                   -> (Postgresql -> m a)+                   -> m a withPostgresqlConn s = bracket (liftIO $ open' s) (liftIO . close') +createPostgresqlPool :: MonadIO m+                     => String -- ^ connection string+                     -> Int -- ^ number of connections to open+                     -> m (Pool Postgresql)+createPostgresqlPool s connCount = liftIO $ createPool (open' s) close' 1 20 connCount+ instance Savepoint Postgresql where   withConnSavepoint name m (Postgresql c) = do     let name' = fromString name@@ -269,7 +274,7 @@   migTriggerOnUpdate   GM.defaultMigConstr   escape-  "SERIAL PRIMARY KEY UNIQUE"+  "BIGSERIAL PRIMARY KEY UNIQUE"   mainTableId   defaultPriority   (\uniques refs -> ([], map AddUnique uniques ++ map AddReference refs))
groundhog-postgresql.cabal view
@@ -1,5 +1,5 @@ name:            groundhog-postgresql-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:        PostgreSQL backend for the groundhog library. description:     This package uses postgresql-simple and postgresql-libpq. category:        Database-stability:       Non-stable+stability:       Stable cabal-version:   >= 1.6 build-type:      Simple @@ -18,7 +18,7 @@                    , bytestring              >= 0.9                    , blaze-builder           >= 0.3.0.0                    , 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