hssqlppp-0.4.0: SQL parser and type checker

Database.HsSqlPpp.Parser

Contents

Description

Functions to parse SQL.

Synopsis

Main

parseStatements

Arguments

:: String

filename to use in errors

-> String

a string containing the sql to parse

-> Either ParseErrorExtra [Statement] 

parseStatementsWithPosition

Arguments

:: FilePath

filename to use in errors

-> Int

adjust line number in errors by adding this

-> Int

adjust column in errors by adding this

-> String

a string containing the sql to parse

-> Either ParseErrorExtra [Statement] 

parseStatementsFromFile

Arguments

:: FilePath

file name of file containing sql

-> IO (Either ParseErrorExtra [Statement]) 

parseQueryExpr

Arguments

:: String

filename to use in errors

-> String

a string containing the sql to parse

-> Either ParseErrorExtra QueryExpr 

Testing

parseScalarExpr

Arguments

:: String

filename for error messages

-> String

sql string containing a single expression, with no trailing ';'

-> Either ParseErrorExtra ScalarExpr 

Parse expression fragment, used for testing purposes

parsePlpgsql :: String -> String -> Either ParseErrorExtra [Statement]

Parse plpgsql statements, used for testing purposes - this can be used to parse a list of plpgsql statements which aren't contained in a create function. (The produced ast won't pass a type check.)

errors

data ParseErrorExtra

Simple wrapper to allow showing the source context of a ParseError

Constructors

ParseErrorExtra 

Fields

parseErrorError :: ParseError

wrapped error

parseErrorPosition :: Maybe (Int, Int)

source position adjustment to get the context bit in error messages right - this is the same as what is passed into parseSqlWithPosition

parseErrorSqlSource :: String

sql source