Skip to main content

ChangeInfo

Struct ChangeInfo 

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

Information about an INSERT/UPDATE/DELETE on a virtual table.

Implementations§

Source§

impl ChangeInfo

Source

pub fn change_type(&self) -> ChangeType

Returns the type of update being performed.

Source

pub fn rowid(&self) -> &ValueRef

Returns the rowid (or, for WITHOUT ROWID tables, the PRIMARY KEY column) of the row being deleted or updated.

Semantically, an UPDATE to a virtual table is identical to a DELETE followed by an INSERT. In that sense, this method returns the rowid or PRIMARY KEY column of the row being deleted. The rowid of the row being inserted is available as the first element in args.

For the mutable version, see rowid_mut.

Source

pub fn rowid_mut(&mut self) -> &mut ValueRef

Mutable version of rowid.

Source

pub fn args(&self) -> &[&ValueRef]

Returns the arguments for an INSERT or UPDATE. The meaning of the first element in this slice depends on the type of change being performed:

  • For an INSERT on a WITHOUT ROWID table, the first element is always NULL. The PRIMARY KEY is listed among the remaining elements.
  • For an INSERT on a regular table, if the first element is NULL, it indicates that a rowid must be generated and returned from UpdateVTab::update. Otherwise, the first element is the rowid.
  • For an UPDATE, the first element is the new value for the rowid or PRIMARY KEY column.

In all cases, the second and following elements correspond to the values for all columns in the order declared in the virtual table’s schema (returned by VTab::connect / CreateVTab::create).

For the mutable version, see args_mut.

Source

pub fn args_mut(&mut self) -> &mut [&mut ValueRef]

Mutable version of args.

Source

pub fn conflict_mode(&self) -> ConflictMode

Return the ON CONFLICT mode of the current SQL statement. In order for this method to be useful, the virtual table needs to have previously enabled ON CONFLICT support using VTabConnection::enable_constraints.

Requires SQLite 3.7.7. On earlier versions, this will always return ConflictMode::Abort.

Trait Implementations§

Source§

impl Debug for ChangeInfo

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.