forked from tnarg/haskell-libpq
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stub out approach to implementing async libpq
- Loading branch information
Showing
3 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
------------------------------------------------------------------------------ | ||
-- | | ||
-- Module: Database.PostgreSQL.LibPQ.GHC | ||
-- Copyright: (c) 2013 Leon P Smith | ||
-- License: BSD3 | ||
-- Maintainer: Leon P Smith <leon@melding-monads.com> | ||
-- Stability: experimental | ||
-- | ||
-- On Unix, this re-implements some of blocking libpq functions in terms of | ||
-- on-blocking libpq operations and GHC's IO manager. This allows | ||
-- these operations to be interrupted by asynchronous exceptions, and means | ||
-- that GHC's runtime is responsible for handling the concurrency instead | ||
-- of the OS kernel. | ||
-- | ||
-- This module also re-exports the rest of libpq for convenience's sake. | ||
-- Thus taking advantage of these features should be as simple as importing | ||
-- @LibPQ.GHC@ instead of @LibPQ@. | ||
-- | ||
-- On Windows, this just re-exports the vanilla libpq bindings, due to | ||
-- the lack of a satisfactory IO manager on that platform. | ||
-- | ||
------------------------------------------------------------------------------ | ||
|
||
module Database.PostgreSQL.LibPQ.GHC | ||
( module Database.PostgreSQL.LibPQ | ||
, exec | ||
, connectdb | ||
) where | ||
|
||
import Database.PostgreSQL.LibPQ hiding (exec, connectdb) | ||
import qualified Data.ByteString as B | ||
import qualified Database.PostgreSQL.LibPQ as LibPQ | ||
|
||
exec :: Connection -> B.ByteString -> IO (Maybe Result) | ||
exec = LibPQ.exec | ||
|
||
connectdb :: B.ByteString -> IO Connection | ||
connectdb = LibPQ.connectdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
------------------------------------------------------------------------------ | ||
-- | | ||
-- Module: Database.PostgreSQL.LibPQ.GHC | ||
-- Copyright: (c) 2013 Leon P Smith | ||
-- License: BSD3 | ||
-- Maintainer: Leon P Smith <leon@melding-monads.com> | ||
-- Stability: experimental | ||
-- | ||
-- On Unix, this re-implements some of blocking libpq functions in terms of | ||
-- on-blocking libpq operations and GHC's IO manager. This allows | ||
-- these operations to be interrupted by asynchronous exceptions, and means | ||
-- that GHC's runtime is responsible for handling the concurrency instead | ||
-- of the OS kernel. | ||
-- | ||
-- This module also re-exports the rest of libpq for convenience's sake. | ||
-- Thus taking advantage of these features should be as simple as importing | ||
-- @LibPQ.GHC@ instead of @LibPQ@. | ||
-- | ||
-- On Windows, this just re-exports the vanilla libpq bindings, due to | ||
-- the lack of a satisfactory IO manager on that platform. | ||
-- | ||
------------------------------------------------------------------------------ | ||
|
||
module Database.PostgreSQL.LibPQ.GHC | ||
( module Database.PostgreSQL.LibPQ | ||
) where | ||
|
||
import Database.PostgreSQL.LibPQ |