pub struct ScriptAnalysis {
pub text: String,
pub statements: Vec<AnalysedStatement>,
pub writes: Vec<ScriptWrite>,
pub reads: IndexMap<String, TableName>,
pub variable_reads: IndexMap<String, TableName>,
pub definition_reads: IndexMap<String, TableName>,
pub side_reads: IndexMap<String, TableName>,
pub procedures: IndexMap<String, Procedure>,
pub procedure_reports: Vec<Value>,
pub opaque_temps: IndexMap<String, String>,
pub temp_names: IndexSet<String>,
/* private fields */
}Expand description
The result of analyse_script.
Fields§
§text: String§statements: Vec<AnalysedStatement>§writes: Vec<ScriptWrite>§reads: IndexMap<String, TableName>Real tables read directly.
variable_reads: IndexMap<String, TableName>Tables read through variables or conditions.
definition_reads: IndexMap<String, TableName>Tables the bodies of routine definitions read.
side_reads: IndexMap<String, TableName>Tables read outside the traced output query.
procedures: IndexMap<String, Procedure>§procedure_reports: Vec<Value>§opaque_temps: IndexMap<String, String>Temporary tables the final query reads whose query could not be followed, with why.
temp_names: IndexSet<String>Implementations§
Source§impl ScriptAnalysis
impl ScriptAnalysis
Sourcepub fn final_statement(&self) -> Option<&Statement>
pub fn final_statement(&self) -> Option<&Statement>
The statement whose columns define the script’s output (its last unconditional query), with temporary tables renamed to the versions it reads.
Sourcepub fn final_query(&self) -> Option<&Query>
pub fn final_query(&self) -> Option<&Query>
The final statement’s query.
Sourcepub fn final_target(&self) -> Option<&TableName>
pub fn final_target(&self) -> Option<&TableName>
The table the final statement writes, if any.
Sourcepub fn with_temp_ctes(&self, query: Query) -> Query
pub fn with_temp_ctes(&self, query: Query) -> Query
query (the final one, with its own CTEs) with the temporary tables it reads defined in
front of it as CTEs.
Sourcepub fn final_query_with_temps(&self) -> Option<Query>
pub fn final_query_with_temps(&self) -> Option<Query>
The final query with every single-definition temporary table it reads spliced in as a CTE.
Sourcepub fn counts(&self) -> IndexMap<Disposition, usize>
pub fn counts(&self) -> IndexMap<Disposition, usize>
Top-level statements by disposition.
Sourcepub fn unknown(&self) -> Vec<&AnalysedStatement>
pub fn unknown(&self) -> Vec<&AnalysedStatement>
Every unknown statement, nested ones included.
Sourcepub fn considered(&self) -> usize
pub fn considered(&self) -> usize
Statements that matter for lineage: kept or unknown, not definitions.
pub fn traced(&self) -> usize
Sourcepub fn untraced_kept(&self) -> usize
pub fn untraced_kept(&self) -> usize
Kept statements whose columns are not part of the traced output.
Sourcepub fn untraced_kinds(&self) -> BTreeMap<String, usize>
pub fn untraced_kinds(&self) -> BTreeMap<String, usize>
Kinds of statements that matter but whose columns are not traced.