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>>,

source

pub fn connect(&self) -> Result<Connection<NativeFbClient<A>>, FbError>

Start a new connection from the fully-built builder

source

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,

source

pub fn user<S: Into<String>>(&mut self, user: S) -> &mut Self

Username. Default: SYSDBA

source

pub fn db_name<S: Into<String>>(&mut self, db_name: S) -> &mut Self

Database name or path. Default: test.fdb

source

pub fn dialect(&mut self, dialect: Dialect) -> &mut Self

SQL Dialect. Default: 3

source

pub fn charset(&mut self, charset: Charset) -> &mut Self

Connection charset. Default: UTF-8

source

pub fn stmt_cache_size(&mut self, stmt_cache_size: usize) -> &mut Self

Statement cache size. Default: 20

source

pub fn page_size(&mut self, size: u32) -> &mut Self

Database page size. Used on db creation. Default: depends on firebird version

source

pub fn role<S: Into<String>>(&mut self, name: S) -> &mut Self

User role name. Default: empty

source

pub fn transaction(&mut self, conf: TransactionConfiguration) -> &mut Self

Default transaction configuration

source

pub fn with_transaction<F>(&mut self, builder: F) -> &mut Self

Default transaction configuration builder

source

pub fn no_db_triggers(&mut self) -> &mut Self

Disabled the database triggers

source§

impl<A> NativeConnectionBuilder<A, ConnRemote>

source

pub fn host<S: Into<String>>(&mut self, host: S) -> &mut Self

Hostname or IP address of the server. Default: localhost

source

pub fn port(&mut self, port: u16) -> &mut Self

TCP Port of the server. Default: 3050

source

pub fn pass<S: Into<String>>(&mut self, pass: S) -> &mut Self

Password. Default: masterkey

source§

impl<A> NativeConnectionBuilder<A, ConnTypeNotConfigured>

source

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.

source

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>

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

source

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’.

source

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>

source§

fn clone(&self) -> NativeConnectionBuilder<LinkageType, ConnectionType>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<A> FirebirdClientFactory for NativeConnectionBuilder<DynLink, A>
where A: ConfiguredConnType,

§

type C = NativeFbClient<DynLink>

source§

fn new_instance(&self) -> Result<Self::C, FbError>

Construct a new instance of a client
source§

fn get_conn_conf(&self) -> &ConnectionConfiguration<NativeFbAttachmentConfig>

Pull the connection configuration details out as a borrow
source§

impl<A> FirebirdClientFactory for NativeConnectionBuilder<DynLoad, A>
where A: ConfiguredConnType,

§

type C = NativeFbClient<DynLoad>

source§

fn new_instance(&self) -> Result<Self::C, FbError>

Construct a new instance of a client
source§

fn get_conn_conf(&self) -> &ConnectionConfiguration<NativeFbAttachmentConfig>

Pull the connection configuration details out as a borrow
source§

impl<A, B> From<&NativeConnectionBuilder<A, B>> for ConnectionConfiguration<NativeFbAttachmentConfig>

source§

fn from(arg: &NativeConnectionBuilder<A, B>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<LinkageType, ConnectionType> !RefUnwindSafe for NativeConnectionBuilder<LinkageType, ConnectionType>

§

impl<LinkageType, ConnectionType> Send for NativeConnectionBuilder<LinkageType, ConnectionType>
where ConnectionType: Send, LinkageType: Send,

§

impl<LinkageType, ConnectionType> Sync for NativeConnectionBuilder<LinkageType, ConnectionType>
where ConnectionType: Sync, LinkageType: Sync,

§

impl<LinkageType, ConnectionType> Unpin for NativeConnectionBuilder<LinkageType, ConnectionType>
where ConnectionType: Unpin, LinkageType: Unpin,

§

impl<LinkageType, ConnectionType> !UnwindSafe for NativeConnectionBuilder<LinkageType, ConnectionType>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V