Struct oracle::sql_type::Object

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

Oracle-specific object data type

let conn = Connection::connect("scott", "tiger", "")?;

// MDSYS.SDO_GEOMETRY
// https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-683FF8C5-A773-4018-932D-2AF6EC8BC119
let geom_type = conn.object_type("MDSYS.SDO_GEOMETRY")?;
let point_type = conn.object_type("MDSYS.SDO_POINT_TYPE")?;

// Create a new object
let mut obj = geom_type.new_object()?;
let mut point = point_type.new_object()?;
point.set("X", &-79)?;
point.set("Y", &37)?;
obj.set("SDO_GTYPE", &2001)?;
obj.set("SDO_POINT", &point)?;
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")?;
assert_eq!(gtype, 2001);

Note: Methods in the type may be changed in future.

Implementations§

source§

impl Object

source

pub fn object_type(&self) -> &ObjectType

Returns type information.

source

pub fn get<T>(&self, name: &str) -> Result<T>where
    T: FromSql,

Gets an value at the specified attribute.

source

pub fn set(&mut self, name: &str, value: &dyn ToSql) -> Result<()>

Sets the value to the specified attribute.

Trait Implementations§

source§

impl Clone for Object

source§

fn clone(&self) -> Object

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 Object

source§

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

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

impl Display for Object

source§

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

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

impl Drop for Object

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl FromSql for Object

source§

impl Payload for Object

§

type TypeInfo = ObjectType

source§

fn payload_type(payload_type: &Self::TypeInfo) -> Result<Option<ObjectType>>

source§

fn get(props: &MsgProps<Self>) -> Result<Object>

source§

fn set(&self, props: &mut MsgProps<Self>) -> Result<()>

source§

impl ToSql for Object

source§

fn oratype(&self, _conn: &Connection) -> Result<OracleType>

source§

fn to_sql(&self, val: &mut SqlValue) -> Result<()>

Auto Trait Implementations§

§

impl RefUnwindSafe for Object

§

impl !Send for Object

§

impl !Sync for Object

§

impl Unpin for Object

§

impl UnwindSafe for Object

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere
    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 Twhere
    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 Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.