Parses a string and fills the token buffer.
The parser function THD::sql_parser() is called directly instead of parse_sql(), as the latter assumes that it is called with the intent to record the statement in performance_schema and later execute it, neither of which is called for here. In fact we hardly need the parser to calculate a digest, since it is calculated from the token stream. There are only some corner cases where NULL
is sometimes a literal and sometimes an operator, as in IS NULL
, IS NOT NULL
.
- Parameters
-
thd | Session object used by the parser. |
statement_expr | The expression that evaluates to something that can be parsed. Needed for error messages in case we don't want to disclose what it evaluates to. |
statement_string | The non-NULL string resulting from evaluating statement_expr. The caller is preferred to do this as this function doesn't deal with NULL values. |
- Return values
-
true | Error. |
false | All went well, the digest information is in THD::m_digest. |