hpqtypes-1.3.1: Haskell bindings to libpqtypes

Safe HaskellNone
LanguageHaskell98

Database.PostgreSQL.PQTypes.ToSQL

Synopsis

Documentation

type ParamAllocator = forall r. (Ptr PGparam -> IO r) -> IO r Source

alloca-like producer of PGparam objects.

class PQFormat t => ToSQL t where Source

Class which represents "from Haskell type to SQL (libpqtypes) type" transformation.

Associated Types

type PQDest t :: * Source

Destination type (used by libpqtypes).

Methods

toSQL Source

Arguments

:: t

Value to be put.

-> ParamAllocator

PGparam allocator.

-> (Ptr (PQDest t) -> IO r)

Continuation that puts converted value into inner PGparam.

-> IO r 

Put supplied value into inner PGparam.

Instances

ToSQL Bool 
ToSQL Char 
ToSQL Double 
ToSQL Float 
ToSQL Int16 
ToSQL Int32 
ToSQL Int64 
ToSQL Word8 
ToSQL String

Encodes underlying C string as UTF-8, so if you are working with a different encoding, you should not rely on this instance.

ToSQL ByteString 
ToSQL Text

Encodes underlying C string as UTF-8, so if you are working with a different encoding, you should not rely on this instance.

ToSQL LocalTime 
ToSQL ZonedTime 
ToSQL TimeOfDay 
ToSQL UTCTime 
ToSQL Day 
ToSQL Interval 
ToSQL XML 
ToSQL t => ToSQL (Maybe t) 
CompositeToSQL t => ToSQL (Composite t) 
ToSQL (Binary ByteString) 
CompositeToSQL t => ToSQL (CompositeArray2 t) 
ToSQL t => ToSQL (Array2 t) 
CompositeToSQL t => ToSQL (CompositeArray1 t) 
ToSQL t => ToSQL (Array1 t) 

put :: Storable t => t -> (Ptr t -> IO r) -> IO r Source

Function that abstracts away common elements of most ToSQL instance definitions to make them easier to write and less verbose.