WindowsXP-SP1/ds/adsi/docs/sqlsyntax.txt
2020-09-30 16:53:49 +02:00

67 lines
1.8 KiB
Plaintext

Grammar for the SQL dialect support in ADSI's OLE DB provider.
The grammar we used is a subset derived from the SQL ODBC miniumum grammar.
2.1 The Terminal Tokens
TERMINAL SYMBOLS (TOKENS) to be expected by the parser.
TOKEN_ERROR
TOKEN_STAR
TOKEN_LPARAN
TOKEN_RPARAN
TOKEN_INTEGER_LITERAL
TOKEN_REAL_LITERAL
TOKEN_STRING_LITERAL
TOKEN_USER_DEFINED_NAME
TOKEN_COMMA
TOKEN_SELECT
TOKEN_ALL
TOKEN_FROM
TOKEN_WHERE
TOKEN_BOOLEAN_LITERAL
TOKEN_AND
TOKEN_OR
TOKEN_NOT
TOKEN_END
TOKEN_LT
TOKEN_GT
TOKEN_GE
TOKEN_LE
TOKEN_EQ
TOKEN_NE
2.2 The Grammer
statement ::= select-statement
select-statement ::= TOKEN_SELECT [TOKEN_ALL] select-list TOKEN_FROM table-identifier [TOKEN_WHERE search-condition]
select-list ::= TOKEN_STAR | select-sublist [TOKEN_COMMA select-sublist]...
select-sublist ::= column-identifier
column-identifier ::= TOKEN_USER_DEFINED_NAME
table-identifier ::= TOKEN_STRING_LITERAL
search-condition ::= boolean-term [TOKEN_OR search-condition]
boolean-term ::= boolean-factor [TOKEN_AND boolean-term]
boolean-factor ::= [TOKEN_NOT] boolean-primary
boolean-primary ::= comparison-predicate | TOKEN_LPARAN search-condition TOKEN_RPARAN
comparison-predicate ::= column-identifier TOKEN_COMPARISON_OPERATOR literal
literal ::= TOKEN_STRING_LITERAL | numeric-literal | TOKEN_BOOLEAN_LITERAL
numeric-literal ::= TOKEN_INTEGER_LITERAL | TOKEN_REAL_LITERAL
For example, the tokens generated by the lexer for the following SQL statement
SELECT CN, objectClass FROM 'LDAP://ntdsdc1/c=US/O=Microsoft/OU=NTDS' WHERE
ObjectClass = User OR AGE > 25