Skip to main content

IndexInfo

Struct IndexInfo 

Source
pub struct IndexInfo { /* private fields */ }
Expand description

Information about a query plan.

This struct contains all of the information about a query plan that SQLite is attempting on the virtual table. The struct will be passed to VTab::best_index.

This struct is both an input and an output. The virtual table implementation should examine the constraints and order_by fields, decide on the best query plan, and then set the results using IndexInfoConstraint::set_argv_index, set_estimated_cost, and the other methods.

Implementations§

Source§

impl IndexInfo

Source

pub fn constraints(&self) -> IndexInfoConstraintIterator<'_>

Source

pub fn order_by(&self) -> IndexInfoOrderByIterator<'_>

Source

pub fn distinct_mode(&self) -> DistinctMode

Determine if a query is DISTINCT.

Requires SQLite 3.38.0. On earlier versions, this function will always return DistinctMode::Ordered.

Source

pub fn index_num(&self) -> i32

Retrieve the value previously set by set_index_num.

Source

pub fn set_index_num(&mut self, val: i32)

Set the index number of this query plan. This is an arbitrary value which will be passed to VTabCursor::filter.

Source

pub fn index_str(&self) -> Option<&str>

Retrieve the value previously set by set_index_str.

Source

pub fn set_index_str(&mut self, val: Option<&str>) -> Result<()>

Set the index string of this query plan. This is an arbitrary value which will be passed to VTabCursor::filter.

This function can fail if SQLite is not able to allocate memory for the string.

Source

pub fn set_index_str_static(&mut self, val: &'static CStr)

Set the index string without copying.

Source

pub fn order_by_consumed(&self) -> bool

Retrieve the value previously set by set_order_by_consumed.

Source

pub fn set_order_by_consumed(&mut self, val: bool)

Indicate that the virtual table fully understands the requirements of the order_by and distinct_mode fields. If this is the case, then SQLite can omit reordering the results of the query, which may improve performance. It is never necessary to use the order_by information, but virtual tables may opt to use it as a performance optimization.

Source

pub fn estimated_cost(&self) -> f64

Retrieve the value previously set by set_estimated_cost.

Source

pub fn set_estimated_cost(&mut self, val: f64)

Source

pub fn estimated_rows(&self) -> Result<i64>

Retrieve the value previously set by set_estimated_rows.

Requires SQLite 3.8.2.

Source

pub fn set_estimated_rows(&mut self, val: i64)

Requires SQLite 3.8.2. On earlier versions of SQLite, this function is a harmless no-op.

Source

pub fn scan_flags(&self) -> Result<usize>

Retrieve the value previously set by set_scan_flags.

Requires SQLite 3.9.0.

Source

pub fn set_scan_flags(&mut self, val: usize)

Requires SQLite 3.9.0. On earlier versions of SQLite, this function is a harmless no-op.

Source

pub fn columns_used(&self) -> Result<u64>

Requires SQLite 3.10.0.

Trait Implementations§

Source§

impl Debug for IndexInfo

Source§

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

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.