pub trait Dialect:
Sized
+ Send
+ Sync
+ 'static {
// Required methods
fn quote_char() -> char;
fn write_placeholder(out: &mut String, n: usize);
fn supports_returning() -> bool;
// Provided methods
fn upsert_style() -> UpsertStyle { ... }
fn supports_distinct_on() -> bool { ... }
fn ilike_is_native() -> bool { ... }
fn supports_row_locking() -> bool { ... }
}Expand description
Compile-time description of a SQL dialect.
Required Methods§
Sourcefn quote_char() -> char
fn quote_char() -> char
The identifier quote character (e.g. backtick for MySQL, " for ANSI).
Sourcefn write_placeholder(out: &mut String, n: usize)
fn write_placeholder(out: &mut String, n: usize)
Write the bind placeholder for the n-th parameter (1-based) into out.
Dialects with positional placeholders (?) ignore n.
Sourcefn supports_returning() -> bool
fn supports_returning() -> bool
Whether this dialect supports the RETURNING clause.
Provided Methods§
Sourcefn upsert_style() -> UpsertStyle
fn upsert_style() -> UpsertStyle
How this dialect expresses an upsert. Defaults to
UpsertStyle::OnConflict (Postgres / SQLite); MySQL overrides to
UpsertStyle::OnDuplicateKey.
Sourcefn supports_distinct_on() -> bool
fn supports_distinct_on() -> bool
Whether this dialect supports SELECT DISTINCT ON (cols). Defaults to
false; only Postgres overrides to true. Compiling a distinct_on
query against a dialect that returns false panics.
Sourcefn ilike_is_native() -> bool
fn ilike_is_native() -> bool
Whether this dialect has a native case-insensitive ILIKE operator.
Defaults to false; only Postgres overrides to true. When false,
where_ilike is compiled as LOWER(col) LIKE LOWER(?).
Sourcefn supports_row_locking() -> bool
fn supports_row_locking() -> bool
Whether this dialect supports row-locking clauses (FOR UPDATE /
FOR SHARE, optionally SKIP LOCKED / NOWAIT). Defaults to true
(Postgres / MySQL); SQLite overrides to false, where such clauses are a
silent no-op (SQLite locks the whole database, not rows).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".