git.iko.soy/typeable/postgresql-simple
on master help sign in
Rudimentary Large Object support
commit3ed6fffecd0239a2cd95cb51a412cbaed194959f authorLeon P Smith <leon@melding-monads.com> dateSun 25 Dec 2011, 02:40 (15 years ago) parentf966424
2 files changed+27
postgresql-simple.cabal+1 src/Database/PostgreSQL/Simple/LargeObjects.hs+26
postgresql-simple.cabal+1
@@ -24,6 +24,7 @@ Library
2424 Database.PostgreSQL.Simple
2525 Database.PostgreSQL.Simple.BuiltinTypes
2626 Database.PostgreSQL.Simple.Field
27+ Database.PostgreSQL.Simple.LargeObjects
2728 Database.PostgreSQL.Simple.Notification
2829 Database.PostgreSQL.Simple.Param
2930 Database.PostgreSQL.Simple.Result
src/Database/PostgreSQL/Simple/LargeObjects.hsnew file+26
@@ -0,0 +1,26 @@
1+-----------------------------------------------------------------------------
2+-- |
3+-- Module : Database.PostgreSQL.Simple.LargeObjects
4+-- Copyright : (c) 2011 Leon P Smith
5+-- License : BSD3
6+--
7+-- Maintainer : leon@melding-monads.com
8+--
9+-----------------------------------------------------------------------------
10+
11+module Database.PostgreSQL.Simple.LargeObjects
12+ ( loImport
13+ , loExport
14+ , Oid(..)
15+ ) where
16+
17+import Database.PostgreSQL.LibPQ (Oid(..))
18+import qualified Database.PostgreSQL.LibPQ as PQ
19+import Database.PostgreSQL.Simple.Implementation
20+import Foreign.C.Types(CInt)
21+
22+loImport :: Connection -> FilePath -> IO (Maybe Oid)
23+loImport conn path = withConnection conn $ \c -> PQ.loImport c path
24+
25+loExport :: Connection -> Oid -> FilePath -> IO CInt
26+loExport conn oid path = withConnection conn $ \c -> PQ.loExport c oid path