kubo/rust-oracle

Ability to check context

Opened this issue · 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?

kubo commented

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(()))
}

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