Struct oracle::Object
[−]
[src]
pub struct Object { /* fields omitted */ }
Oracle-specific object data type
let conn = Connection::connect("scott", "tiger", "", &[]).unwrap(); // MDSYS.SDO_GEOMETRY // https://docs.oracle.com/en/database/oracle/oracle-database/12.2/spatl/spatial-datatypes-metadata.html#GUID-683FF8C5-A773-4018-932D-2AF6EC8BC119 let geom_type = conn.object_type("MDSYS.SDO_GEOMETRY").unwrap(); let point_type = conn.object_type("MDSYS.SDO_POINT_TYPE").unwrap(); // Create a new object let mut obj = geom_type.new_object().unwrap(); let mut point = point_type.new_object().unwrap(); point.set("X", &-79).unwrap(); point.set("Y", &37).unwrap(); obj.set("SDO_GTYPE", &2001).unwrap(); obj.set("SDO_POINT", &point).unwrap(); assert_eq!(obj.to_string(), "MDSYS.SDO_GEOMETRY(2001, NULL, MDSYS.SDO_POINT_TYPE(-79, 37, NULL), NULL, NULL)"); // Gets an attribute value. let gtype: i32 = obj.get("SDO_GTYPE").unwrap(); assert_eq!(gtype, 2001);
Note: Methods in the type may be changed in future.
Methods
impl Object
[src]
pub fn object_type(&self) -> &ObjectType
[src]
Returns type information.
pub fn get<T>(&self, name: &str) -> Result<T> where
T: FromSql,
[src]
T: FromSql,
Gets an value at the specified attribute.
pub fn set(&mut self, name: &str, value: &ToSql) -> Result<()>
[src]
Sets the value to the specified attribute.
Trait Implementations
impl Clone for Object
[src]
fn clone(&self) -> Object
[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 Drop for Object
[src]
impl FromSql for Object
[src]
impl ToSql for Object
[src]
fn oratype(&self) -> Result<OracleType>
[src]
fn to_sql(&self, val: &mut SqlValue) -> Result<()>
[src]
impl Display for Object
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more