Struct ODBCConnection

Source
pub struct ODBCConnection<'a, AC: AutocommitMode>(/* private fields */);

Implementations§

Source§

impl<'a, AC: AutocommitMode> ODBCConnection<'a, AC>

Source

pub fn raw(&self) -> &Connection<'a, AC>

Examples found in repository?
examples/execute_query.rs (line 23)
18fn connect() -> Result<(), Box<dyn Error>> {
19    let manager = ODBCConnectionManager::new("DSN=dashdb;DATABASE=FOO;hostname=test@test.com;PORT=0000;UID=admin;PWD=admin;");
20    let pool = r2d2::Pool::new(manager).unwrap();
21    let pool = pool.clone();
22    let pool_conn = pool.get().unwrap();
23    let conn = pool_conn.raw();
24    execute_statement(&conn)
25}
More examples
Hide additional examples
examples/connect_pool.rs (line 15)
6fn main() {
7    let manager = ODBCConnectionManager::new("DSN=dashdb;DATABASE=FOO;hostname=test@test.com;PORT=0000;UID=admin;PWD=admin;");
8    let pool = r2d2::Pool::new(manager).unwrap();
9
10    let mut children = vec![];
11    for i in 0..10i32 {
12        let pool = pool.clone();
13        let pool_conn = pool.get().unwrap();
14        children.push(thread::spawn(move || {
15            let conn = pool_conn.raw();
16            let stmt = Statement::with_parent(&conn).unwrap();
17            if let Data(mut stmt) = stmt.exec_direct("select * from dbtest.GLWTACT").unwrap() {
18                while let Some(mut cursor) = stmt.fetch().unwrap() {
19                    if let Some(val) = cursor.get_data::<&str>(1).unwrap() {
20                        println!("THREAD {} {}", i, val);
21                    }
22                }
23            }
24        }));
25    }
26
27    for child in children {
28        let _ = child.join();
29    }
30}

Trait Implementations§

Auto Trait Implementations§

§

impl<'a, AC> Freeze for ODBCConnection<'a, AC>

§

impl<'a, AC> RefUnwindSafe for ODBCConnection<'a, AC>
where AC: RefUnwindSafe,

§

impl<'a, AC> !Send for ODBCConnection<'a, AC>

§

impl<'a, AC> !Sync for ODBCConnection<'a, AC>

§

impl<'a, AC> Unpin for ODBCConnection<'a, AC>
where AC: Unpin,

§

impl<'a, AC> UnwindSafe for ODBCConnection<'a, AC>
where AC: UnwindSafe,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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.