Skip to main content

Or

Enum Or 

Source
pub enum Or {
    Rollback,
    Abort,
    Replace,
    Fail,
    Ignore,
}
Expand description

The conflict-clause of an INSERT or UPDATE: INSERT OR REPLACE INTO …, UPDATE OR IGNORE ….

From https://www.sqlite.org/lang_insert.html and https://www.sqlite.org/lang_update.html:

INSERT OR { ROLLBACK | ABORT | REPLACE | FAIL | IGNORE } INTO …
UPDATE OR { ROLLBACK | ABORT | REPLACE | FAIL | IGNORE } …

ABORT is the default and there is no reason to write it, but it is one of the five keywords the grammar lists rather than an absence, so it is representable — unlike PostgreSQL’s ALL on a SELECT, which adds nothing at all. A DELETE has no such clause, which is why nothing in delete mentions one.

SQLite’s standalone REPLACE INTO t … is exactly INSERT OR REPLACE INTO t …; only the longer spelling is produced, because the two are the same statement and one spelling is enough.

Variants§

§

Rollback

OR ROLLBACK — abort the whole transaction.

§

Abort

OR ABORT — the default: abort this statement, keep the transaction.

§

Replace

OR REPLACE — delete the rows that conflict, then insert.

§

Fail

OR FAIL — stop, but keep the changes already made by this statement.

§

Ignore

OR IGNORE — skip the offending row and carry on.

Implementations§

Source§

impl Or

Source

pub fn as_str(self) -> &'static str

The keyword, as written after OR.

Trait Implementations§

Source§

impl Clone for Or

Source§

fn clone(&self) -> Or

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Or

Source§

impl Debug for Or

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for Or

Source§

impl PartialEq for Or

Source§

fn eq(&self, other: &Or) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Or

Auto Trait Implementations§

§

impl Freeze for Or

§

impl RefUnwindSafe for Or

§

impl Send for Or

§

impl Sync for Or

§

impl Unpin for Or

§

impl UnsafeUnpin for Or

§

impl UnwindSafe for Or

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.