[][src]Struct oracle::sql_type::ObjectType

pub struct ObjectType { /* fields omitted */ }

Type information about Object or Collection data type

This is for not only Object type information but also collection type information.

Examples

Gets MDSYS.SDO_GEOMETRY object type information.

let conn = Connection::connect("scott", "tiger", "")?;
let objtype = conn.object_type("MDSYS.SDO_GEOMETRY");

Gets object type infomration in query.

let conn = Connection::connect("scott", "tiger", "")?;
// conn.execute("create table location (name varchar2(60), loc sdo_geometry)", &[]);
let mut stmt = conn.prepare("select loc from location where name = '...'", &[])?;
let rows = stmt.query(&[])?;
let objtype = if let OracleType::Object(ref objtype) = *rows.column_info()[0].oracle_type() {
    objtype
} else {
    panic!("Not an object type")
};

Methods

impl ObjectType[src]

pub fn schema(&self) -> &str[src]

Gets schema name

pub fn name(&self) -> &str[src]

Gets object name

pub fn is_collection(&self) -> bool[src]

True when it is a collectoin. Otherwise false.

pub fn element_oracle_type(&self) -> Option<&OracleType>[src]

Gets the Oracle type of elements if it is a collection. Otherwise, None.

pub fn num_attributes(&self) -> usize[src]

Gets the number of attributes if it isn't a collection. Otherwise, 0.

pub fn attributes(&self) -> &[ObjectTypeAttr][src]

Gets a vector of attribute information if it isn't a collection. Otherwise, a zero-length vector.

Examples

Prints attribute information of MDSYS.SDO_GEOMETRY.

let conn = Connection::connect("scott", "tiger", "")?;
let objtype = conn.object_type("MDSYS.SDO_GEOMETRY")?;
for attr in objtype.attributes() {
    println!("{:-20} {}", attr.name(), attr.oracle_type());
}

pub fn new_object(&self) -> Result<Object>[src]

Create a new Oracle object.

pub fn new_collection(&self) -> Result<Collection>[src]

Create a new collection.

Trait Implementations

impl Clone for ObjectType[src]

impl PartialEq<ObjectType> for ObjectType[src]

impl Debug for ObjectType[src]

impl Display for ObjectType[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