pub struct IndexInfoConstraint<'a> { /* private fields */ }Implementations§
Source§impl IndexInfoConstraint<'_>
impl IndexInfoConstraint<'_>
Sourcepub fn op(&self) -> ConstraintOp
pub fn op(&self) -> ConstraintOp
Return the type of constraint.
Sourcepub fn usable(&self) -> bool
pub fn usable(&self) -> bool
IndexInfo::constraints contains information about all constraints that apply to the virtual table, but some of the constraints might not be usable because of the way tables are ordered in a join. The best_index method must therefore only consider constraints that for which this method returns true.
Sourcepub fn rhs(&self) -> Result<&ValueRef>
pub fn rhs(&self) -> Result<&ValueRef>
Returns the right-hand side of the constraint.
This routine attempts to retrieve the value of the right-hand operand of the constraint if that operand is known. If the operand is not known, then Err(SQLITE_NOTFOUND) is returned. This method can return another error type if something goes wrong.
This method is usually only successful if the right-hand operand of a constraint is a literal value in the original SQL statement. If the right-hand operand is an expression or a reference to some other column or a host parameter, then this method will probably return Err(SQLITE_NOTFOUND).
Some constraints, such as ConstraintOp::IsNull, have no right-hand operand. For such constraints, this method always returns Err(SQLITE_NOTFOUND).
Requires SQLite 3.38.0. On earlier versions of SQLite, Err(SQLITE_NOTFOUND) is always returned.
Sourcepub fn collation(&self) -> Result<&str>
pub fn collation(&self) -> Result<&str>
Return the collation to use for text comparisons on this column.
See the SQLite documentation for more details.
Sourcepub fn argv_index(&self) -> Option<u32>
pub fn argv_index(&self) -> Option<u32>
Retrieve the value previously set using set_argv_index.
Sourcepub fn set_argv_index(&mut self, idx: Option<u32>)
pub fn set_argv_index(&mut self, idx: Option<u32>)
Set the desired index for filter’s argv.
Exactly one entry in the IndexInfo should be set to 0, another to 1, another to 2, and so forth up to as many or as few as the best_index method wants. The EXPR of the corresponding constraints will then be passed in as the argv[] parameters to filter.
Sourcepub fn set_omit(&mut self, val: bool)
pub fn set_omit(&mut self, val: bool)
Advise SQLite that this constraint is validated by the virtual table implementation. SQLite may skip performing its own check in some cases. It is generally a hint and not a requirement, but a notable exception is for ConstraintOp::Offset, which is always honored. See the SQLite documentation for more details.
Sourcepub fn value_list_available(&self) -> bool
pub fn value_list_available(&self) -> bool
Check if all values in this IN constraint are able to be processed simultaneously. If this method returns true, then a call to set_value_list_wanted would also return true.
Requires SQLite 3.38.0. On earlier versions, this function will always return false.
Sourcepub fn set_value_list_wanted(&mut self, val: bool) -> bool
pub fn set_value_list_wanted(&mut self, val: bool) -> bool
Instruct SQLite to return all values in an IN constraint simultaneously.
A constraint on a virtual table in the form of “column IN (…)” is communicated to VTab::best_index as a ConstraintOp::Eq constraint. If the virtual table wants to use this constraint, it must use set_argv_index to assign the constraint to an argument. Then, SQLite will invoke VTabCursor::filter once for each value on the right-hand side of the IN operator. Thus, the virtual table only sees a single value from the right-hand side of the IN operator at a time.
In some cases, however, it would be advantageous for the virtual table to see all values on the right-hand of the IN operator all at once. This method enables this feature.
Calling this method with true will request ValueList processing. In order for ValueList processing to work:
- this constraint must be assigned an argv index using set_argv_index;
- this method is called with true; and
- SQLite is able to provide all values simultaneously.
If all of these criteria are met, then the corresponding argument passed to VTabCursor::filter will appear to be SQL NULL, but accessible using ValueList. If this facility is requested but this method returns false, then VTabCursor::filter will be invoked multiple times with each different value of the constraint, as normal.
This method always returns the same value that value_list_available would. Calling this method with false cancels a previous request for a ValueList.
See the SQLite documentation for more details.
Requires SQLite 3.38.0. On earlier versions, this function will always return false.
Trait Implementations§
Source§impl<'a> Clone for IndexInfoConstraint<'a>
impl<'a> Clone for IndexInfoConstraint<'a>
Source§fn clone(&self) -> IndexInfoConstraint<'a>
fn clone(&self) -> IndexInfoConstraint<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more