postgresql-simple-0.7.0.1: Mid-Level PostgreSQL client library

Copyright | (c) 2011-2012 Leon P Smith
License | BSD3
Maintainer | leon@melding-monads.com
Safe Haskell | None
Language | Haskell2010

Database.PostgreSQL.Simple.LargeObjects

Description

Support for PostgreSQL's Large Objects; see https://www.postgresql.org/docs/9.5/static/largeobjects.html for more information.

Note that Large Object File Descriptors are only valid within a single database transaction, so if you are interested in using anything beyond `loCreat`, `loCreate`, and `loUnlink`, you will need to run the entire sequence of functions in a transaction. As `loImport` and `loExport` are simply C functions that call `loCreat`, `loOpen`, `loRead`, and `loWrite`, and do not perform any transaction handling themselves, they also need to be wrapped in an explicit transaction.

Synopsis

- loCreat :: Connection -> IO Oid
- loCreate :: Connection -> Oid -> IO Oid
- loImport :: Connection -> FilePath -> IO Oid
- loImportWithOid :: Connection -> FilePath -> Oid -> IO Oid
- loExport :: Connection -> Oid -> FilePath -> IO ()
- loOpen :: Connection -> Oid -> IOMode -> IO LoFd
- loWrite :: Connection -> LoFd -> ByteString -> IO Int
- loRead :: Connection -> LoFd -> Int -> IO ByteString
- loSeek :: Connection -> LoFd -> SeekMode -> Int -> IO Int
- loTell :: Connection -> LoFd -> IO Int
- loTruncate :: Connection -> LoFd -> Int -> IO ()
- loClose :: Connection -> LoFd -> IO ()
- loUnlink :: Connection -> Oid -> IO ()
- newtype Oid = Oid CUInt
- data LoFd
- data IOMode
  - = ReadMode
  - | WriteMode
  - | AppendMode
  - | ReadWriteMode
- data SeekMode
  - = AbsoluteSeek
  - | RelativeSeek
  - | SeekFromEnd

# Documentation

loCreat :: Connection -> IO Oid Source #

loCreate :: Connection -> Oid -> IO Oid Source #

loImport :: Connection -> FilePath -> IO Oid Source #

loImportWithOid :: Connection -> FilePath -> Oid -> IO Oid Source #

loExport :: Connection -> Oid -> FilePath -> IO () Source #

loOpen :: Connection -> Oid -> IOMode -> IO LoFd Source #

loWrite :: Connection -> LoFd -> ByteString -> IO Int Source #

loRead :: Connection -> LoFd -> Int -> IO ByteString Source #

loSeek :: Connection -> LoFd -> SeekMode -> Int -> IO Int Source #

loTell :: Connection -> LoFd -> IO Int Source #

loTruncate :: Connection -> LoFd -> Int -> IO () Source #

loClose :: Connection -> LoFd -> IO () Source #

loUnlink :: Connection -> Oid -> IO () Source #

newtype Oid Source #

Constructors

Oid CUInt |

#### Instances

Instances details

Storable Oid |

Instance details

Defined in Database.PostgreSQL.LibPQ.Oid

Methods

sizeOf :: Oid -> Int Source #

alignment :: Oid -> Int Source #

peekElemOff :: Ptr Oid -> Int -> IO Oid Source #

pokeElemOff :: Ptr Oid -> Int -> Oid -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO Oid Source #

pokeByteOff :: Ptr b -> Int -> Oid -> IO () Source #

peek :: Ptr Oid -> IO Oid Source #

poke :: Ptr Oid -> Oid -> IO () Source #

