-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Interpolated SQLite queries via quasiquotation
--
-- Please see the readme at
-- https://github.com/ruby0b/sqlite-simple-interpolate#readme.
@package sqlite-simple-interpolate
@version 0.2.0.0
-- | Interpolated SQLite queries
module Database.SQLite.Simple.Interpolate
-- | Quote an SQL statement with embedded antiquoted expressions.
--
-- The result of the quasiquoter is a tuple, containing the statement
-- string and a list of parameters. For example:
--
--
-- >>> import Data.Char (toLower)
--
-- >>> [isql|SELECT field FROM !{map toLower "PEOPLE"} WHERE name = {map toLower "ELLIOT"} AND access IN @{["admin", "employee"]} LIMIT {10 :: Int}|]
-- ("SELECT field FROM people WHERE name = ? AND access IN (?,?) LIMIT ?",[SQLText "elliot",SQLText "admin",SQLText "employee",SQLInteger 10])
--
--
-- The generated code is:
--
--
-- ("SELECT field FROM people WHERE name = ? AND access IN (?,?) LIMIT ?", [toField (map toLower ELLIOT)] ++ toRow ["admin", "employee"] ++ [toField (10 :: Int)])
--
--
-- How the parser works:
--
--
-- - Any expression occurring between { and } will be
-- replaced with a ? and passed as a query parameter using
-- toField.
-- - Any expression occuring between @{ and } will be
-- replaced with the right amount of ?, separated by commas and
-- surrounded by parentheses (e.g. (?,?,?) for a ToRow
-- instance with 3 fields). The expression gets converted to query
-- parameters using toRow.
-- - Any expression occurring between !{ and } will
-- be replaced with its value, bypassing the anti-injection mechanisms.
-- Never use this one for user input!
--
--
-- Characters preceded by a backslash are treated literally. This enables
-- the inclusion of the literal character { within your quoted
-- text by writing it as \{. The literal sequence \{
-- may be written as \\{.
isql :: QuasiQuoter
-- | Invokes query with arguments provided by isql. The
-- result is of type (Connection -> IO [r]).
iquery :: QuasiQuoter
-- | Invokes execute with arguments provided by isql. The
-- result is of type (Connection -> IO ()).
iexecute :: QuasiQuoter
-- | Invokes fold with arguments provided by isql. The result
-- is of type (a -> (a -> row -> IO a) ->
-- Connection -> IO a).
ifold :: QuasiQuoter
-- | The Template Haskell function used by isql.
quoteInterpolatedSql :: String -> Q Exp