pub fn gate(sql: &str, values: &[String], policy: &Policy) -> Result<Gated>Expand description
Admits one caller statement, or says exactly why it is refused.
The order is the design and is fixed:
- The structural refusals run over the syntax tree and over the text with comments and literals blanked, before anything is sent.
- The classification is read from that same tree. A shape the classifier does not recognise is refused here and is never carried on as a read.
- The count of bound values is checked against the count of markers, so a mismatch costs no connection.
The size of the send is measured before any of that, because it is the one refusal whose absence is not a wrong answer but a lost connection: a command past the destination’s packet ceiling is not rejected by the server, it makes the server close the channel, and the caller is then told the network is unreachable about a command that never had a chance of arriving.
§Errors
Returns a limit failure when the send is larger than the destination accepts. Returns a validation failure when the statement carries more than one command, reaches the server’s filesystem, or has an unrecognised shape. Returns a usage failure when the number of values does not match the number of markers.