Struct rsfbclient::Connection
source · [−]pub struct Connection<C: FirebirdClient> { /* private fields */ }
Expand description
A connection to a firebird database
Implementations
sourceimpl<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> where
F: FnOnce(&mut Transaction<'_, C>) -> Result<T, FbError>,
pub fn with_transaction<T, F>(&mut self, closure: F) -> Result<T, FbError> where
F: FnOnce(&mut Transaction<'_, C>) -> 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
Trait Implementations
sourceimpl<C: FirebirdClient> Drop for Connection<C>
impl<C: FirebirdClient> Drop for Connection<C>
sourceimpl<C> Execute for Connection<C> where
C: FirebirdClient,
impl<C> Execute for Connection<C> where
C: FirebirdClient,
sourcefn 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,
Execute a query, may or may not commit the changes and returns the affected rows count Read more
sourcefn 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,
Execute a query that will return data, like the ‘insert … returning ..’ or ‘execute procedure’. Read more
sourceimpl From<Connection<NativeFbClient<DynLink>>> for SimpleConnection
impl From<Connection<NativeFbClient<DynLink>>> for SimpleConnection
sourcefn from(conn: Connection<NativeFbClient<DynLink>>) -> Self
fn from(conn: Connection<NativeFbClient<DynLink>>) -> Self
Converts to this type from the input type.
sourceimpl From<Connection<NativeFbClient<DynLoad>>> for SimpleConnection
impl From<Connection<NativeFbClient<DynLoad>>> for SimpleConnection
sourcefn from(conn: Connection<NativeFbClient<DynLoad>>) -> Self
fn from(conn: Connection<NativeFbClient<DynLoad>>) -> Self
Converts to this type from the input type.
sourceimpl From<Connection<RustFbClient>> for SimpleConnection
impl From<Connection<RustFbClient>> for SimpleConnection
sourcefn from(conn: Connection<RustFbClient>) -> Self
fn from(conn: Connection<RustFbClient>) -> Self
Converts to this type from the input type.
sourceimpl<C> Queryable for Connection<C> where
C: FirebirdClient,
impl<C> Queryable for Connection<C> where
C: FirebirdClient,
sourcefn 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,
Returns the results of the query as an iterator. Read more
sourcefn 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,
Returns the results of the query as a Vec
Read more
sourcefn query_first<P, R>(
&mut self,
sql: &str,
params: P
) -> Result<Option<R>, FbError> where
P: IntoParams,
R: FromRow + 'static,
fn query_first<P, R>(
&mut self,
sql: &str,
params: P
) -> Result<Option<R>, FbError> where
P: IntoParams,
R: FromRow + 'static,
Returns the first result of the query, or None. Read more
sourceimpl TryFrom<SimpleConnection> for Connection<NativeFbClient<DynLink>>
impl TryFrom<SimpleConnection> for Connection<NativeFbClient<DynLink>>
sourceimpl TryFrom<SimpleConnection> for Connection<NativeFbClient<DynLoad>>
impl TryFrom<SimpleConnection> for Connection<NativeFbClient<DynLoad>>
sourceimpl TryFrom<SimpleConnection> for Connection<RustFbClient>
impl TryFrom<SimpleConnection> for Connection<RustFbClient>
Auto Trait Implementations
impl<C> RefUnwindSafe for Connection<C> where
C: RefUnwindSafe,
<C as FirebirdClientDbOps>::DbHandle: RefUnwindSafe,
<C as FirebirdClientSqlOps>::StmtHandle: RefUnwindSafe,
<C as FirebirdClientSqlOps>::TrHandle: RefUnwindSafe,
impl<C> Send for Connection<C>
impl<C> Sync for Connection<C> where
C: Sync,
<C as FirebirdClientDbOps>::DbHandle: Sync,
<C as FirebirdClientSqlOps>::StmtHandle: Sync,
<C as FirebirdClientSqlOps>::TrHandle: Sync,
impl<C> Unpin for Connection<C> where
C: Unpin,
<C as FirebirdClientDbOps>::DbHandle: Unpin,
<C as FirebirdClientSqlOps>::TrHandle: Unpin,
impl<C> UnwindSafe for Connection<C> where
C: UnwindSafe,
<C as FirebirdClientDbOps>::DbHandle: UnwindSafe,
<C as FirebirdClientSqlOps>::StmtHandle: RefUnwindSafe,
<C as FirebirdClientSqlOps>::TrHandle: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more