hssqlppp-0.6.1: SQL parser and type checker

Safe HaskellNone
LanguageHaskell2010

Database.HsSqlPpp.Utility

Contents

Description

This module contains a collection of utility functions

Synopsis

ast utils

resetAnnotations :: Data a => a -> a Source #

replace all the annotations in a tree with emptyAnnotation

queryType :: Catalog -> Text -> Maybe Type Source #

Gets the type of the sql source passed in. Expects the string to contain a query expr

typechecked ast utils

addExplicitCasts :: Data a => a -> a Source #

run on a typechecked tree. Finds all the places where an implicit cast has been used in the typechecking and inserts an explicit cast

addImplicitCasts :: Data a => Catalog -> a -> a Source #

variation of the above, which uses ImplicitCast ctor

tcTreeInfo :: Data a => a -> (Maybe TypeExtra, [([TypeError], Maybe SourcePosition)], [QueryExpr], [ScalarExpr]) Source #

Gets some information useful for checking a typechecked tree returns the type of the top level node, a list of type errors from the tree, a list of the queryexpr nodes, and a list of the scalar exprs respectively, which have their type as nothing which indicates that the typechecking didn't complete successfully

emacsShowErrors :: [([TypeError], Maybe SourcePosition)] -> String Source #

show a type error list in emacs format