The SqlParser class is a thread-safe class which parses a string containing a SQL statement with JdbcControl substitituion delimiters. It is important to note that the SQL is not parsed/validated - only the sections within the SQL string which are delimited by '{' and '}' are parsed.
Parsing is accomplished using the JavaCC grammar file
SqlGrammer.jj. As the string is parsed it is broken into fragments by the parser. Any portion of the string which is not between '{' and '}' delimiters becomes a
LiteralFragment. The portions of the SQL string which fall between the start and end delimiters are categorized as either
JdbcFragment,
ReflectionFragment, or
SqlSubstitutionFragment.
Fragments which subclass
SqlFragmentContainer may contain other fragments as children. Fragements subclassed from
SqlFragment my not contain child fragments. Upon completion of parsing a
SqlStatement is returned to the caller. The
SqlStatement contains the heirarchary of fragments which have been derived from the orignal SQL string.
The parser will also cache all
SqlStatements which contain non-volitale SQL. Only
SqlEscapeFragments contain volitile SQL at this point.