[−][src]Struct r2d2_odbc::ODBCConnectionManager
Methods
impl ODBCConnectionManager
[src]
pub fn new<S: Into<String>>(connection_string: S) -> ODBCConnectionManager
[src]
Creates a new ODBCConnectionManager
.
Trait Implementations
impl Debug for ODBCConnectionManager
[src]
impl ManageConnection for ODBCConnectionManager
[src]
An r2d2::ManageConnection
for ODBC connections.
Example
extern crate r2d2; extern crate r2d2_odbc; extern crate odbc; use std::thread; use r2d2_odbc::ODBCConnectionManager; use odbc::*; fn main() { let manager = ODBCConnectionManager::new("DSN=PostgreSQL"); let pool = r2d2::Pool::new(manager).unwrap(); let mut children = vec![]; for i in 0..10i32 { let pool = pool.clone(); children.push(thread::spawn(move || { let pool_conn = pool.get().unwrap(); let conn = pool_conn.raw(); let stmt = Statement::with_parent(&conn).unwrap(); if let Data(mut stmt) = stmt.exec_direct("SELECT version()").unwrap() { while let Some(mut cursor) = stmt.fetch().unwrap() { if let Some(val) = cursor.get_data::<&str>(0).unwrap() { print!("THREAD {} {}", i, val); } } } })); } for child in children { let _ = child.join(); } }
type Connection = ODBCConnection<'static, AutocommitOn>
The connection type this manager deals with.
type Error = ODBCError
The error type returned by Connection
s.
fn connect(&self) -> Result<Self::Connection, Self::Error>
[src]
fn is_valid(&self, _conn: &mut Self::Connection) -> Result<(), Self::Error>
[src]
fn has_broken(&self, _conn: &mut Self::Connection) -> bool
[src]
Auto Trait Implementations
impl RefUnwindSafe for ODBCConnectionManager
impl Send for ODBCConnectionManager
impl Sync for ODBCConnectionManager
impl Unpin for ODBCConnectionManager
impl UnwindSafe for ODBCConnectionManager
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,