Skip to main content

Sqlite

Struct Sqlite 

Source
pub struct Sqlite;

Trait Implementations§

Source§

impl Clone for Sqlite

Source§

fn clone(&self) -> Self

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 Sqlite

Source§

impl Debug for Sqlite

Source§

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

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

impl Default for Sqlite

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Target for Sqlite

Source§

fn extract( &self, field: &str, expr: &str, interval: bool, ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

Verified on SQLite 3.53 against PostgreSQL’s results: the fields are read from the timestamp text with strftime; the epoch of a timestamp is strftime('%s'), whole seconds. Other fields and the epoch of an interval have no verified mapping.

Source§

fn epoch_of_difference( &self, a: &str, b: &str, ctx: &mut Ctx<'_>, ) -> Result<Option<String>, Untranslatable>

Whole seconds between two timestamp texts.

Source§

fn name(&self) -> &'static str

Source§

fn bytes_literal(&self, b: &[u8]) -> String

A byte-string literal. PostgreSQL has no hex literal of this type, so it casts an escape string.
Source§

fn placeholder(&self, n: u32) -> String

Placeholder text for the 1-based parameter n.
Source§

fn bool_literal( &self, b: bool, ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

Source§

fn like( &self, lhs: &str, rhs: &str, negated: bool, ci: bool, esc: Escape<'_>, ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

lhs [NOT] LIKE rhs / ILIKE, operands already printed.
Source§

fn regexp( &self, _lhs: &str, _rhs: &str, _negated: bool, ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

lhs [NOT] REGEXP rhs, operands already printed. The default is PostgreSQL’s ~ / !~.
Source§

fn rewrite_query( &self, q: &Query, ctx: &mut Ctx<'_>, ) -> Result<Option<Query>, Untranslatable>

Whole-query rewrite before printing (for example DISTINCT ON via a window function). Return Some(q2) to print q2 instead; q2 must not trigger the same rewrite again.
Source§

fn feature( &self, name: &'static str, ctx: &mut Ctx<'_>, ) -> Result<(), Untranslatable>

A feature the printer is about to emit: window_function, filter_clause, recursive_cte, named_arg. Default: exact (PostgreSQL).
Source§

fn trim( &self, side: TrimSide, expr: &str, chars: Option<&str>, ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

TRIM(..) with operands already printed.
Source§

fn interval_arith( &self, minus: bool, left: &str, parts: &[(String, String)], ctx: &mut Ctx<'_>, ) -> Result<Option<String>, Untranslatable>

left (+|-) make_interval(parts..); parts are (unit, printed value). Return Some(text) to replace the whole expression, None to print it the generic way.
Source§

fn json_access( &self, text: bool, lhs: &str, rhs: &str, ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

JSON -> / ->> with operands printed. Default: PostgreSQL.
Source§

fn function( &self, f: &Function, args: &[String], ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

A function call with arguments already printed. Return the full call text.
Source§

fn cast( &self, expr: &str, ty: &SqlType, ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

Source§

fn group_by_rollup( &self, _keys: &[String], ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

The body of a GROUP BY with WITH ROLLUP, keys printed. Default (PostgreSQL): ROLLUP (a, b), exact.
Source§

fn distinct_on(&self, ctx: &mut Ctx<'_>) -> Result<(), Untranslatable>

Source§

fn row_lock( &self, _lock: &RowLockClause, ctx: &mut Ctx<'_>, ) -> Result<(), Untranslatable>

A row-locking clause. The default (PostgreSQL) gives every form; each form is its own leaf: row_lock (FOR UPDATE), row_lock.share, row_lock.of, row_lock.nowait, row_lock.skip_locked.
Source§

fn at_time_zone(&self, ctx: &mut Ctx<'_>) -> Result<(), Untranslatable>

expr AT TIME ZONE zone. Default (PostgreSQL): exact. A target without it refuses the leaf at_time_zone.
Source§

fn array_subquery(&self, ctx: &mut Ctx<'_>) -> Result<(), Untranslatable>

ARRAY(SELECT ..). Default (PostgreSQL): exact. A target without an array type refuses the leaf array_subquery.
Source§

fn null_safe_eq( &self, lhs: &str, rhs: &str, ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

a <=> b (null-safe equality), operands printed. Default (PostgreSQL): IS NOT DISTINCT FROM.
Source§

fn array_literal( &self, _items: &[String], ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

ARRAY[..], elements printed. Default (PostgreSQL): exact; a target without an array type refuses the leaf array_literal.
Source§

fn table_function( &self, name: &str, ctx: &mut Ctx<'_>, ) -> Result<(), Untranslatable>

A table-valued function in FROM (generate_series, jsonb_object_keys, unnest, …). Default (PostgreSQL): exact, one leaf per function (table_function.<name>). A target that has not verified the function refuses that leaf.
Source§

fn data_modifying_cte(&self, ctx: &mut Ctx<'_>) -> Result<(), Untranslatable>

WITH x AS (INSERT/UPDATE/DELETE .. RETURNING ..) ... The default (PostgreSQL) has it; a target without it refuses the leaf cte.data_modifying.
Source§

fn returning( &self, _kind: StmtKind, ctx: &mut Ctx<'_>, ) -> Result<(), Untranslatable>

Source§

fn replace_keyword(&self) -> Option<&'static str>

The native spelling of an insert that replaces conflicting rows (REPLACE INTO on MySQL and MariaDB, INSERT OR REPLACE INTO on SQLite). None (the default, PostgreSQL) means there is none: the printer then writes an upsert when the schema states the table’s columns and its one unique key, and refuses (leaf replace_into) otherwise.
Source§

fn upsert_clause( &self, conflict_cols: &[String], do_nothing: bool, set: &str, where_: Option<&str>, _first_insert_col: &str, ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

The whole ON CONFLICT .. clause. set and where_ are printed; columns are quoted.
Source§

fn limit_offset( &self, limit: Option<&str>, offset: Option<&str>, ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

LIMIT/OFFSET tail; operands already printed. Returns "" when neither is present.
Source§

fn array_membership( &self, lhs: &str, ph: &str, negated: bool, n: u32, ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

Membership in an array parameter: lhs = ANY(ph) (or <> ALL when negated). The target must record how the caller binds parameter n via Ctx::bind_array_param. The default refuses: a target with no array codec has no honest translation.
Source§

fn between( &self, numeric: bool, ctx: &mut Ctx<'_>, ) -> Result<(), Untranslatable>

Hook for [NOT] BETWEEN. numeric is true when an operand is syntactically numeric (so no text collation is involved). Default: exact.
Source§

fn binary_op( &self, op: BinaryOp, numeric: bool, ctx: &mut Ctx<'_>, ) -> Result<(), Untranslatable>

Hook for operators whose meaning differs. numeric is true when an operand is syntactically numeric (a number literal, arithmetic, or a numeric aggregate). Default: exact.
Source§

fn nulls_order( &self, desc: bool, nulls_first: bool, ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

Text for one ORDER BY item’s null-ordering suffix, "" for none. nulls_first is always explicit after reading (the reader fills in the source dialect’s default).
Source§

fn quote_ident(&self, s: &str) -> String

Source§

fn string_literal(&self, s: &str) -> String

Source§

fn with_statement( &self, kind: StmtKind, ctx: &mut Ctx<'_>, ) -> Result<(), Untranslatable>

WITH .. INSERT | UPDATE | DELETE .. (the common table expressions precede the modifying statement). The default (PostgreSQL) has all three; each is its own leaf: with.insert, with.update, with.delete.
Source§

fn join_tier(&self, _kind: JoinKind) -> Tier

Tier of a join kind on this target (SQLite lacks RIGHT/FULL before 3.39).
Source§

fn update_from_tier(&self) -> Tier

Tier of UPDATE .. FROM.
Source§

fn binary_override( &self, _op: BinaryOp, _l: &str, _r: &str, _numeric: bool, _ctx: &mut Ctx<'_>, ) -> Result<Option<String>, Untranslatable>

Replace the default l OP r text for a binary operator (for example || -> CONCAT, / -> DIV). Operands are already printed. Return None for the default.
Source§

fn order_item( &self, expr: &str, desc: bool, nulls_first: bool, ctx: &mut Ctx<'_>, ) -> Result<String, Untranslatable>

One ORDER BY item with its direction and NULL placement. nulls_first is explicit.
Source§

fn needs_conflict_key(&self) -> bool

Whether an upsert must name its conflict key columns (PostgreSQL and SQLite do; MySQL and MariaDB fire on any unique key). When it does and the source stated none, the printer takes the key from the schema if the table has exactly one stated unique key.
Source§

fn excluded_ref(&self, column_quoted: &str) -> String

How the SET list of an upsert refers to the value that was proposed for insertion.

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

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

fn try_from(value: U) -> Result<T, !>

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.