pub struct Sqlite;Trait Implementations§
impl Copy for Sqlite
Source§impl Target for Sqlite
impl Target for Sqlite
Source§fn extract(
&self,
field: &str,
expr: &str,
interval: bool,
ctx: &mut Ctx<'_>,
) -> Result<String, Untranslatable>
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>
fn epoch_of_difference( &self, a: &str, b: &str, ctx: &mut Ctx<'_>, ) -> Result<Option<String>, Untranslatable>
Whole seconds between two timestamp texts.
fn name(&self) -> &'static str
Source§fn bytes_literal(&self, b: &[u8]) -> String
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
fn placeholder(&self, n: u32) -> String
Placeholder text for the 1-based parameter
n.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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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.fn distinct_on(&self, ctx: &mut Ctx<'_>) -> Result<(), Untranslatable>
Source§fn row_lock(
&self,
_lock: &RowLockClause,
ctx: &mut Ctx<'_>,
) -> Result<(), Untranslatable>
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>
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>
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>
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>
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>
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>
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.fn returning( &self, _kind: StmtKind, ctx: &mut Ctx<'_>, ) -> Result<(), Untranslatable>
Source§fn replace_keyword(&self) -> Option<&'static str>
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>
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>
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>
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>
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>
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>
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).fn quote_ident(&self, s: &str) -> String
fn string_literal(&self, s: &str) -> String
Source§fn with_statement(
&self,
kind: StmtKind,
ctx: &mut Ctx<'_>,
) -> Result<(), Untranslatable>
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
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
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>
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>
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
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
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§
impl Freeze for Sqlite
impl RefUnwindSafe for Sqlite
impl Send for Sqlite
impl Sync for Sqlite
impl Unpin for Sqlite
impl UnsafeUnpin for Sqlite
impl UnwindSafe for Sqlite
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more