Struct oracle::ObjectType
[−]
[src]
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]
fn clone(&self) -> ObjectType
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for ObjectType
[src]
fn eq(&self, other: &Self) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Display for ObjectType
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more