pub trait Dialect {
// Required methods
fn render_select(&self, select: &Select) -> Result<Sql>;
fn render_insert(&self, insert: &Insert) -> Result<Sql>;
fn render_update(&self, update: &Update) -> Result<Sql>;
fn render_delete(&self, delete: &Delete) -> Result<Sql>;
// Provided methods
fn supports_returning(&self) -> bool { ... }
fn render_select_owned(&self, select: Select) -> Result<Sql> { ... }
fn render_insert_owned(&self, insert: Insert) -> Result<Sql> { ... }
fn render_update_owned(&self, update: Update) -> Result<Sql> { ... }
fn render_delete_owned(&self, delete: Delete) -> Result<Sql> { ... }
}Expand description
Trait for SQL dialect renderers.
Allows rendering AST queries into dialect-specific SQL strings.
Required Methods§
Sourcefn render_select(&self, select: &Select) -> Result<Sql>
fn render_select(&self, select: &Select) -> Result<Sql>
Render a SELECT query into SQL.
Sourcefn render_insert(&self, insert: &Insert) -> Result<Sql>
fn render_insert(&self, insert: &Insert) -> Result<Sql>
Render an INSERT query into SQL.
Sourcefn render_update(&self, update: &Update) -> Result<Sql>
fn render_update(&self, update: &Update) -> Result<Sql>
Render an UPDATE query into SQL.
Sourcefn render_delete(&self, delete: &Delete) -> Result<Sql>
fn render_delete(&self, delete: &Delete) -> Result<Sql>
Render a DELETE query into SQL.
Provided Methods§
Sourcefn supports_returning(&self) -> bool
fn supports_returning(&self) -> bool
Whether this dialect natively supports the RETURNING clause on INSERT, UPDATE, and DELETE statements.
Dialects that return false (e.g. MySQL) will have RETURNING
emulated at the connector layer via separate queries.
Sourcefn render_select_owned(&self, select: Select) -> Result<Sql>
fn render_select_owned(&self, select: Select) -> Result<Sql>
Render an owned SELECT query into SQL, allowing dialects to move bound values out of the AST instead of cloning them.
Sourcefn render_insert_owned(&self, insert: Insert) -> Result<Sql>
fn render_insert_owned(&self, insert: Insert) -> Result<Sql>
Render an owned INSERT query into SQL, allowing dialects to move bound values out of the AST instead of cloning them.
Sourcefn render_update_owned(&self, update: Update) -> Result<Sql>
fn render_update_owned(&self, update: Update) -> Result<Sql>
Render an owned UPDATE query into SQL, allowing dialects to move bound values out of the AST instead of cloning them.
Sourcefn render_delete_owned(&self, delete: Delete) -> Result<Sql>
fn render_delete_owned(&self, delete: Delete) -> Result<Sql>
Render an owned DELETE query into SQL, allowing dialects to move bound values out of the AST instead of cloning them.
Implementors§
impl Dialect for MysqlDialect
Renders query ASTs into MySQL-compatible SQL with ? placeholders
and backtick-quoted identifiers.
impl Dialect for PostgresDialect
impl Dialect for SqliteDialect
Renders query ASTs into SQLite-compatible SQL with ? placeholders
and double-quoted identifiers.