Struct rsfbclient::NativeConnectionBuilder
source · pub struct NativeConnectionBuilder<LinkageType, ConnectionType> { /* private fields */ }
Expand description
A builder for a client using the official (‘native’) Firebird dll.
Use the builder_native()
method to get a new builder instance, and the
provided configuration methods to change the default configuration params.
Note that one of with_remote()
/with_embedded()
and one of
with_dyn_link()
/with_dyn_load(...)
must be called in order to
enable creating a connection or calling other configuration methods.
Implementations§
source§impl<A, B> NativeConnectionBuilder<A, B>where
A: ConfiguredLinkage + LinkageMarker,
B: ConfiguredConnType,
Self: FirebirdClientFactory<C = NativeFbClient<A>>,
impl<A, B> NativeConnectionBuilder<A, B>where
A: ConfiguredLinkage + LinkageMarker,
B: ConfiguredConnType,
Self: FirebirdClientFactory<C = NativeFbClient<A>>,
sourcepub fn connect(&self) -> Result<Connection<NativeFbClient<A>>, FbError>
pub fn connect(&self) -> Result<Connection<NativeFbClient<A>>, FbError>
Start a new connection from the fully-built builder
sourcepub fn create_database(&self) -> Result<Connection<NativeFbClient<A>>, FbError>
pub fn create_database(&self) -> Result<Connection<NativeFbClient<A>>, FbError>
Create the database and start new connection from the fully-built builder
source§impl<A, B> NativeConnectionBuilder<A, B>where
A: ConfiguredLinkage,
B: ConfiguredConnType,
impl<A, B> NativeConnectionBuilder<A, B>where
A: ConfiguredLinkage,
B: ConfiguredConnType,
sourcepub fn db_name<S: Into<String>>(&mut self, db_name: S) -> &mut Self
pub fn db_name<S: Into<String>>(&mut self, db_name: S) -> &mut Self
Database name or path. Default: test.fdb
sourcepub fn stmt_cache_size(&mut self, stmt_cache_size: usize) -> &mut Self
pub fn stmt_cache_size(&mut self, stmt_cache_size: usize) -> &mut Self
Statement cache size. Default: 20
sourcepub fn page_size(&mut self, size: u32) -> &mut Self
pub fn page_size(&mut self, size: u32) -> &mut Self
Database page size. Used on db creation. Default: depends on firebird version
sourcepub fn transaction(&mut self, conf: TransactionConfiguration) -> &mut Self
pub fn transaction(&mut self, conf: TransactionConfiguration) -> &mut Self
Default transaction configuration
sourcepub fn with_transaction<F>(&mut self, builder: F) -> &mut Self
pub fn with_transaction<F>(&mut self, builder: F) -> &mut Self
Default transaction configuration builder
sourcepub fn no_db_triggers(&mut self) -> &mut Self
pub fn no_db_triggers(&mut self) -> &mut Self
Disabled the database triggers
source§impl<A> NativeConnectionBuilder<A, ConnRemote>
impl<A> NativeConnectionBuilder<A, ConnRemote>
source§impl<A> NativeConnectionBuilder<A, ConnTypeNotConfigured>
impl<A> NativeConnectionBuilder<A, ConnTypeNotConfigured>
sourcepub fn with_remote(self) -> NativeConnectionBuilder<A, ConnRemote>
pub fn with_remote(self) -> NativeConnectionBuilder<A, ConnRemote>
Configure the native client for remote connections. This will allow configuration via the ‘host’, ‘port’ and ‘pass’ methods.
sourcepub fn with_embedded(self) -> NativeConnectionBuilder<A, ConnEmbedded>
pub fn with_embedded(self) -> NativeConnectionBuilder<A, ConnEmbedded>
Configure the native client for embedded connections. There is no ‘host’, ‘port’ or ‘pass’ to configure on the result of this method and attempts to call those methods will result in a compile error.
Note that the embedded builder is only tested for firebird >=3.0. If the embedded connection fails, the client dll may attempt to use other means of connection automatically, such as XNET or localhost.
On firebird 3.0 and above this may be restricted via the Providers
config parameter of firebird.conf
see official firebird documentation
for more information.
source§impl<A> NativeConnectionBuilder<LinkageNotConfigured, A>
impl<A> NativeConnectionBuilder<LinkageNotConfigured, A>
sourcepub fn with_dyn_link(self) -> NativeConnectionBuilder<DynLink, A>
pub fn with_dyn_link(self) -> NativeConnectionBuilder<DynLink, A>
Uses the native client with dynamic linking. Requires that the dynamic library .dll/.so/.dylib can be found at compile time as well as runtime.
Requires feature linking
sourcepub fn with_dyn_load<S: Into<String>>(
self,
lib_path: S,
) -> NativeConnectionBuilder<DynLoad, A>
pub fn with_dyn_load<S: Into<String>>( self, lib_path: S, ) -> NativeConnectionBuilder<DynLoad, A>
Searches for the firebird client at runtime only, at the specified location.
§Example
// On windows
rsfbclient::builder_native()
.with_dyn_load("fbclient.dll")
.with_embedded();
// On linux
rsfbclient::builder_native()
.with_dyn_load("libfbclient.so")
.with_remote();
// Any platform, file located relative to the
// folder where the executable was run
rsfbclient::builder_native()
.with_dyn_load("./fbclient.lib")
.with_embedded();
Requires feature ‘dynamic_loading’.
sourcepub fn from_string(
self,
s_conn: &str,
) -> Result<NativeConnectionBuilder<DynByString, ConnByString>, FbError>
pub fn from_string( self, s_conn: &str, ) -> Result<NativeConnectionBuilder<DynByString, ConnByString>, FbError>
Setup the connection using the string pattern.
Basic string syntax: firebird://{user}:{pass}@{host}:{port}/{db_name}?charset={charset}&lib={fbclient}&dialect={dialect}
Some considerations:
- If you not provide the host, we will consider this a embedded connection.
- The port, user and pass parameters only will be accepted if you provide the host.
- If you not provide the
lib={fbclient}
, we will consider this a dynamic linked connection. The default, by the way.
Trait Implementations§
source§impl<LinkageType: Clone, ConnectionType: Clone> Clone for NativeConnectionBuilder<LinkageType, ConnectionType>
impl<LinkageType: Clone, ConnectionType: Clone> Clone for NativeConnectionBuilder<LinkageType, ConnectionType>
source§fn clone(&self) -> NativeConnectionBuilder<LinkageType, ConnectionType>
fn clone(&self) -> NativeConnectionBuilder<LinkageType, ConnectionType>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<A> FirebirdClientFactory for NativeConnectionBuilder<DynLink, A>where
A: ConfiguredConnType,
impl<A> FirebirdClientFactory for NativeConnectionBuilder<DynLink, A>where
A: ConfiguredConnType,
type C = NativeFbClient<DynLink>
source§fn get_conn_conf(&self) -> &ConnectionConfiguration<NativeFbAttachmentConfig>
fn get_conn_conf(&self) -> &ConnectionConfiguration<NativeFbAttachmentConfig>
source§impl<A> FirebirdClientFactory for NativeConnectionBuilder<DynLoad, A>where
A: ConfiguredConnType,
impl<A> FirebirdClientFactory for NativeConnectionBuilder<DynLoad, A>where
A: ConfiguredConnType,
type C = NativeFbClient<DynLoad>
source§fn get_conn_conf(&self) -> &ConnectionConfiguration<NativeFbAttachmentConfig>
fn get_conn_conf(&self) -> &ConnectionConfiguration<NativeFbAttachmentConfig>
source§impl<A, B> From<&NativeConnectionBuilder<A, B>> for ConnectionConfiguration<NativeFbAttachmentConfig>
impl<A, B> From<&NativeConnectionBuilder<A, B>> for ConnectionConfiguration<NativeFbAttachmentConfig>
source§fn from(arg: &NativeConnectionBuilder<A, B>) -> Self
fn from(arg: &NativeConnectionBuilder<A, B>) -> Self
Auto Trait Implementations§
impl<LinkageType, ConnectionType> Freeze for NativeConnectionBuilder<LinkageType, ConnectionType>
impl<LinkageType, ConnectionType> !RefUnwindSafe for NativeConnectionBuilder<LinkageType, ConnectionType>
impl<LinkageType, ConnectionType> Send for NativeConnectionBuilder<LinkageType, ConnectionType>
impl<LinkageType, ConnectionType> Sync for NativeConnectionBuilder<LinkageType, ConnectionType>
impl<LinkageType, ConnectionType> Unpin for NativeConnectionBuilder<LinkageType, ConnectionType>
impl<LinkageType, ConnectionType> !UnwindSafe for NativeConnectionBuilder<LinkageType, ConnectionType>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)