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
impl ConnectionManager
sourcepub fn new<P: IntoConnectParams>(p: P) -> HdbResult<Self>
pub fn new<P: IntoConnectParams>(p: P) -> HdbResult<Self>
Creates a new ConnectionManager
.
§Errors
HdbError::Usage
if not enough or inconsistent information was provided
sourcepub fn with_configuration<P: IntoConnectParams>(
p: P,
c: ConnectionConfiguration,
) -> HdbResult<Self>
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
impl Debug for ConnectionManager
source§impl ManageConnection for ConnectionManager
impl ManageConnection for ConnectionManager
§type Connection = Connection
type Connection = Connection
The connection type this manager deals with.
source§fn connect(&self) -> Result<Self::Connection, Self::Error>
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>
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
fn has_broken(&self, conn: &mut Self::Connection) -> bool
Quickly determines if the connection is no longer usable. Read more
Auto Trait Implementations§
impl Freeze for ConnectionManager
impl RefUnwindSafe for ConnectionManager
impl Send for ConnectionManager
impl Sync for ConnectionManager
impl Unpin for ConnectionManager
impl UnwindSafe for ConnectionManager
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
Mutably borrows from an owned value. Read more