Skip to main content

QueryCondition

Struct QueryCondition 

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

QueryCondition — Spec §2.2.2.5.9. Extends ReadCondition with a SQL filter expression (DDS-DCPS Annex B). The filter is evaluated per sample (see Self::evaluate); the parse step happens once in the constructor.

Implementations§

Source§

impl QueryCondition

Source

pub fn new( base: Arc<ReadCondition>, query_expression: impl Into<String>, query_parameters: Vec<String>, ) -> Result<Arc<Self>>

Constructor — Spec §2.2.2.5.2.5 create_querycondition / §2.2.2.5.9. The SQL expression is parsed immediately; a syntactically invalid expression returns BadParameter.

§Errors

BadParameter if the SQL expression does not parse.

Source

pub fn evaluate<R: RowAccess>(&self, row: &R) -> Result<bool>

Evaluates the SQL filter against a sample. Spec §2.2.2.5.9.6 — only samples with evaluate(...)==Ok(true) count toward the read_w_condition/take_w_condition result.

Parameter strings are converted into String Values; the caller can pass typed parameters via Self::evaluate_with_values.

§Errors

Lock poisoning or SQL eval error (UnknownField/TypeMismatch/ MissingParam).

Source

pub fn evaluate_with_values<R: RowAccess>( &self, row: &R, params: &[Value], ) -> Result<bool>

Like Self::evaluate, but with an explicitly typed parameter slice (e.g. for int/float parameters that would not match as a string cast).

§Errors

SQL eval error.

Source

pub fn get_query_expression(&self) -> &str

Spec §2.2.2.5.9.4 get_query_expression.

Source

pub fn get_query_parameters(&self) -> Vec<String>

Spec §2.2.2.5.9.5 get_query_parameters.

Source

pub fn set_query_parameters(&self, params: Vec<String>) -> Result<()>

Spec §2.2.2.5.9.6 set_query_parameters.

§Errors

PreconditionNotMet on lock poisoning.

Source

pub fn base(&self) -> &Arc<ReadCondition>

Access to the base ReadCondition (Spec: QueryCondition extends ReadCondition).

Trait Implementations§

Source§

impl Condition for QueryCondition

Source§

fn get_trigger_value(&self) -> bool

True if the event of this condition is currently pending. Spec §2.2.2.1.6 get_trigger_value.
Source§

impl Debug for QueryCondition

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