Skip to main content

SqlDialect

Trait SqlDialect 

Source
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§

Source

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.

Source

fn quote_identifier(&self, name: &str) -> String

Quote a column or table identifier for this dialect (e.g. backticks for MySQL/StarRocks).

Source

fn name(&self) -> &str

Dialect name for logging/debugging.

Provided Methods§

Source

fn supports_count_distinct(&self) -> bool

Whether the dialect supports COUNT(DISTINCT col).

Source

fn placeholder(&self) -> &str

The placeholder character for parameterized queries (e.g. ? for MySQL, $1 for PostgreSQL).

Implementors§