Skip to main content

MysqlConnection

Struct MysqlConnection 

Source
pub struct MysqlConnection { /* private fields */ }
Expand description

Wrapper around mysql::Conn providing interior mutability for the SqlConnection trait (which requires &self).

Implementations§

Source§

impl MysqlConnection

Source

pub fn new(conn: Conn) -> Self

Trait Implementations§

Source§

impl SqlConnection for MysqlConnection

Available on crate feature sql-mysql only.
Source§

fn query( &self, query_str: &str, params: &[Scalar], ) -> Result<SqlQueryResult, IoError>

Source§

fn execute_batch(&self, sql: &str) -> Result<(), IoError>

Source§

fn table_exists(&self, table_name: &str) -> Result<bool, IoError>

Source§

fn insert_rows( &self, insert_sql: &str, rows: &[Vec<Scalar>], ) -> Result<(), IoError>

Source§

fn dtype_sql(&self, dtype: DType) -> &'static str

Source§

fn index_dtype_sql(&self, index: &Index) -> &'static str

Source§

fn dialect_name(&self) -> &'static str

Short identifier for this backend’s SQL dialect. Read more
Source§

fn parameter_marker(&self, _ordinal: usize) -> String

Return the bind marker for the one-based parameter ordinal. Read more
Source§

fn supports_returning(&self) -> bool

Whether this backend honors INSERT ... RETURNING ... natively. Read more
Source§

fn max_param_count(&self) -> Option<usize>

Hard upper bound on bound-parameter count per statement, if known. Read more
Source§

fn max_identifier_length(&self) -> Option<usize>

Maximum identifier length supported by the backend, or None when no documented limit exists (or the limit is irrelevant for the deployment). Read more
Source§

fn quote_identifier(&self, ident: &str) -> Result<String, IoError>

Quote a SQL identifier (table name, column name, schema name) for safe inclusion in a generated statement. Read more
Source§

fn list_tables(&self, _schema: Option<&str>) -> Result<Vec<String>, IoError>

List user-visible table names, optionally scoped to schema. Read more
Source§

fn query_column_dtypes( &self, _query: &str, _params: &[Scalar], ) -> Result<Vec<Option<DType>>, IoError>

Return optional dtype hints for each result column in query. Read more
Source§

fn supports_paged_sql_chunks(&self) -> bool

Whether read_sql_chunks* may page this backend with a bounded LIMIT/OFFSET wrapper instead of materializing the whole result before the first chunk. Defaults to false so lightweight test doubles and custom backends keep the legacy behavior until they opt in.
Source§

fn with_transaction<T, F>(&self, f: F) -> Result<T, IoError>
where F: FnOnce(&Self) -> Result<T, IoError>, Self: Sized,

Run f inside a transaction. The default impl runs f without BEGIN/COMMIT — backends that support transactions should override to wrap in their native transaction primitive (rusqlite BEGIN, PostgreSQL BEGIN, MySQL START TRANSACTION, …). On Err from f, transactional backends roll back; on Ok they commit. Read more
Source§

fn supports_schemas(&self) -> bool

Whether this backend exposes multi-schema namespacing. Read more
Source§

fn default_schema(&self) -> Option<String>

Default schema for unqualified table references, if the backend has one. Read more
Source§

fn table_exists_in_schema( &self, table_name: &str, _schema: Option<&str>, ) -> Result<bool, IoError>

Schema-aware table-existence check. Read more
Source§

fn table_schema( &self, _table_name: &str, _schema: Option<&str>, ) -> Result<Option<SqlTableSchema>, IoError>

Introspect a table’s column metadata, optionally schema-scoped. Read more
Source§

fn list_schemas(&self) -> Result<Vec<String>, IoError>

List user-visible schemas (PostgreSQL “schemas”, MySQL “databases”). Read more
Source§

fn server_version(&self) -> Result<Option<String>, IoError>

Probe the backend server’s version string. Read more
Source§

fn list_views(&self, _schema: Option<&str>) -> Result<Vec<String>, IoError>

List user-visible view names, optionally scoped to schema. Read more
Source§

fn list_indexes( &self, _table_name: &str, _schema: Option<&str>, ) -> Result<Vec<SqlIndexSchema>, IoError>

List indexes defined on a table, optionally schema-scoped. Read more
Source§

fn list_unique_constraints( &self, _table_name: &str, _schema: Option<&str>, ) -> Result<Vec<SqlUniqueConstraintSchema>, IoError>

List UNIQUE constraints declared on a table (inline or table-level), excluding CREATE UNIQUE INDEX indexes (those land in list_indexes). Read more
Source§

fn table_comment( &self, _table_name: &str, _schema: Option<&str>, ) -> Result<Option<String>, IoError>

Probe the table-level comment, optionally schema-scoped. Read more
Source§

fn list_foreign_keys( &self, _table_name: &str, _schema: Option<&str>, ) -> Result<Vec<SqlForeignKeySchema>, IoError>

List foreign-key constraints declared on a table, optionally schema-scoped. Read more
Source§

fn primary_key_columns( &self, table_name: &str, schema: Option<&str>, ) -> Result<Vec<String>, IoError>

Return the primary-key column names for a table, ordered by the primary_key_ordinal reported by table_schema. Read more
Source§

fn truncate_table( &self, table_name: &str, schema: Option<&str>, ) -> Result<(), IoError>

Reset a table to empty without dropping its definition. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.