Expand description
Abstraction over SQL dialect differences.
Different databases vary in placeholder syntax ($N, ?, ?N, @PN),
result-returning clauses (RETURNING, OUTPUT INSERTED), identifier
quoting, upsert syntax, and transaction control keywords. Operations in
prax-query compose SQL through a &dyn SqlDialect, obtained from their
bound QueryEngine via engine.dialect(), so a single build_sql
emission path serves every backend.
Structs§
- Cql
- Cassandra Query Language dialect, used by
ScyllaEngineand the Cassandra driver. CQL overlaps with SQL for the basicSELECT/INSERT/UPDATE/DELETE ... WHEREshapes the Client API emits, but diverges on many details: noRETURNING, no cross-partition joins, no traditionalON CONFLICT(useIF NOT EXISTSLWT instead), no transactions, and?positional placeholders only. The CQL dialect emits that subset safely; engine-level compensation covers the RETURNING gap the way MySQL does. - Mssql
- Microsoft SQL Server dialect:
@PNplaceholders,OUTPUT INSERTED.*, bracket-quoted identifiers,BEGIN/COMMIT/ROLLBACK TRANSACTION. Upserts require MERGE, which the engine post-processes; the upsert clause emits empty. - Mysql
- MySQL dialect:
?placeholders (positionless), noRETURNINGsupport (that’s a MariaDB 10.5+ extension, not MySQL 8.0), backtick-quoted identifiers,ON DUPLICATE KEY UPDATE ...upserts. - NotSql
- Inert dialect for engines that do not emit SQL (document stores such as MongoDB). Every helper returns an empty or identity value. Calling these methods is a bug — no SQL string built from this dialect would be valid against any real database. The driver’s own non-SQL operation path should never reach these helpers.
- Postgres
- PostgreSQL dialect:
$Nplaceholders,RETURNING,"ident"quoting,ON CONFLICT (cols) DO UPDATE SET ...upserts,DISTINCT ONsupport. - Sqlite
- SQLite dialect:
?Nplaceholders,RETURNING,"ident"quoting,ON CONFLICT (cols) DO UPDATE SET ...upserts.
Traits§
- SqlDialect
- Cross-dialect SQL emission helpers.