pub struct Mysql;Expand description
MySQL dialect: ? placeholders (positionless), no RETURNING
support (that’s a MariaDB 10.5+ extension, not MySQL 8.0),
backtick-quoted identifiers, ON DUPLICATE KEY UPDATE ... upserts.
Because MySQL can’t emit the inserted/updated row in-line, the
MysqlEngine compensates at the driver layer: inserts look up
LAST_INSERT_ID() and SELECT back, updates re-run the WHERE as a
SELECT. See prax_mysql::MysqlEngine::execute_insert /
execute_update for details.
Trait Implementations§
Source§impl SqlDialect for Mysql
impl SqlDialect for Mysql
Source§fn placeholder(&self, _i: usize) -> String
fn placeholder(&self, _i: usize) -> String
Emit the 1-indexed parameter placeholder for position
i.Source§fn upsert_do_nothing_clause(&self, c: &[&str]) -> String
fn upsert_do_nothing_clause(&self, c: &[&str]) -> String
Emit a
DO NOTHING/insert-ignore clause for the conflict target.
Default empty (fallback dialects skip the single-statement path
entirely). PG/SQLite/DuckDB return ON CONFLICT (...) DO NOTHING;
MySQL returns ON DUPLICATE KEY UPDATE id = id (no-op self-assign). Read moreSource§fn returning_clause(&self, _cols: &str) -> String
fn returning_clause(&self, _cols: &str) -> String
Emit the clause (leading space included) that requests the given
columns be returned after an INSERT/UPDATE/DELETE. Postgres/SQLite/MySQL
emit
RETURNING cols; MSSQL emits OUTPUT INSERTED.cols.Source§fn insert_has_returning(&self) -> bool
fn insert_has_returning(&self) -> bool
Whether an INSERT statement can use the dialect’s returning clause to
retrieve inserted rows in-place.
Source§fn quote_ident(&self, i: &str) -> String
fn quote_ident(&self, i: &str) -> String
Quote a table/column identifier for safe interpolation.
Source§fn upsert_clause(&self, _c: &[&str], s: &str) -> String
fn upsert_clause(&self, _c: &[&str], s: &str) -> String
Emit the ON CONFLICT / ON DUPLICATE KEY clause (leading space
included) that converts an INSERT into an upsert. Read more
Source§fn supports_distinct_on(&self) -> bool
fn supports_distinct_on(&self) -> bool
Whether the dialect supports
SELECT DISTINCT ON (cols) (Postgres-only
among our backends today).Source§fn supports_sql_emission(&self) -> bool
fn supports_sql_emission(&self) -> bool
Whether this dialect supports SQL emission for upsert / nested-write
generation. Returns
false for document-store dialects (NotSql)
that unimplemented!() on quote_ident / placeholder /
upsert_clause. Callers must check this before issuing any SQL
via the dialect.Source§fn supports_upsert(&self) -> bool
fn supports_upsert(&self) -> bool
True if this dialect’s
upsert_clause can produce a usable
single-statement INSERT ... ON CONFLICT/ON DUPLICATE form, and
(separately) if placeholder and quote_ident are real
implementations. False for document-store/NotSql dialects whose
SQL-emitting methods are unimplemented!().Source§fn commit_sql(&self) -> &'static str
fn commit_sql(&self) -> &'static str
SQL keyword that commits a transaction. Defaults to
COMMIT.Source§fn rollback_sql(&self) -> &'static str
fn rollback_sql(&self) -> &'static str
SQL keyword that rolls back a transaction. Defaults to
ROLLBACK.Auto Trait Implementations§
impl Freeze for Mysql
impl RefUnwindSafe for Mysql
impl Send for Mysql
impl Sync for Mysql
impl Unpin for Mysql
impl UnsafeUnpin for Mysql
impl UnwindSafe for Mysql
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more