pub struct SqlServerConnection { /* private fields */ }Implementations§
Source§impl SqlServerConnection
impl SqlServerConnection
Sourcepub async fn connect(config: &DatabaseConfig) -> Result<SqlServerConnection>
pub async fn connect(config: &DatabaseConfig) -> Result<SqlServerConnection>
Open a connection: pre-login, encryption, then login.
pub async fn connect_with( config: &DatabaseConfig, options: SqlServerOptions, ) -> Result<SqlServerConnection>
pub fn is_broken(&self) -> bool
Sourcepub fn in_transaction(&self) -> bool
pub fn in_transaction(&self) -> bool
True while a transaction is open, so the pool never hands back a connection that would leak one.
Sourcepub async fn simple_query(&mut self, sql: &str) -> Result<QueryResult>
pub async fn simple_query(&mut self, sql: &str) -> Result<QueryResult>
Run a statement with no parameters, as a batch.
Used for DDL and for transaction control, both of which have to run
outside sp_executesql — a begin transaction inside a procedure ends
when the procedure does.
Sourcepub async fn query(
&mut self,
sql: &str,
params: &[Value],
) -> Result<QueryResult>
pub async fn query( &mut self, sql: &str, params: &[Value], ) -> Result<QueryResult>
Run a statement through sp_executesql.
Every statement takes this route, parameters or not, because it is the route where a bound value is a value: the statement text and the parameter declarations are themselves arguments to a stored procedure, so nothing a caller binds is ever concatenated into SQL. A value cannot change the shape of a statement it was never part of.
Trait Implementations§
Source§impl DriverConnection for SqlServerConnection
impl DriverConnection for SqlServerConnection
Source§fn query<'a>(
&'a mut self,
sql: &'a str,
params: &'a [Value],
) -> BoxFuture<'a, Result<QueryResult>>
fn query<'a>( &'a mut self, sql: &'a str, params: &'a [Value], ) -> BoxFuture<'a, Result<QueryResult>>
Run a statement with bound parameters. Read more
Source§fn simple_query<'a>(
&'a mut self,
sql: &'a str,
) -> BoxFuture<'a, Result<QueryResult>>
fn simple_query<'a>( &'a mut self, sql: &'a str, ) -> BoxFuture<'a, Result<QueryResult>>
Run a statement with no parameters — DDL, and transaction control.
Source§fn is_broken(&self) -> bool
fn is_broken(&self) -> bool
Whether this connection is known to be unusable, so the pool discards it
instead of handing it to the next caller.
Source§fn in_transaction(&self) -> bool
fn in_transaction(&self) -> bool
Whether a transaction is still open. A connection left inside one must
never go back into rotation.
Auto Trait Implementations§
impl !Freeze for SqlServerConnection
impl !RefUnwindSafe for SqlServerConnection
impl !UnwindSafe for SqlServerConnection
impl Send for SqlServerConnection
impl Sync for SqlServerConnection
impl Unpin for SqlServerConnection
impl UnsafeUnpin for SqlServerConnection
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