hpqtypes-1.5.3.0: Haskell bindings to libpqtypes

Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.PQTypes.SQL

Synopsis

Documentation

data SQL Source #

Primary SQL type that supports efficient concatenation and variable number of parameters.

Instances

Show SQL Source # 

Methods

showsPrec :: Int -> SQL -> ShowS #

show :: SQL -> String #

showList :: [SQL] -> ShowS #

IsString SQL Source #

Construct SQL from String.

Methods

fromString :: String -> SQL #

Semigroup SQL Source # 

Methods

(<>) :: SQL -> SQL -> SQL #

sconcat :: NonEmpty SQL -> SQL #

stimes :: Integral b => b -> SQL -> SQL #

Monoid SQL Source # 

Methods

mempty :: SQL #

mappend :: SQL -> SQL -> SQL #

mconcat :: [SQL] -> SQL #

IsSQL SQL Source # 

Methods

withSQL :: SQL -> ParamAllocator -> (Ptr PGparam -> CString -> IO r) -> IO r Source #

mkSQL :: Text -> SQL Source #

Convert ByteString to SQL.

sqlParam :: (Show t, ToSQL t) => t -> SQL Source #

Embed parameter value inside SQL.

(<?>) :: (Show t, ToSQL t) => SQL -> t -> SQL infixr 7 Source #

Embed parameter value inside existing SQL. Example:

f :: Int32 -> String -> SQL
f idx name = "SELECT foo FROM bar WHERE id =" <?> idx <+> "AND name =" <?> name

isSqlEmpty :: SQL -> Bool Source #

Test whether an SQL is empty.