SQL-Grammatik
Im Folgenden ist die Grammatik beschrieben, die vom Framework Studio SQL-Parser verstanden wird. Alle an die Datenbank geschickten Befehle müssen dieser Grammatik genügen, ansonsten kommt es zu SqlParser-Exceptions.
Grammatik für SQL-Kommandos
<select>
SELECT [DISTINCT] { * | <resultColumn>[,…n] }
FROM { <singleSource> | <joinSource> }
[ WHERE <condition> ]
[ GROUP BY <value>[,…n] [HAVING <condition>]]
[ {UNION [ALL] | INTERSECT | EXCEPT} <select(ohne orderby)> ]
[ ORDER BY <orderColumn>[,…n] ]
[ OFFSET <integerValue> ]
[ LIMIT <integerValue> ]
<insert>
INSERT INTO <identifierChain> ( <identifier>[,…n] )
{
VALUES ( <value>[,…n] )
| <select>
}
<update>
UPDATE <identifierChain>
SET {<identifierChain> = <value> } [,…n]
[ WHERE <condition> ]
<delete>
DELETE [FROM] <identifierChain>
[ WHERE <condition> ]
<withQuery>
WITH <identifier> AS ( <select(ohne orderby)> ) [,…n]
<select>
Grammatik für die Bestandteile der Kommandos
<resultColumn>
<identifierChain>.*
| <value> [AS <identifier>]
<singleSource>
( <singleSource> )
| <identifierChain> [ [AS] <identifier> ]
<joinSource>
( <joinSource> )
| { <singleSource> | <joinSource> }
{ INNER | {LEFT | RIGHT | FULL} [OUTER] } JOIN
{ <singleSource> | <joinSource> } ON <condition>
<condition>
( <condition> )
| NOT <condition>
| <condition> {{ AND | OR } <condition>}[,…n]
| <value> <predicate2>
| EXISTS ( <select> )
<predicate2>
{ = | != | < | <= | > | >= } <value>
| IS [NOT] NULL
| BETWEEN <value> AND <value>
| IN ( <select> | <value> [,…n] )
| LIKE <value>
| LIKEESCAPE <value>
<value>
NULL
| ( <value> )
| { - | + } <value>
| <value> { + | - | * | / | “||” } <value>
| <identifierChain>
| [<identifierChain>.] <FunktionsName> ( [ <value> [,…n] ] )
| <searchedCaseWhen>
| <simpleCaseWhen>
| "[[" <natives sql fragment> "]]"
| <stringLiteral>
| <integerValue>
| <decimalValue>
<searchedCaseWhen>
CASE {WHEN <condition> THEN <value>}[,…n]
[ ELSE <value> ] END
<simpleCaseWhen>
CASE <value>
{WHEN {<predicate2> | <value>} THEN <value>}[,…n]
[ ELSE <value> ] END
<orderColumn>
<value> [ASC | DESC]
<identifierChain>
<identifier>[.<identifier>][,…n]
<identifier>
"[" <beliebige Zeichenfolge> "]"
| <Wort, mit einem Buchstaben beginnend>