pub struct MssqlConnection { /* private fields */ }Expand description
MSSQL connection backed by an actor thread that owns the ODBC connection.
Implementations§
Source§impl MssqlConnection
impl MssqlConnection
Sourcepub fn connect_blocking(
options: &MssqlConnectOptions,
) -> Result<MssqlConnection, MssqlError>
pub fn connect_blocking( options: &MssqlConnectOptions, ) -> Result<MssqlConnection, MssqlError>
Opens a blocking MSSQL ODBC connection with the provided options and spawns an actor thread to own it.
Sourcepub fn ping_blocking(&self) -> Result<(), Error>
pub fn ping_blocking(&self) -> Result<(), Error>
Executes a minimal connectivity query.
Sourcepub fn dbms_name(&self) -> Result<String, Error>
pub fn dbms_name(&self) -> Result<String, Error>
Returns the DBMS name reported by the ODBC driver.
Sourcepub fn prepare_blocking(&self, sql: SqlStr) -> Result<MssqlStatement, Error>
pub fn prepare_blocking(&self, sql: SqlStr) -> Result<MssqlStatement, Error>
Prepares a statement and returns the metadata reported by the ODBC driver.
Trait Implementations§
Source§impl<'c> Acquire<'c> for &'c mut MssqlConnection
impl<'c> Acquire<'c> for &'c mut MssqlConnection
type Database = Mssql
type Connection = &'c mut <Mssql as Database>::Connection
fn acquire( self, ) -> Pin<Box<dyn Future<Output = Result<<&'c mut MssqlConnection as Acquire<'c>>::Connection, Error>> + Send + 'c>>
fn begin( self, ) -> Pin<Box<dyn Future<Output = Result<Transaction<'c, Mssql>, Error>> + Send + 'c>>
Source§impl Connection for MssqlConnection
impl Connection for MssqlConnection
type Database = Mssql
type Options = MssqlConnectOptions
Source§async fn close(self) -> Result<(), Error>
async fn close(self) -> Result<(), Error>
Source§async fn ping(&mut self) -> Result<(), Error>
async fn ping(&mut self) -> Result<(), Error>
Source§fn begin(
&mut self,
) -> impl Future<Output = Result<Transaction<'_, <MssqlConnection as Connection>::Database>, Error>> + Send
fn begin( &mut self, ) -> impl Future<Output = Result<Transaction<'_, <MssqlConnection as Connection>::Database>, Error>> + Send
Source§fn shrink_buffers(&mut self)
fn shrink_buffers(&mut self)
Source§fn cached_statements_size(&self) -> usize
fn cached_statements_size(&self) -> usize
Source§async fn clear_cached_statements(&mut self) -> Result<(), Error>
async fn clear_cached_statements(&mut self) -> Result<(), Error>
Source§fn begin_with(
&mut self,
statement: impl SqlSafeStr,
) -> impl Future<Output = Result<Transaction<'_, Self::Database>, Error>> + Sendwhere
Self: Sized,
fn begin_with(
&mut self,
statement: impl SqlSafeStr,
) -> impl Future<Output = Result<Transaction<'_, Self::Database>, Error>> + Sendwhere
Self: Sized,
Source§fn is_in_transaction(&self) -> bool
fn is_in_transaction(&self) -> bool
true if the connection is currently in a transaction. Read moreSource§fn transaction<'a, F, R, E>(
&'a mut self,
callback: F,
) -> impl Future<Output = Result<R, E>> + Send + 'a
fn transaction<'a, F, R, E>( &'a mut self, callback: F, ) -> impl Future<Output = Result<R, E>> + Send + 'a
Source§impl Debug for MssqlConnection
impl Debug for MssqlConnection
Source§impl Drop for MssqlConnection
impl Drop for MssqlConnection
Source§impl<'c> Executor<'c> for &'c mut MssqlConnection
impl<'c> Executor<'c> for &'c mut MssqlConnection
type Database = Mssql
Source§fn fetch_many<'e, 'q, E>(
self,
query: E,
) -> Pin<Box<dyn Stream<Item = Result<Either<MssqlQueryResult, MssqlRow>, Error>> + Send + 'e>>
fn fetch_many<'e, 'q, E>( self, query: E, ) -> Pin<Box<dyn Stream<Item = Result<Either<MssqlQueryResult, MssqlRow>, Error>> + Send + 'e>>
Source§fn fetch_optional<'e, 'q, E>(
self,
query: E,
) -> Pin<Box<dyn Future<Output = Result<Option<MssqlRow>, Error>> + Send + 'e>>
fn fetch_optional<'e, 'q, E>( self, query: E, ) -> Pin<Box<dyn Future<Output = Result<Option<MssqlRow>, Error>> + Send + 'e>>
Source§fn prepare_with<'e>(
self,
sql: SqlStr,
_parameters: &[MssqlTypeInfo],
) -> Pin<Box<dyn Future<Output = Result<MssqlStatement, Error>> + Send + 'e>>where
'c: 'e,
fn prepare_with<'e>(
self,
sql: SqlStr,
_parameters: &[MssqlTypeInfo],
) -> Pin<Box<dyn Future<Output = Result<MssqlStatement, Error>> + Send + 'e>>where
'c: 'e,
Source§fn execute<'e, 'q, E>(
self,
query: E,
) -> Pin<Box<dyn Future<Output = Result<<Self::Database as Database>::QueryResult, Error>> + Send + 'e>>
fn execute<'e, 'q, E>( self, query: E, ) -> Pin<Box<dyn Future<Output = Result<<Self::Database as Database>::QueryResult, Error>> + Send + 'e>>
Source§fn execute_many<'e, 'q, E>(
self,
query: E,
) -> Pin<Box<dyn Stream<Item = Result<<Self::Database as Database>::QueryResult, Error>> + Send + 'e>>
fn execute_many<'e, 'q, E>( self, query: E, ) -> Pin<Box<dyn Stream<Item = Result<<Self::Database as Database>::QueryResult, Error>> + Send + 'e>>
Source§fn fetch<'e, 'q, E>(
self,
query: E,
) -> Pin<Box<dyn Stream<Item = Result<<Self::Database as Database>::Row, Error>> + Send + 'e>>
fn fetch<'e, 'q, E>( self, query: E, ) -> Pin<Box<dyn Stream<Item = Result<<Self::Database as Database>::Row, Error>> + Send + 'e>>
Source§fn fetch_all<'e, 'q, E>(
self,
query: E,
) -> Pin<Box<dyn Future<Output = Result<Vec<<Self::Database as Database>::Row>, Error>> + Send + 'e>>
fn fetch_all<'e, 'q, E>( self, query: E, ) -> Pin<Box<dyn Future<Output = Result<Vec<<Self::Database as Database>::Row>, Error>> + Send + 'e>>
Vec.Source§impl Migrate for MssqlConnection
impl Migrate for MssqlConnection
Source§fn create_schema_if_not_exists<'e>(
&'e mut self,
schema_name: &'e str,
) -> Pin<Box<dyn Future<Output = Result<(), MigrateError>> + Send + 'e>>
fn create_schema_if_not_exists<'e>( &'e mut self, schema_name: &'e str, ) -> Pin<Box<dyn Future<Output = Result<(), MigrateError>> + Send + 'e>>
MSSQL does not support CREATE SCHEMA IF NOT EXISTS as a single
statement, so we use a conditional T-SQL block.
Source§fn ensure_migrations_table<'e>(
&'e mut self,
table_name: &'e str,
) -> Pin<Box<dyn Future<Output = Result<(), MigrateError>> + Send + 'e>>
fn ensure_migrations_table<'e>( &'e mut self, table_name: &'e str, ) -> Pin<Box<dyn Future<Output = Result<(), MigrateError>> + Send + 'e>>
Creates the migrations tracking table if it does not yet exist.
Source§fn dirty_version<'e>(
&'e mut self,
_table_name: &'e str,
) -> Pin<Box<dyn Future<Output = Result<Option<i64>, MigrateError>> + Send + 'e>>
fn dirty_version<'e>( &'e mut self, _table_name: &'e str, ) -> Pin<Box<dyn Future<Output = Result<Option<i64>, MigrateError>> + Send + 'e>>
MSSQL supports transactional DDL, so a dirty (partially applied)
migration cannot occur. Always returns None.
Source§fn list_applied_migrations<'e>(
&'e mut self,
table_name: &'e str,
) -> Pin<Box<dyn Future<Output = Result<Vec<AppliedMigration>, MigrateError>> + Send + 'e>>
fn list_applied_migrations<'e>( &'e mut self, table_name: &'e str, ) -> Pin<Box<dyn Future<Output = Result<Vec<AppliedMigration>, MigrateError>> + Send + 'e>>
Lists all previously applied migrations, ordered by version.
Source§fn lock(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<(), MigrateError>> + Send + '_>>
fn lock( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), MigrateError>> + Send + '_>>
Acquires an exclusive application-level lock using sp_getapplock.
Source§fn unlock(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<(), MigrateError>> + Send + '_>>
fn unlock( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), MigrateError>> + Send + '_>>
Releases the application-level lock using sp_releaseapplock.
Source§fn apply<'e>(
&'e mut self,
_table_name: &'e str,
migration: &'e Migration,
) -> Pin<Box<dyn Future<Output = Result<Duration, MigrateError>> + Send + 'e>>
fn apply<'e>( &'e mut self, _table_name: &'e str, migration: &'e Migration, ) -> Pin<Box<dyn Future<Output = Result<Duration, MigrateError>> + Send + 'e>>
Applies a migration: executes the SQL, then records the migration in the tracking table.
Auto Trait Implementations§
impl !Freeze for MssqlConnection
impl RefUnwindSafe for MssqlConnection
impl Send for MssqlConnection
impl Sync for MssqlConnection
impl Unpin for MssqlConnection
impl UnsafeUnpin for MssqlConnection
impl UnwindSafe for MssqlConnection
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more