Skip to main content

check

Function check 

Source
pub fn check(sql: &str) -> Result<(), ParseError>
Expand description

Refuses, as TooLarge, input past one of the bounds.

Within one level, every token but ,, AND and OR counts towards the current segment, and those three end it: their operands are siblings, since lists are flat and the grammar flattens AND and OR. The AND of a BETWEEN is the exception: it joins the bounds of one expression, which can nest, so it counts as any other token. UNION, INTERSECT, EXCEPT and JOIN chains cross commas and ANDs, so they also count towards the whole level until its statement ends. A level is 1 deep, plus its whole-level count, plus its deepest segment, where a segment is its own count plus the deepest level nested inside it. The scan stops at the first count past MAX_CHAIN_DEPTH, since a depth is at least any of its counts. A GLOBAL followed by TEMP or TEMPORARY counts as a form the grammar warns about, wherever it is, at most MAX_WARNED_FORMS. At most MAX_OPERATOR_RUN operator characters stand in a row where the lexer rescans them, and block comments nest at most MAX_COMMENT_DEPTH deep.