hpqtypes-1.4.4: Haskell bindings to libpqtypes

Safe HaskellNone
LanguageHaskell98

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 
IsString SQL Source

Construct SQL from String. The underlying ByteString will be encoded as UTF-8, so if you are working with a different encoding, you should not rely on this instance.

Monoid SQL Source 
IsSQL SQL Source 

mkSQL :: ByteString -> 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.