Struct hdbconnect::ConnectionManager

source ·
pub struct ConnectionManager { /* private fields */ }
Available on crate feature r2d2_pool only.
Expand description

Implementation of r2d2’s ManageConnection.

§Example

use hdbconnect::{
    ConnectionConfiguration, ConnectParams, ConnectionManager, IntoConnectParamsBuilder
};

let pool = r2d2::Pool::builder()
    .max_size(15)
    .build(ConnectionManager::with_configuration(
        "hdbsql://abcd123:2222"
            .into_connect_params_builder()?
            .with_dbuser("MEIER")
            .with_password("schlau"),
        ConnectionConfiguration::default().with_auto_commit(false),
    )?).unwrap();

let conn = pool.get().unwrap();
conn.query("select 1 from dummy")?;

Implementations§

source§

impl ConnectionManager

source

pub fn new<P: IntoConnectParams>(p: P) -> HdbResult<Self>

Creates a new ConnectionManager.

§Errors

HdbError::Usage if not enough or inconsistent information was provided

source

pub fn with_configuration<P: IntoConnectParams>( p: P, c: ConnectionConfiguration, ) -> HdbResult<Self>

Creates a new ConnectionManager with provided configuration.

§Errors

HdbError::Usage if not enough or inconsistent information was provided

Trait Implementations§

source§

impl Debug for ConnectionManager

source§

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

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

impl ManageConnection for ConnectionManager

§

type Connection = Connection

The connection type this manager deals with.
§

type Error = HdbError

The error type returned by Connections.
source§

fn connect(&self) -> Result<Self::Connection, Self::Error>

Attempts to create a new connection.
source§

fn is_valid(&self, conn: &mut Self::Connection) -> Result<(), Self::Error>

Determines if the connection is still connected to the database. Read more
source§

fn has_broken(&self, conn: &mut Self::Connection) -> bool

Quickly determines if the connection is no longer usable. Read more

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> Same for T

§

type Output = T

Should always be Self
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.
source§

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

source§

fn vzip(self) -> V

source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T