Portability | portable |
---|---|
Stability | experimental |
Maintainer | keithshep@gmail.com |
Module for parsing SQL
- allMaybeTableNames :: Maybe TableExpression -> [String]
- parseSelectStatement :: GenParser Char st SelectStatement
- data SelectStatement = SelectStatement {}
- data TableExpression
- = TableIdentifier { }
- | InnerJoin { }
- | CrossJoin { }
- | SelectExpression { }
- data ColumnIdentifier = ColumnIdentifier {}
- prettyFormatColumn :: ColumnIdentifier -> String
- data ColumnSelection
- = AllColumns
- | AllColumnsFrom { }
- | ExpressionColumn { }
- expressionIdentifier :: Expression -> ColumnIdentifier
- data Expression
- = FunctionExpression { }
- | ColumnExpression { }
- | StringConstantExpression { }
- | IntegerConstantExpression {
- intConstant :: Int
- | RealConstantExpression { }
- data OrderByItem = OrderByItem {}
- prettyFormatWithArgs :: SQLFunction -> [Expression] -> String
- data SQLFunction = SQLFunction {}
- withTrailing :: Monad m => m a -> m b -> m b
- withoutTrailing :: Show s => GenParser tok st s -> GenParser tok st a -> GenParser tok st a
- isAggregate :: SQLFunction -> Bool
- selectStatementContainsAggregates :: SelectStatement -> Bool
- avgFunction :: SQLFunction
- countFunction :: SQLFunction
- firstFunction :: SQLFunction
- lastFunction :: SQLFunction
- maxFunction :: SQLFunction
- minFunction :: SQLFunction
- sumFunction :: SQLFunction
- concatenateFunction :: SQLFunction
- absFunction :: SQLFunction
- upperFunction :: SQLFunction
- lowerFunction :: SQLFunction
- trimFunction :: SQLFunction
- substringFromFunction :: SQLFunction
- substringFromToFunction :: SQLFunction
- multiplyFunction :: SQLFunction
- divideFunction :: SQLFunction
- plusFunction :: SQLFunction
- minusFunction :: SQLFunction
- negateFunction :: SQLFunction
- isFunction :: SQLFunction
- isNotFunction :: SQLFunction
- lessThanFunction :: SQLFunction
- lessThanOrEqualToFunction :: SQLFunction
- greaterThanFunction :: SQLFunction
- greaterThanOrEqualToFunction :: SQLFunction
- andFunction :: SQLFunction
- orFunction :: SQLFunction
- notFunction :: SQLFunction
- regexMatchFunction :: SQLFunction
- maybeReadInt :: String -> Maybe Int
- maybeReadReal :: String -> Maybe Double
Documentation
allMaybeTableNames :: Maybe TableExpression -> [String]Source
convenience function for extracting all of the table names used by the given table expression
parseSelectStatement :: GenParser Char st SelectStatementSource
Parses a SQL select statement
data SelectStatement Source
represents a select statement TODO this should be moved inside the TableExpression type
data ColumnIdentifier Source
prettyFormatColumn :: ColumnIdentifier -> StringSource
I wanted to leave the default Show, but I also wanted a pretty print, so here it is!
data Expression Source
data OrderByItem Source
prettyFormatWithArgs :: SQLFunction -> [Expression] -> StringSource
data SQLFunction Source
withTrailing :: Monad m => m a -> m b -> m bSource
isAggregate :: SQLFunction -> BoolSource
an aggregate function is one whose min function count is 1 and whose arg count is not fixed
substringFromFunction :: SQLFunctionSource
SUBSTRING(extraction_string FROM starting_position [FOR length] [COLLATE collation_name]) TODO implement COLLATE part
maybeReadInt :: String -> Maybe IntSource
returns an int if it can be read from the string
maybeReadReal :: String -> Maybe DoubleSource
returns a real if it can be read from the string