hssqlppp-0.4.2: SQL parser and type checker

Safe HaskellNone

Database.HsSqlPpp.Parser

Contents

Description

Functions to parse SQL.

Synopsis

Main

parseStatementsSource

Arguments

:: String

filename to use in errors

-> String

a string containing the sql to parse

-> Either ParseErrorExtra [Statement] 

parseStatementsWithPositionSource

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] 

parseStatementsFromFileSource

Arguments

:: FilePath

file name of file containing sql

-> IO (Either ParseErrorExtra [Statement]) 

parseQueryExprSource

Arguments

:: String

filename to use in errors

-> String

a string containing the sql to parse

-> Either ParseErrorExtra QueryExpr 

Testing

parseScalarExprSource

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]Source

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 Source

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