Skip to main content

Analysis

Struct Analysis 

Source
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: Cardinality

How 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: bool

Whether 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: bool

Whether 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: bool

Whether 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

Source

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.

Trait Implementations§

Source§

impl Clone for Analysis

Source§

fn clone(&self) -> Analysis

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Analysis

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Serialize for Analysis

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.