hpqtypes-1.6.1.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 # 
Instance details

Defined in Database.PostgreSQL.PQTypes.SQL

Methods

showsPrec :: Int -> SQL -> ShowS #

show :: SQL -> String #

showList :: [SQL] -> ShowS #

IsString SQL Source #

Construct SQL from String.

Instance details

Defined in Database.PostgreSQL.PQTypes.SQL

Methods

fromString :: String -> SQL #

Semigroup SQL Source # 
Instance details

Defined in Database.PostgreSQL.PQTypes.SQL

Methods

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

sconcat :: NonEmpty SQL -> SQL #

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

Monoid SQL Source # 
Instance details

Defined in Database.PostgreSQL.PQTypes.SQL

Methods

mempty :: SQL #

mappend :: SQL -> SQL -> SQL #

mconcat :: [SQL] -> SQL #

IsSQL SQL Source # 
Instance details

Defined in Database.PostgreSQL.PQTypes.SQL

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.