Struct oracle::sql_type::ObjectType

source ·
pub struct ObjectType { /* private fields */ }
Expand description

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
    .statement("select loc from location where name = '...'")
    .build()?;
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")
};

Implementations§

source§

impl ObjectType

source

pub fn schema(&self) -> &str

Gets schema name

source

pub fn name(&self) -> &str

Gets object name

source

pub fn package_name(&self) -> Option<&str>

Gets package name if it is a PL/SQL type. Otherwise, None.

source

pub fn is_collection(&self) -> bool

True when it is a collectoin. Otherwise false.

source

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

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

source

pub fn num_attributes(&self) -> usize

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

source

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

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

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

Create a new Oracle object.

source

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

Create a new collection.

Trait Implementations§

source§

impl Clone for ObjectType

source§

fn clone(&self) -> ObjectType

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ObjectType

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for ObjectType

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for ObjectType

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.