selda-postgresql 0.1.2.0 → 0.1.2.1
raw patch · 2 files changed
+8/−4 lines, 2 files
Files
selda-postgresql.cabal view
@@ -1,5 +1,5 @@ name: selda-postgresql-version: 0.1.2.0+version: 0.1.2.1 synopsis: PostgreSQL backend for the Selda database EDSL. description: PostgreSQL backend for the Selda database EDSL. Requires the PostgreSQL @libpq@ development libraries to be
src/Database/Selda/PostgreSQL.hs view
@@ -72,8 +72,12 @@ conn <- liftIO $ connectdb (pgConnString ci) st <- liftIO $ status conn case st of- ConnectionOk -> runSeldaT m (pgBackend conn) `finally` liftIO (finish conn)- nope -> connFailed nope+ ConnectionOk -> do+ let backend = pgBackend conn+ liftIO $ runStmt backend "SET client_min_messages TO WARNING;" []+ runSeldaT m backend `finally` liftIO (finish conn)+ nope -> do+ connFailed nope where connFailed f = throwM $ DbError $ unwords [ "unable to connect to postgres server: " ++ show f@@ -120,7 +124,7 @@ FatalError -> throwM $ SqlError errmsg NonfatalError -> throwM $ SqlError errmsg _ | return_lastid -> Left <$> getLastId res- | otherwise ->Right <$> getRows res+ | otherwise -> Right <$> getRows res Nothing -> throwM $ DbError "unable to submit query to server" where errmsg = "error executing query `" ++ T.unpack q' ++ "'"