hssqlppp-th-0.6.0: hssqlppp extras which need template-haskell

Safe HaskellNone
LanguageHaskell2010

Database.HsSqlPpp.Quote

Description

A quasiquoter for SQL. Antiquoting is a bit inconsistent.

Example:


import Database.HsSqlPpp.Ast
import Database.HsSqlPpp.Quote
import Database.HsSqlPpp.Annotation

test :: Statement
test = [$sqlStmt|

  create table $n(tablename) (
   $m(varname) $n(typename)
  );

        |]
  where
    tablename = [sqlName| my_table |]
    varname = [sqlNameComponent| my_field |]
    typename = [sqlName| text |]

See http://jakewheat.github.com/hssqlppp/QuasiQuoteTests.html for more simple examples

The splices are:

  • $e(scalarexpression)
  • $s(string)
  • $t(triggerevent)
  • $s(statement)
  • $n(name)
  • $m(namecomponent)

You can use $m() in a name context, and $n() or $m() in a scalar expression context. You can only use a single variable name in a splice atm.

Synopsis

Documentation

sqlStmts :: QuasiQuoter Source

quotes Statements

sqlStmt :: QuasiQuoter Source

quotes a single Statement

pgsqlStmts :: QuasiQuoter Source

quotes plpgsql Statements

pgsqlStmt :: QuasiQuoter Source

quotes a plpgsql Statement

sqlExpr :: QuasiQuoter Source

quotes a ScalarExpr

sqlName :: QuasiQuoter Source

quotes a Name