[][src]Struct oracle::sql_type::Collection

pub struct Collection { /* fields omitted */ }

Oracle-specific collection data type

This type corresponds to varray and nested table data types. See Oracle manual.

let conn = Connection::connect("scott", "tiger", "")?;

// MDSYS.SDO_ELEM_INFO_ARRAY is defined as VARRAY (1048576) of NUMBER.
let objtype = conn.object_type("MDSYS.SDO_ELEM_INFO_ARRAY")?;

// Create a new collection
let mut obj = objtype.new_collection()?;
obj.push(&1);
obj.push(&3);
assert_eq!(obj.to_string(), "MDSYS.SDO_ELEM_INFO_ARRAY(1, 3)");

Note: Methods in the type may be changed in future.

Methods

impl Collection[src]

pub fn object_type(&self) -> &ObjectType[src]

Returns type information.

pub fn size(&self) -> Result<i32>[src]

Returns the number of elements.

This counts also deleted elements. See "Comments" about OCICollSize().

pub fn first_index(&self) -> Result<i32>[src]

Returns the first index.

Use this method if indexes of the collection isn't continuous.

pub fn last_index(&self) -> Result<i32>[src]

Returns the last index.

Use this method if indexes of the collection isn't continuous.

pub fn next_index(&self, index: i32) -> Result<i32>[src]

Returns the next index following the specified index.

Use this method if indexes of the collection isn't continuous.

pub fn prev_index(&self, index: i32) -> Result<i32>[src]

Returns the previous index following the specified index.

Use this method if indexes of the collection isn't continuous.

pub fn exist(&self, index: i32) -> Result<bool>[src]

Returns whether an element exists at the specified index.

pub fn get<T>(&self, index: i32) -> Result<T> where
    T: FromSql
[src]

Returns the value of the element at the specified index.

pub fn set(&mut self, index: i32, value: &dyn ToSql) -> Result<()>[src]

Sets the value to the element at the specified index.

pub fn push(&mut self, value: &dyn ToSql) -> Result<()>[src]

Appends an element to the end of the collection.

pub fn remove(&mut self, index: i32) -> Result<()>[src]

Remove the element at the specified index. Note that the position ordinals of the remaining elements are not changed. The operation creates holes in the collection.

pub fn trim(&mut self, len: usize) -> Result<()>[src]

Trims a number of elements from the end of a collection.

If the number of of elements to trim exceeds the current size of the collection an error is returned.

Trait Implementations

impl FromSql for Collection[src]

impl ToSql for Collection[src]

impl Drop for Collection[src]

impl Clone for Collection[src]

impl Debug for Collection[src]

impl Display for Collection[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

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

impl<T> ToString for T where
    T: Display + ?Sized
[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]

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

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