Skip to main content

Script

Struct Script 

Source
pub struct Script {
    pub statements: Vec<(Node, String)>,
    /* private fields */
}
Expand description

The statements of the body of a function in SQL that Body::Statements runs, which fmgr_sql analyzes and runs one after the other, as prepare_next_query and init_execution_state do. A statement can see the changes of the statements before it.

Fields§

§statements: Vec<(Node, String)>

Each statement, with its text.

Implementations§

Source§

impl Script

Source

pub fn name(&self) -> &str

The name of the function.

Source

pub fn src(&self) -> &str

The body in a string, or an empty text for a body in BEGIN ATOMIC.

Source

pub fn read_only(&self) -> bool

True for a function that is not volatile, which can run only statements that do not write, as readonly_func of SQLFunctionHashEntry is.

Source

pub fn planned(&self, i: usize) -> bool

True when the statement i has a plan. The other statements run as utility statements.

Source

pub fn analyze( &self, env: &dyn Env, inputs: &[u32], i: usize, ) -> Result<Option<Query>>

prepare_next_query: the query of the statement i for a call with arguments of the types inputs. The last statement gives the result of the function, as check_sql_fn_retval checks it. None for a statement with no plan.

§Errors

The errors of the analysis of the statement, and 42P13 for a last statement that does not give the result of the function.

Trait Implementations§

Source§

impl Debug for Script

Source§

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

Formats the value using the given formatter. 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> 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, 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.