rust-oracle icon indicating copy to clipboard operation
rust-oracle copied to clipboard

Ability to check context

Open tatref opened this issue 4 years ago • 2 comments

Hi,

It we would be great to be able to check if the context initialized successfully (I had issues with LD_LIBRARY_PATH). The problem arise at Connector::connect().unwrap() Is it possible to check if the context is properly created before attempting a connection?

It seems like the Context struct is private, but I may have missed something.

What do you think about it?

tatref avatar Jan 22 '20 13:01 tatref

Is it possible to check if the context is properly created before attempting a connection?

oracle::Version::client().unwrap() is available.

What do you think about it?

Thought what above code is available, it looks kludge. I may add the following function after I think of a proper function name.

/// Checks whether the Oracle client library was found successfully.
/// It returns `Ok(())` on success. It returns `Err(Error)` to report the error reason on failure.
pub fn fix_method_name() -> Result<()> {
    Context::get().and(Ok(()))
}

kubo avatar Jan 26 '20 11:01 kubo

I didn't know about the oracle::Version::client().unwrap() function, thanks for the tip!

tatref avatar Jan 26 '20 22:01 tatref