Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.7 KiB

  1. Grammar for the SQL dialect support in ADSI's OLE DB provider.
  2. The grammar we used is a subset derived from the SQL ODBC miniumum grammar.
  3. 2.1 The Terminal Tokens
  4. TERMINAL SYMBOLS (TOKENS) to be expected by the parser.
  5. TOKEN_ERROR
  6. TOKEN_STAR
  7. TOKEN_LPARAN
  8. TOKEN_RPARAN
  9. TOKEN_INTEGER_LITERAL
  10. TOKEN_REAL_LITERAL
  11. TOKEN_STRING_LITERAL
  12. TOKEN_USER_DEFINED_NAME
  13. TOKEN_COMMA
  14. TOKEN_SELECT
  15. TOKEN_ALL
  16. TOKEN_FROM
  17. TOKEN_WHERE
  18. TOKEN_BOOLEAN_LITERAL
  19. TOKEN_AND
  20. TOKEN_OR
  21. TOKEN_NOT
  22. TOKEN_END
  23. TOKEN_LT
  24. TOKEN_GT
  25. TOKEN_GE
  26. TOKEN_LE
  27. TOKEN_EQ
  28. TOKEN_NE
  29. 2.2 The Grammer
  30. statement ::= select-statement
  31. select-statement ::= TOKEN_SELECT [TOKEN_ALL] select-list TOKEN_FROM table-identifier [TOKEN_WHERE search-condition]
  32. select-list ::= TOKEN_STAR | select-sublist [TOKEN_COMMA select-sublist]...
  33. select-sublist ::= column-identifier
  34. column-identifier ::= TOKEN_USER_DEFINED_NAME
  35. table-identifier ::= TOKEN_STRING_LITERAL
  36. search-condition ::= boolean-term [TOKEN_OR search-condition]
  37. boolean-term ::= boolean-factor [TOKEN_AND boolean-term]
  38. boolean-factor ::= [TOKEN_NOT] boolean-primary
  39. boolean-primary ::= comparison-predicate | TOKEN_LPARAN search-condition TOKEN_RPARAN
  40. comparison-predicate ::= column-identifier TOKEN_COMPARISON_OPERATOR literal
  41. literal ::= TOKEN_STRING_LITERAL | numeric-literal | TOKEN_BOOLEAN_LITERAL
  42. numeric-literal ::= TOKEN_INTEGER_LITERAL | TOKEN_REAL_LITERAL
  43. For example, the tokens generated by the lexer for the following SQL statement
  44. SELECT CN, objectClass FROM 'LDAP://ntdsdc1/c=US/O=Microsoft/OU=NTDS' WHERE
  45. ObjectClass = User OR AGE > 25