Struct rsfbclient::Connection
source · pub struct Connection<C: FirebirdClient> { /* private fields */ }
Expand description
A connection to a firebird database
Implementations§
source§impl<C: FirebirdClient> Connection<C>
impl<C: FirebirdClient> Connection<C>
sourcepub fn open(
cli: C,
conf: &ConnectionConfiguration<C::AttachmentConfig>,
) -> Result<Connection<C>, FbError>
pub fn open( cli: C, conf: &ConnectionConfiguration<C::AttachmentConfig>, ) -> Result<Connection<C>, FbError>
Open the client connection.
sourcepub fn create_database(
cli: C,
conf: &ConnectionConfiguration<C::AttachmentConfig>,
page_size: Option<u32>,
) -> Result<Connection<C>, FbError>
pub fn create_database( cli: C, conf: &ConnectionConfiguration<C::AttachmentConfig>, page_size: Option<u32>, ) -> Result<Connection<C>, FbError>
Create the database and start the client connection.
sourcepub fn drop_database(self) -> Result<(), FbError>
pub fn drop_database(self) -> Result<(), FbError>
Drop the current database
sourcepub fn with_transaction<T, F>(&mut self, closure: F) -> Result<T, FbError>
pub fn with_transaction<T, F>(&mut self, closure: F) -> Result<T, FbError>
Run a closure with a transaction, if the closure returns an error and the default transaction is not active, the transaction will rollback, else it will be committed
sourcepub fn with_transaction_config<T, F>(
&mut self,
confs: TransactionConfiguration,
closure: F,
) -> Result<T, FbError>
pub fn with_transaction_config<T, F>( &mut self, confs: TransactionConfiguration, closure: F, ) -> Result<T, FbError>
Run a closure with a transaction, if the closure returns an error and the default transaction is not active, the transaction will rollback, else it will be committed
sourcepub fn begin_transaction(&mut self) -> Result<(), FbError>
pub fn begin_transaction(&mut self) -> Result<(), FbError>
Begins a new transaction, and instructs all the query
and execute
methods
performed in the Connection
type to not automatically commit and rollback
until commit
or rollback
are called
sourcepub fn begin_transaction_config(
&mut self,
custom_confs: TransactionConfiguration,
) -> Result<(), FbError>
pub fn begin_transaction_config( &mut self, custom_confs: TransactionConfiguration, ) -> Result<(), FbError>
Begins a new transaction with a new transaction configuration, and instructs
all the query
and execute
methods performed in the Connection
type to
not automatically commit and rollback until commit
or rollback
are called
source§impl<C> Connection<C>where
C: FirebirdClientDbEvents + FirebirdClient,
impl<C> Connection<C>where
C: FirebirdClientDbEvents + FirebirdClient,
Trait Implementations§
source§impl<C: FirebirdClient> Drop for Connection<C>
impl<C: FirebirdClient> Drop for Connection<C>
source§impl<C> Execute for Connection<C>where
C: FirebirdClient,
impl<C> Execute for Connection<C>where
C: FirebirdClient,
source§fn execute<P>(&mut self, sql: &str, params: P) -> Result<usize, FbError>where
P: IntoParams,
fn execute<P>(&mut self, sql: &str, params: P) -> Result<usize, FbError>where
P: IntoParams,
source§fn execute_returnable<P, R>(
&mut self,
sql: &str,
params: P,
) -> Result<R, FbError>where
P: IntoParams,
R: FromRow + 'static,
fn execute_returnable<P, R>(
&mut self,
sql: &str,
params: P,
) -> Result<R, FbError>where
P: IntoParams,
R: FromRow + 'static,
source§impl From<Connection<NativeFbClient<DynLink>>> for SimpleConnection
impl From<Connection<NativeFbClient<DynLink>>> for SimpleConnection
source§fn from(conn: Connection<NativeFbClient<DynLink>>) -> Self
fn from(conn: Connection<NativeFbClient<DynLink>>) -> Self
source§impl From<Connection<NativeFbClient<DynLoad>>> for SimpleConnection
impl From<Connection<NativeFbClient<DynLoad>>> for SimpleConnection
source§fn from(conn: Connection<NativeFbClient<DynLoad>>) -> Self
fn from(conn: Connection<NativeFbClient<DynLoad>>) -> Self
source§impl From<Connection<RustFbClient>> for SimpleConnection
impl From<Connection<RustFbClient>> for SimpleConnection
source§fn from(conn: Connection<RustFbClient>) -> Self
fn from(conn: Connection<RustFbClient>) -> Self
source§impl<C> Queryable for Connection<C>where
C: FirebirdClient,
impl<C> Queryable for Connection<C>where
C: FirebirdClient,
source§fn query_iter<'a, P, R>(
&'a mut self,
sql: &str,
params: P,
) -> Result<Box<dyn Iterator<Item = Result<R, FbError>> + 'a>, FbError>where
P: IntoParams,
R: FromRow + 'static,
fn query_iter<'a, P, R>(
&'a mut self,
sql: &str,
params: P,
) -> Result<Box<dyn Iterator<Item = Result<R, FbError>> + 'a>, FbError>where
P: IntoParams,
R: FromRow + 'static,
source§fn query<P, R>(&mut self, sql: &str, params: P) -> Result<Vec<R>, FbError>where
P: IntoParams,
R: FromRow + 'static,
fn query<P, R>(&mut self, sql: &str, params: P) -> Result<Vec<R>, FbError>where
P: IntoParams,
R: FromRow + 'static,
Vec
Read more