Struct 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 FromSql for Object

Source§

impl Payload for Object

Available on crate feature aq_unstable only.
Source§

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 Freeze for Object

§

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 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> RowValue for T
where T: FromSql,

Source§

fn get(row: &Row) -> Result<T, Error>

Source§

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

Source§

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§

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>,

Source§

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>,

Source§

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.