Read Oid |
Instance details Defined in Database.PostgreSQL.LibPQ.Oid Methods readsPrec :: Int -> ReadS Oid Source # readList :: ReadS [Oid] Source # readPrec :: ReadPrec Oid Source # readListPrec :: ReadPrec [Oid] Source #
Show Oid |
Instance details Defined in Database.PostgreSQL.LibPQ.Oid Methods showsPrec :: Int -> Oid -> ShowS Source # show :: Oid -> String Source # showList :: [Oid] -> ShowS Source #
Eq Oid |
Instance details Defined in Database.PostgreSQL.LibPQ.Oid Methods (==) :: Oid -> Oid -> Bool Source # (/=) :: Oid -> Oid -> Bool Source #
Ord Oid |
Instance details Defined in Database.PostgreSQL.LibPQ.Oid Methods compare :: Oid -> Oid -> Ordering Source # (<) :: Oid -> Oid -> Bool Source # (<=) :: Oid -> Oid -> Bool Source # (>) :: Oid -> Oid -> Bool Source # (>=) :: Oid -> Oid -> Bool Source # max :: Oid -> Oid -> Oid Source # min :: Oid -> Oid -> Oid Source #
FromField Oid Source # | oid
Instance details Defined in Database.PostgreSQL.Simple.FromField Methods fromField :: FieldParser Oid Source #
ToField Oid Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToField Methods toField :: Oid -> Action Source #

data LoFd Source #

LoFd is a Large Object (pseudo) File Descriptor. It is understood by libpq but not by operating system calls.

#### Instances

Instances details

Show LoFd |
Instance details Defined in Database.PostgreSQL.LibPQ Methods showsPrec :: Int -> LoFd -> ShowS Source # show :: LoFd -> String Source # showList :: [LoFd] -> ShowS Source #
Eq LoFd |
Instance details Defined in Database.PostgreSQL.LibPQ Methods (==) :: LoFd -> LoFd -> Bool Source # (/=) :: LoFd -> LoFd -> Bool Source #
Ord LoFd |
Instance details Defined in Database.PostgreSQL.LibPQ Methods compare :: LoFd -> LoFd -> Ordering Source # (<) :: LoFd -> LoFd -> Bool Source # (<=) :: LoFd -> LoFd -> Bool Source # (>) :: LoFd -> LoFd -> Bool Source # (>=) :: LoFd -> LoFd -> Bool Source # max :: LoFd -> LoFd -> LoFd Source # min :: LoFd -> LoFd -> LoFd Source #

data IOMode Source #

See `openFile`

Constructors

ReadMode |
WriteMode |
AppendMode |
ReadWriteMode |

#### Instances

Instances details

Enum IOMode | Since: base-4.2.0.0

Instance details

Defined in GHC.Internal.IO.IOMode

Methods

succ :: IOMode -> IOMode Source #

pred :: IOMode -> IOMode Source #

toEnum :: Int -> IOMode Source #

fromEnum :: IOMode -> Int Source #

enumFrom :: IOMode -> [IOMode] Source #

enumFromThen :: IOMode -> IOMode -> [IOMode] Source #

enumFromTo :: IOMode -> IOMode -> [IOMode] Source #

enumFromThenTo :: IOMode -> IOMode -> IOMode -> [IOMode] Source #

Ix IOMode | Since: base-4.2.0.0
Instance details Defined in GHC.Internal.IO.IOMode Methods range :: (IOMode, IOMode) -> [IOMode] Source # index :: (IOMode, IOMode) -> IOMode -> Int Source # unsafeIndex :: (IOMode, IOMode) -> IOMode -> Int Source # inRange :: (IOMode, IOMode) -> IOMode -> Bool Source # rangeSize :: (IOMode, IOMode) -> Int Source # unsafeRangeSize :: (IOMode, IOMode) -> Int Source #
Read IOMode | Since: base-4.2.0.0
Instance details Defined in GHC.Internal.IO.IOMode Methods readsPrec :: Int -> ReadS IOMode Source # readList :: ReadS [IOMode] Source # readPrec :: ReadPrec IOMode Source # readListPrec :: ReadPrec [IOMode] Source #
Show IOMode | Since: base-4.2.0.0
Instance details Defined in GHC.Internal.IO.IOMode Methods showsPrec :: Int -> IOMode -> ShowS Source # show :: IOMode -> String Source # showList :: [IOMode] -> ShowS Source #
Eq IOMode | Since: base-4.2.0.0
Instance details Defined in GHC.Internal.IO.IOMode Methods (==) :: IOMode -> IOMode -> Bool Source # (/=) :: IOMode -> IOMode -> Bool Source #
Ord IOMode | Since: base-4.2.0.0
Instance details Defined in GHC.Internal.IO.IOMode Methods compare :: IOMode -> IOMode -> Ordering Source # (<) :: IOMode -> IOMode -> Bool Source # (<=) :: IOMode -> IOMode -> Bool Source # (>) :: IOMode -> IOMode -> Bool Source # (>=) :: IOMode -> IOMode -> Bool Source # max :: IOMode -> IOMode -> IOMode Source # min :: IOMode -> IOMode -> IOMode Source #
ToCInt IOMode |
Instance details Defined in Database.PostgreSQL.LibPQ.Enums Methods toCInt :: IOMode -> CInt

