packages feed

hesql-0.6: HESQL/Syntax.hs

module HESQL.Syntax where

import Database.HDBC (SqlValue(..))
import Data.List (intercalate)

import Database.HsSqlPpp.Ast.Ast

type ModuleName = String
type DeclName = String
type Vars = [String]
type TableName = String
type ColName = String
type ColAlias = String
type FunName = String

data HesqlModule = HesqlModule ModuleName [HesqlDecls] deriving (Show)
data HesqlDecls = HesqlDecls { 
      declName :: DeclName
    , declVars :: Vars 
    , declOpt :: QueryOpt
    , declSQL  :: Statement
  } deriving Show

data QueryOpt = LazyQuery | StrictQuery | MaybeQuery
  deriving Show

isSelect (SelectStatement _ _) = True
isSelect _ = False

selectColumnLength (SelectStatement _ (Select _ _ (SelectList _ l _) _ _ _ _ _ _ _)) = length l