hpqtypes-1.5.1.1: Haskell bindings to libpqtypes

Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.PQTypes.Internal.Utils

Synopsis

Documentation

type family MkConstraint (m :: * -> *) (cs :: [(* -> *) -> Constraint]) :: Constraint where ... #

Equations

MkConstraint m '[] = () 
MkConstraint m (c ': cs) = (c m, MkConstraint m cs) 

mread :: Read a => String -> Maybe a #

safePeekCString :: CString -> IO (Maybe String) #

Safely peek C string.

safePeekCString' :: CString -> IO String #

Safely peek C string and return "" if NULL.

cStringLenToBytea :: CStringLen -> PGbytea #

Convert C string to PGbytea.

byteaToCStringLen :: PGbytea -> CStringLen #

Convert PGbytea to C string.

textToCString :: Text -> IO (ForeignPtr CChar) #

Convert Text to UTF-8 encoded C string wrapped by foreign pointer.

verifyPQTRes :: Ptr PGerror -> String -> CInt -> IO () #

Check return value of a function from libpqtypes and if it indicates an error, throw appropriate exception.

withPGparam :: Ptr PGconn -> (Ptr PGparam -> IO r) -> IO r #

throwLibPQError :: Ptr PGconn -> String -> IO a #

Throw libpq specific error.

throwLibPQTypesError :: Ptr PGerror -> String -> IO a #

Throw libpqtypes specific error.

rethrowWithArrayError :: CInt -> SomeException -> IO a #

Rethrow supplied exception enriched with array index.

hpqTypesError :: String -> IO a #

Throw 'HPQTypesError exception.

unexpectedNULL :: IO a #

Throw 'unexpected NULL' exception.