[][src]Struct sibyl::Environment

pub struct Environment { /* fields omitted */ }

Represents an OCI environment.

Methods

impl Environment[src]

pub fn get_cache_max_size(&self) -> Result<u32>[src]

Returns the maximum size (high watermark) for the client-side object cache as a percentage of the optimal size.

Example

use sibyl as oracle;

let oracle = oracle::env()?;
let max_size_percentage = oracle.get_cache_max_size()?;

assert_eq!(10, max_size_percentage);

pub fn set_cache_max_size(&self, size: u32) -> Result<()>[src]

Sets the maximum size (high watermark) for the client-side object cache as a percentage of the optimal size. Usually you can set the value at 10%, the default, of the optimal size. Setting this attribute to 0 results in a value of 10 being used. The object cache uses the maximum and optimal values for freeing unused memory in the object cache.

If the memory occupied by the objects currently in the cache reaches or exceeds the maximum cache size, the cache automatically begins to free (or ages out) unmarked objects that have a pin count of zero. The cache continues freeing such objects until memory usage in the cache reaches the optimal size, or until it runs out of objects eligible for freeing. Note that the cache can grow beyond the specified maximum cache size.

The maximum object cache size (in bytes) is computed by incrementing optimal_size by the max_size_percentage, using the following algorithm:

This example is not tested
maximum_cache_size = optimal_size + optimal_size * max_size_percentage / 100

Example

use sibyl as oracle;

let oracle = oracle::env()?;
oracle.set_cache_max_size(30)?;
let max_size_percentage = oracle.get_cache_max_size()?;

assert_eq!(30, max_size_percentage);

pub fn get_cache_opt_size(&self) -> Result<u32>[src]

Returns the optimal size for the client-side object cache in bytes.

Example

use sibyl as oracle;

let oracle = oracle::env()?;
let optimal_size = oracle.get_cache_opt_size()?;

assert_eq!(8*1024*1024, optimal_size);

pub fn set_cache_opt_size(&self, size: u32) -> Result<()>[src]

Sets the optimal size for the client-side object cache in bytes. The default value is 8 megabytes (MB). Setting this attribute to 0 results in a value of 8 MB being used.

Example

use sibyl as oracle;

let oracle = oracle::env()?;
oracle.set_cache_opt_size(64*1024*1024)?;
let optimal_size = oracle.get_cache_opt_size()?;

assert_eq!(64*1024*1024, optimal_size);

pub fn get_nls_language(&self) -> Result<String>[src]

Returns the name of the language used for the database sessions created in the current environment.

See Database Globalization Support Guide / Locale Data / Languages

Example

use sibyl as oracle;

let oracle = oracle::env()?;
let lang = oracle.get_nls_language()?;

assert_eq!("AMERICAN", lang);

pub fn set_nls_language(&self, lang: &str) -> Result<()>[src]

Sets the language used for the database sessions created in the current environment.

Example

use sibyl as oracle;

let oracle = oracle::env()?;
oracle.set_nls_language("ENGLISH")?;
let lang = oracle.get_nls_language()?;

assert_eq!("ENGLISH", lang);

pub fn get_nls_territory(&self) -> Result<String>[src]

Returns the name of the territory used for the database sessions created in the current environment.

See Database Globalization Support Guide / Locale Data / Territories

Example

use sibyl as oracle;

let oracle = oracle::env()?;
let lang = oracle.get_nls_territory()?;

assert_eq!("AMERICA", lang);

pub fn set_nls_territory(&self, territory: &str) -> Result<()>[src]

Sets the name of the territory used for the database sessions created in the current environment.

Example

use sibyl as oracle;

let oracle = oracle::env()?;
oracle.set_nls_territory("CANADA")?;
let lang = oracle.get_nls_territory()?;

assert_eq!("CANADA", lang);

pub fn connect(
    &self,
    dbname: &str,
    username: &str,
    password: &str
) -> Result<Connection>
[src]

Creates and begins a user session for a given server.

Example

use sibyl as oracle;

let oracle = oracle::env()?;
let dbname = std::env::var("DBNAME")?;
let dbuser = std::env::var("DBUSER")?;
let dbpass = std::env::var("DBPASS")?;
let conn = oracle.connect(&dbname, &dbuser, &dbpass)?;

assert!(!conn.is_async()?);
assert!(conn.is_connected()?);
assert!(conn.ping().is_ok());

let stmt = conn.prepare("
    SELECT DISTINCT client_driver
      FROM v$session_connect_info
     WHERE sid = SYS_CONTEXT('USERENV', 'SID')
")?;
let rows = stmt.query(&[])?;
let row = rows.next()?;
assert!(row.is_some());
let row = row.unwrap();
let client_driver = row.get::<&str>(0)?;
assert!(client_driver.is_some());
let client_driver = client_driver.unwrap();
assert_eq!(client_driver, "sibyl");

Trait Implementations

impl Env for Environment[src]

Auto Trait Implementations

impl !Send for Environment

impl !Sync for Environment

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]