Skip to main content

QueryValue

Enum QueryValue 

Source
#[non_exhaustive]
pub enum QueryValue {
Show 17 variants Text(String), TextRaw { bytes: Vec<u8>, csfrm: u8, }, Raw(Vec<u8>), Rowid(String), BinaryDouble(String), IntervalDS { days: i32, hours: i32, minutes: i32, seconds: i32, fseconds: i32, }, IntervalYM { years: i32, months: i32, }, Number(OracleNumber), Boolean(bool), Cursor(Box<CursorValue>), DateTime { year: i32, month: u8, day: u8, hour: u8, minute: u8, second: u8, nanosecond: u32, }, TimestampTz { year: i32, month: u8, day: u8, hour: u8, minute: u8, second: u8, nanosecond: u32, offset_minutes: i32, }, Object(Box<ObjectValue>), Lob(Box<LobValue>), Vector(Box<Vector>), Json(Box<OsonValue>), Array(Vec<Option<QueryValue>>),
}

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Text(String)

§

TextRaw

Character data that could not be decoded as valid text; the raw bytes are preserved so the caller can apply an encoding_errors policy.

Fields

§bytes: Vec<u8>
§csfrm: u8
§

Raw(Vec<u8>)

§

Rowid(String)

§

BinaryDouble(String)

§

IntervalDS

Fields

§days: i32
§hours: i32
§minutes: i32
§seconds: i32
§fseconds: i32
§

IntervalYM

Fields

§years: i32
§months: i32
§

Number(OracleNumber)

Oracle NUMBER / BINARY_INTEGER. The lossless decimal value is carried inline as a { coefficient: i128, scale: i16 } form (no per-cell heap allocation for the common case), with a boxed text fallback for the rare value that does not fit inline. See OracleNumber.

§

Boolean(bool)

Native Oracle DB_TYPE_BOOLEAN (ora_type_num 252, 23ai+): surfaced as a Python bool rather than an integer.

§

Cursor(Box<CursorValue>)

REF CURSOR (cold): payload boxed, see CursorValue.

§

DateTime

Fields

§year: i32
§month: u8
§day: u8
§hour: u8
§minute: u8
§second: u8
§nanosecond: u32
§

TimestampTz

Fields

§year: i32
§month: u8
§day: u8
§hour: u8
§minute: u8
§second: u8
§nanosecond: u32
§offset_minutes: i32
§

Object(Box<ObjectValue>)

ADT / collection image (cold): payload boxed, see ObjectValue.

§

Lob(Box<LobValue>)

LOB / BFILE locator (cold): payload boxed, see LobValue.

§

Vector(Box<Vector>)

VECTOR (cold): the per-element data is boxed out of the hot enum.

§

Json(Box<OsonValue>)

Native Oracle JSON (DB_TYPE_JSON, ora_type_num 119): the OSON image is decoded eagerly into the lossless crate::oson::OsonValue tree (cold): the tree is boxed out of the hot enum.

§

Array(Vec<Option<QueryValue>>)

Implementations§

Source§

impl QueryValue

Source

pub fn number_from_text(text: &str, is_integer: bool) -> Self

Construct a NUMBER value from already-canonical decimal text and an explicit is_integer flag. Convenience for binds / tests that hold the canonical text; folds into the inline form when it fits. The text MUST be canonical Oracle NUMBER text (the form the decoder emits).

Source

pub fn as_text(&self) -> Option<&str>

Borrow this value as decoded text when it is a VARCHAR2 / CHAR / NVARCHAR2 / CLOB-inlined string, otherwise None. Convenience accessor for callers that want to avoid matching the full enum.

Source

pub fn as_i64(&self) -> Option<i64>

Interpret this value as a 64-bit integer. Works for NUMBER values whose canonical text parses as an i64, and for the native DB_TYPE_BOOLEAN (true -> 1, false -> 0). Returns None for any other variant, or a NUMBER that does not fit / is not integral.

Source

pub fn as_f64(&self) -> Option<f64>

Interpret this value as an f64. Works for NUMBER, BINARY_DOUBLE and BINARY_FLOAT (all carried as canonical text), otherwise None.

Source

pub fn as_number_text(&self) -> Option<Cow<'_, str>>

The canonical decimal text of a NUMBER value (lossless, arbitrary precision), otherwise None. The owned inline form synthesizes the text on demand via the shared formatter, so this returns an owned Cow.

Source

pub fn as_number(&self) -> Option<&OracleNumber>

Borrow the inline NUMBER representation, otherwise None.

Source

pub fn as_bool(&self) -> Option<bool>

Return the boolean of a native DB_TYPE_BOOLEAN value, otherwise None.

Source

pub fn as_raw(&self) -> Option<&[u8]>

Borrow the bytes of a RAW value, otherwise None.

Source

pub fn as_rowid(&self) -> Option<&str>

Borrow the encoded text of a ROWID / UROWID value, otherwise None.

Source

pub fn variant_name(&self) -> &'static str

A short, stable name for this value’s variant (e.g. "Text", "Number"). Lets callers identify a fetched cell’s shape for logging / diagnostics without an exhaustive match that would break the moment a variant is added. The match lives inside the defining crate, so it stays the single exhaustiveness tripwire that flags a new variant at compile time.

Trait Implementations§

Source§

impl Clone for QueryValue

Source§

fn clone(&self) -> QueryValue

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for QueryValue

Source§

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

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

impl PartialEq for QueryValue

Source§

fn eq(&self, other: &QueryValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for QueryValue

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V