1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
-----------------------------------------------------------
-- |
-- Module : Database.HaskellDB.HDBC.PostgreSQL
-- Copyright : HWT Group (c) 2003, Bjorn Bringert (c) 2005
-- License : BSD-style
--
-- Maintainer : haskelldb-users@lists.sourceforge.net
-- Stability : experimental
-- Portability : portable
--
-----------------------------------------------------------
module Database.HaskellDB.HDBC.PostgreSQL (
postgresqlConnect,
DriverInterface(..),
driver
) where
import Database.HaskellDB.Database
import Database.HaskellDB.HDBC
import Database.HaskellDB.DriverAPI
import Database.HaskellDB.Sql.PostgreSQL
import Database.HDBC.PostgreSQL (connectPostgreSQL)
postgresqlConnect :: MonadIO m => [(String,String)] -> (Database -> m a) -> m a
postgresqlConnect opts = hdbcConnect generator (connectPostgreSQL conninfo)
where conninfo = unwords [ k ++ "=" ++ v | (k,v) <- opts]
-- | This driver passes its options through to HDBC.
-- HDBC refers to
-- <http://www.postgresql.org/docs/8.1/static/libpq.html#LIBPQ-CONNECT>
-- for the meaning of the options.
driver :: DriverInterface
driver = defaultdriver {connect = postgresqlConnect}
|