pub trait SqlDialect: Send + Sync {
// Required methods
fn compile(&self, ir: &QueryIR) -> CompileResult;
fn quote_identifier(&self, name: &str) -> String;
fn name(&self) -> &str;
// Provided methods
fn supports_count_distinct(&self) -> bool { ... }
fn placeholder(&self) -> &str { ... }
}Expand description
Trait for SQL dialect implementations. Each database backend (StarRocks, ClickHouse, etc.) implements this to compile a QueryIR into its native SQL syntax.
Required Methods§
Sourcefn compile(&self, ir: &QueryIR) -> CompileResult
fn compile(&self, ir: &QueryIR) -> CompileResult
Compile a QueryIR into a parameterized SQL string, binding values, and an alias remapping table for columns aliased in SELECT for HAVING support.
Sourcefn quote_identifier(&self, name: &str) -> String
fn quote_identifier(&self, name: &str) -> String
Quote a column or table identifier for this dialect (e.g. backticks for MySQL/StarRocks).
Provided Methods§
Sourcefn supports_count_distinct(&self) -> bool
fn supports_count_distinct(&self) -> bool
Whether the dialect supports COUNT(DISTINCT col).
Sourcefn placeholder(&self) -> &str
fn placeholder(&self) -> &str
The placeholder character for parameterized queries (e.g. ? for MySQL, $1 for PostgreSQL).