data SeekMode Source #

A mode that determines the effect of `hSeek` `hdl mode i`.

Constructors

AbsoluteSeek | the position of `hdl` is set to `i`.
RelativeSeek | the position of `hdl` is set to offset `i` from the current position.
SeekFromEnd | the position of `hdl` is set to offset `i` from the end of the file.

#### Instances

Instances details

Enum SeekMode | Since: base-4.2.0.0

Instance details

Defined in GHC.Internal.IO.Device

Methods

succ :: SeekMode -> SeekMode Source #

pred :: SeekMode -> SeekMode Source #

toEnum :: Int -> SeekMode Source #

fromEnum :: SeekMode -> Int Source #

enumFrom :: SeekMode -> [SeekMode] Source #

enumFromThen :: SeekMode -> SeekMode -> [SeekMode] Source #

enumFromTo :: SeekMode -> SeekMode -> [SeekMode] Source #

enumFromThenTo :: SeekMode -> SeekMode -> SeekMode -> [SeekMode] Source #

Ix SeekMode | Since: base-4.2.0.0
Instance details Defined in GHC.Internal.IO.Device Methods range :: (SeekMode, SeekMode) -> [SeekMode] Source # index :: (SeekMode, SeekMode) -> SeekMode -> Int Source # unsafeIndex :: (SeekMode, SeekMode) -> SeekMode -> Int Source # inRange :: (SeekMode, SeekMode) -> SeekMode -> Bool Source # rangeSize :: (SeekMode, SeekMode) -> Int Source # unsafeRangeSize :: (SeekMode, SeekMode) -> Int Source #
Read SeekMode | Since: base-4.2.0.0
Instance details Defined in GHC.Internal.IO.Device Methods readsPrec :: Int -> ReadS SeekMode Source # readList :: ReadS [SeekMode] Source # readPrec :: ReadPrec SeekMode Source # readListPrec :: ReadPrec [SeekMode] Source #
Show SeekMode | Since: base-4.2.0.0
Instance details Defined in GHC.Internal.IO.Device Methods showsPrec :: Int -> SeekMode -> ShowS Source # show :: SeekMode -> String Source # showList :: [SeekMode] -> ShowS Source #
Eq SeekMode | Since: base-4.2.0.0
Instance details Defined in GHC.Internal.IO.Device Methods (==) :: SeekMode -> SeekMode -> Bool Source # (/=) :: SeekMode -> SeekMode -> Bool Source #
Ord SeekMode | Since: base-4.2.0.0
Instance details Defined in GHC.Internal.IO.Device Methods compare :: SeekMode -> SeekMode -> Ordering Source # (<) :: SeekMode -> SeekMode -> Bool Source # (<=) :: SeekMode -> SeekMode -> Bool Source # (>) :: SeekMode -> SeekMode -> Bool Source # (>=) :: SeekMode -> SeekMode -> Bool Source # max :: SeekMode -> SeekMode -> SeekMode Source # min :: SeekMode -> SeekMode -> SeekMode Source #
ToCInt SeekMode |
Instance details Defined in Database.PostgreSQL.LibPQ.Enums Methods toCInt :: SeekMode -> CInt