pub struct Analysis {Show 23 fields
pub kind: Option<StatementKind>,
pub comment: Option<String>,
pub params: Vec<Param>,
pub columns: Vec<Column>,
pub cardinality: Cardinality,
pub cardinality_reason: Option<String>,
pub key: Option<Vec<String>>,
pub unique: Vec<Vec<String>>,
pub order: Vec<SortKey>,
pub ordered: bool,
pub value: bool,
pub rewritten: Rewritten,
pub sql_mode: Option<MysqlText>,
pub style: Style,
pub diagnostics: Vec<Diagnostic>,
pub unresolved: Vec<String>,
pub structured: Vec<Info>,
pub errors: Option<Errors>,
pub capabilities: Option<Capabilities>,
pub read_only: bool,
pub domains: BTreeMap<String, String>,
pub notes: Vec<String>,
pub tables: Option<Tables>,
}Fields§
§kind: Option<StatementKind>The statement’s kind: one of the five, other for any other, absent when it did not parse.
comment: Option<String>The prose written in comments before the statement (crate::comment::leading).
params: Vec<Param>§columns: Vec<Column>§cardinality: CardinalityHow many rows the statement returns.
cardinality_reason: Option<String>Why the proof stopped short of one, when it did.
key: Option<Vec<String>>The result key: output columns, by name, that identify each row of the result, since no two
rows the statement returns agree on all of them (a NULL counting as equal to another NULL).
Only for a result that can hold more than one row: None where the cardinality is one or
at_most_one, which says as much, and where no key is proven, which is always sound.
unique: Vec<Vec<String>>Every set of output columns no two rows agree on all of, as key is, none inside another,
and a table’s primary key first where the result holds it. Empty where none is proven.
order: Vec<SortKey>The columns of the result its ORDER BY sorts on, as far as its keys are such columns.
ordered: boolWhether the statement’s ORDER BY orders its rows totally: no two rows of any result tie on
every sort key, so the order is the same on every run. Only for a result that can hold more
than one row, as key is.
value: boolWhether the result is its one column’s values, not rows that hold them: the statement’s one
column is an expression it gives no name, so the only name it has is one the database makes
up (crate::analysis::names).
rewritten: Rewritten§sql_mode: Option<MysqlText>How the session the statement was read on reads MySQL’s strings and double quotes, by its
sql_mode, where another mode would read the statement otherwise: its placeholders hold
only for a session that reads it so. Absent where every mode reads it alike, and on every
other database.
style: Style§diagnostics: Vec<Diagnostic>§unresolved: Vec<String>Paths inside JSON columns the engine could not type, for a message.
structured: Vec<Info>Each structured parameter in insert position, with the lists of rewritten the run time
writes again for a call that leaves keys out (crate::structured); on the wire only
those that have lists (MySQL’s), since a Postgres or SQLite statement copies its defaults.
errors: Option<Errors>The names each error the statement may raise can carry, where it runs only its database’s
own code (crate::errors).
capabilities: Option<Capabilities>What running the statement may do, an upper bound (types::Capabilities); absent where
nothing is said.
read_only: boolWhether the engine finds nothing in the statement that could write, so that a caller may run it again after
a lost connection (crate::database::Database::read_only).
domains: BTreeMap<String, String>Each domain a type of the statement is named by, with the name of the base type it is made
from: a client decodes a domain’s values as its base type’s (a Postgres domain over
pgvector’s vector comes as the vector’s text), which the format leaves to the catalog.
notes: Vec<String>What is worth saying of the statement but fails nothing, for a hover: the type check has no level below an error.
tables: Option<Tables>The tables the statement reads and writes, as its database’s own parse names them
(crate::fresh::Tables). On the wire only where the analysis read a function’s body,
whose tables a parse of the statement as written cannot give: so a server’s analysis
carries them to its client.
Implementations§
Source§impl Analysis
impl Analysis
Sourcepub fn descriptor(
&self,
sql: &str,
dialect: DialectVersion,
) -> StatementDescriptor
pub fn descriptor( &self, sql: &str, dialect: DialectVersion, ) -> StatementDescriptor
The statement as the format describes it (StatementDescriptor): sql is the statement
as it was written, which the diagnostics’ offsets index, and dialect the database and
version the analysis read.