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
impl ObjectType
Sourcepub fn package_name(&self) -> Option<&str>
pub fn package_name(&self) -> Option<&str>
Gets package name if it is a PL/SQL type.
Otherwise, None
.
Sourcepub fn is_collection(&self) -> bool
pub fn is_collection(&self) -> bool
True when it is a collectoin. Otherwise false.
Sourcepub fn element_oracle_type(&self) -> Option<&OracleType>
pub fn element_oracle_type(&self) -> Option<&OracleType>
Gets the Oracle type of elements if it is a collection.
Otherwise, None
.
Sourcepub fn num_attributes(&self) -> usize
pub fn num_attributes(&self) -> usize
Gets the number of attributes if it isn’t a collection. Otherwise, 0.
Sourcepub fn attributes(&self) -> &[ObjectTypeAttr]
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());
}
Sourcepub fn new_object(&self) -> Result<Object>
pub fn new_object(&self) -> Result<Object>
Create a new Oracle object.
Sourcepub fn new_collection(&self) -> Result<Collection>
pub fn new_collection(&self) -> Result<Collection>
Create a new collection.
Trait Implementations§
Source§impl Clone for ObjectType
impl Clone for ObjectType
Source§fn clone(&self) -> ObjectType
fn clone(&self) -> ObjectType
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ObjectType
impl Debug for ObjectType
Source§impl Display for ObjectType
impl Display for ObjectType
Source§impl PartialEq for ObjectType
impl PartialEq for ObjectType
Auto Trait Implementations§
impl Freeze for ObjectType
impl RefUnwindSafe for ObjectType
impl Send for ObjectType
impl Sync for ObjectType
impl Unpin for ObjectType
impl UnwindSafe for ObjectType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more