pub trait Dialect: Send + Sync {
// Required methods
fn capabilities(&self) -> BackendCapabilities;
fn write_placeholder(&self, out: &mut String, index: usize);
fn cast_type(&self, ty: SqlType) -> &'static str;
// Provided methods
fn write_ident(&self, out: &mut String, ident: &str) { ... }
fn offset_requires_limit(&self) -> bool { ... }
fn unbounded_limit(&self) -> &'static str { ... }
fn like_escape_literal(&self) -> &'static str { ... }
fn default_values_sql(&self) -> &'static str { ... }
fn supports_aggregate_filter(&self) -> bool { ... }
fn evaluates_assignments_in_order(&self) -> bool { ... }
}Expand description
Differences between SQL flavours that the compiler needs to know about.
Required Methods§
Sourcefn capabilities(&self) -> BackendCapabilities
fn capabilities(&self) -> BackendCapabilities
Declared capabilities; the compiler rejects plans that exceed them.
Sourcefn write_placeholder(&self, out: &mut String, index: usize)
fn write_placeholder(&self, out: &mut String, index: usize)
Write the placeholder for the index-th (1-based) bind parameter.
Provided Methods§
Sourcefn write_ident(&self, out: &mut String, ident: &str)
fn write_ident(&self, out: &mut String, ident: &str)
Write a quoted identifier. Embedded quote characters are doubled.
Sourcefn offset_requires_limit(&self) -> bool
fn offset_requires_limit(&self) -> bool
Whether OFFSET requires a preceding LIMIT.
Sourcefn unbounded_limit(&self) -> &'static str
fn unbounded_limit(&self) -> &'static str
The LIMIT written before a bare OFFSET when
offset_requires_limit is set.
Sourcefn like_escape_literal(&self) -> &'static str
fn like_escape_literal(&self) -> &'static str
The SQL string literal used as the LIKE .. ESCAPE character (one
backslash).
Sourcefn default_values_sql(&self) -> &'static str
fn default_values_sql(&self) -> &'static str
The tail of an INSERT INTO t that stores one row of defaults.
Sourcefn supports_aggregate_filter(&self) -> bool
fn supports_aggregate_filter(&self) -> bool
Whether aggregates accept FILTER (WHERE ..). When not, the compiler
rewrites AGG(x) FILTER (WHERE f) as AGG(CASE WHEN f THEN x END).
Sourcefn evaluates_assignments_in_order(&self) -> bool
fn evaluates_assignments_in_order(&self) -> bool
Whether UPDATE .. SET a = .., b = .. evaluates the assignments left
to right, so a later right-hand side sees the new value of an
earlier column (standard SQL reads the old values). The compiler then
reorders assignments to keep the standard meaning.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".