module Sqml: sig
.. end
Parsing SQL select
and union
queries.
Abstract syntax
Abstract Syntax for Queries
type
query = query_exp * ordering list
type
query_exp = query_exp
type
select = [ `all | `distinct | `nomod ] * selection * from *
where option * group_by option * having option
type
selection = selection
type
from = [ `table of string | `tableas of string * string ] list
type
where = condition
type
group_by = column list
type
column = column
type
having = condition
type
condition = condition
type
predicate = predicate
type
comparison = comparison
type
exp = exp
type
atom = atom
type
functioncall = function_label *
[ `distinct of column | `exp of [ `all | `nomod ] * exp | `star ]
type
function_label = function_label
type
parameter = parameter
Abstract Syntax for Insert
type
insert = string * string list *
[ `select of select | `values of [ `atom of atom | `null ] list ]
Abstract Syntax for Schemas
type
cmd = cmd
type
schemadef = string * schema_element list
type
schema_element = schema_element
Abstract Syntax for create table
type
tabledef = string * table_element list
type
table_element = table_element
type
columndef = string * data_type * column_opt list
type
data_type = data_type
type
literal = literal
type
column_opt = column_opt
type
tblcnstr = tblcnstr
Abstract Syntax for create view
type
viewdef = string * string list * select * [ `check | `nocheck ]
Abstract Syntax for grant
type
privdef = privilege * string * grantee list *
[ `grantoption | `nograntoption ]
type
privilege = privilege
type
operation = operation
type
grantee = grantee
Abstract Syntax for modules
type
moddef = string option * lang * string * cursor_def list *
procedure_def list
type
lang = lang
type
cursor_def = string * query_exp * ordering list
type
ordering = [ `column of column | `numcolumn of int ] * [ `asc | `desc ] option
type
procedure_def = string * parameter_def list * manipulative_statement list
type
parameter_def = parameter_def
type
manipulative_statement = manipulative_statement
type
assignment = assignment
type
when_action = when_action
Parsing
exception Syntax_error = Sqml_sqlstx.Syntax_error
val parse_full_select : Lexing.lexbuf -> Sqml_sqlstx.select * Sqml_sqlstx.ordering list
val parse_query : Lexing.lexbuf -> Sqml_sqlstx.query
val parse_command : Lexing.lexbuf -> Sqml_sqlstx.cmd
val parse_command_list : Lexing.lexbuf -> Sqml_sqlstx.cmd list
val query_of_string : string -> Sqml_sqlstx.query