Struct oracle::pool::PoolBuilder

source ·
pub struct PoolBuilder { /* private fields */ }
Expand description

A bulider to make a connection pool

Implementations§

source§

impl PoolBuilder

source

pub fn new<U, P, C>(username: U, password: P, connect_string: C) -> PoolBuilder
where U: Into<String>, P: Into<String>, C: Into<String>,

Creates a builder to make a connection pool.

source

pub fn min_connections(&mut self, num: u32) -> &mut PoolBuilder

Specifies the minimum number of connections to be created by the connection pool. This value is ignored if the pool type is PoolType::Heterogeneous. The default value is 1.

See also Pool::reconfigure.

source

pub fn max_connections(&mut self, num: u32) -> &mut PoolBuilder

Specifies the maximum number of connections that can be created by the connection pool. Values of 1 and higher are acceptable. The default value is 1.

See also Pool::reconfigure.

source

pub fn connection_increment(&mut self, num: u32) -> &mut PoolBuilder

Specifies the number of connections that will be created by the connection pool when more connections are required and the number of connection is less than the maximum allowed. This value is ignored if the pool type is PoolType::Heterogeneous. This value added to the PoolBuilder::min_connections value must not exceed the PoolBuilder::max_connections. The default value is 0.

See also Pool::reconfigure.

source

pub fn ping_interval( &mut self, dur: Option<Duration> ) -> Result<&mut PoolBuilder>

Specifies the length of time since a connection has last been used before a ping will be performed to verify that the connection is still valid. A None value disables this check. The default value is 60 seconds.

See also Pool::ping_interval and Pool::set_ping_interval.

source

pub fn ping_timeout(&mut self, dur: Duration) -> Result<&mut PoolBuilder>

Specifies the length of time to wait when performing a ping to verify the connection is still valid before the connection is considered invalid and is dropped. The default value is 5 seconds.

source

pub fn pool_type(&mut self, pool_type: PoolType) -> &mut PoolBuilder

Specifies whether the pool is homogeneous or heterogeneous. In a homogeneous pool all connections use the same credentials whereas in a heterogeneous pool other credentials are permitted. The default value is PoolType::Homogeneous.

source

pub fn external_auth(&mut self, b: bool) -> &mut PoolBuilder

Specifies whether external authentication should be used to create the connections in the pool. If this value is false, the user name and password values must be specified in the call to PoolBuilder::new; otherwise, the username and password values must be empty. The default value is false. External authentication cannot be used with homogeneous pools.

source

pub fn get_mode(&mut self, mode: GetMode) -> &mut PoolBuilder

Specifies the mode to use when connections are acquired from the pool. The default value is GetMode::NoWait.

See also Pool::get_mode and Pool::set_get_mode.

source

pub fn timeout(&mut self, dur: Duration) -> Result<&mut PoolBuilder>

Specifies the length of time after which idle connections in the pool are terminated. Note that termination only occurs when the pool is accessed. The default value is Duration::ZERO which means that no idle connections are terminated.

See also Pool::timeout and Pool::set_timeout.

source

pub fn max_lifetime_connection( &mut self, dur: Duration ) -> Result<&mut PoolBuilder>

Specifies the maximum length of time a pooled connection may exist. Connections in use will not be closed. They become candidates for termination only when they are released back to the pool and have existed for longer than max_lifetime_connection. Connection termination only occurs when the pool is accessed. The default value is Duration::ZERO which means that there is no maximum length of time that a pooled connection may exist.

See also Pool::max_lifetime_connection and Pool::set_max_lifetime_connection.

source

pub fn plsql_fixup_callback<T>(&mut self, plsql: T) -> &mut PoolBuilder
where T: Into<String>,

Specifies the name of a PL/SQL procedure in the format schema.package.callback_proc which will be called when a connection is checked out from the pool and the requested tag doesn’t match the actual tag assigned to the connection. The procedure accepts the desired and actual tags as parameters and it is the responsibility of the procedure to ensure that the connection matches the desired state upon completion. See the OCI documentation for more information. This functionality is only available when Oracle Client is at version 12.2 and higher.

source

pub fn max_connections_per_shard(&mut self, num: u32) -> &mut PoolBuilder

Specifies the maximum number of connections that can be created by the connection pool for each shard in a sharded database. Set this attribute to a value other than zero to ensure that the pool is balanced towards each shard. A value of zero will not set any maximum number of connections for each shard. If the Oracle client library version is less than 18.3, this value is ignored.

See also Pool::max_connections_per_shard and Pool::set_max_connections_per_shard.

source

pub fn events(&mut self, b: bool) -> &mut PoolBuilder

Reserved for when advanced queuing (AQ) or continuous query notification (CQN) is supported.

source

pub fn edition<S>(&mut self, edition: S) -> &mut PoolBuilder
where S: Into<String>,

Specifies edition of Edition-Based Redefinition.

source

pub fn driver_name<S>(&mut self, driver_name: S) -> &mut PoolBuilder
where S: Into<String>,

Sets the driver name displayed in V$SESSION_CONNECT_INFO.CLIENT_DRIVER.

The default value is “rust-oracle : version number”. Only the first 8 chracters “rust-ora” are displayed when the Oracle server version is lower than 12.0.1.2.

source

pub fn stmt_cache_size(&mut self, size: u32) -> &mut PoolBuilder

Specifies the number of statements to retain in the statement cache. Use a value of 0 to disable the statement cache completely. The default value is 20.

See also Pool::stmt_cache_size and Pool::set_stmt_cache_size.

source

pub fn build(&self) -> Result<Pool>

Make a connection pool

Trait Implementations§

source§

impl Clone for PoolBuilder

source§

fn clone(&self) -> PoolBuilder

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 Debug for PoolBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for PoolBuilder

source§

fn eq(&self, other: &PoolBuilder) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for PoolBuilder

Auto Trait Implementations§

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