pub enum Value {
Show 15 variants
Null,
String(String),
Bytes(Vec<u8>),
Integer(i64),
Float(f64),
Number(OracleNumber),
Date(OracleDate),
Timestamp(OracleTimestamp),
RowId(RowId),
Boolean(bool),
Lob(LobValue),
Json(Value),
Vector(OracleVector),
Cursor(RefCursor),
Collection(DbObject),
}Expand description
Represents a value from an Oracle column.
This enum covers all the data types that can be returned from Oracle queries.
Values can be accessed using the various as_* methods, or converted using
TryFrom implementations.
§Example
use oracle_rs::Value;
fn process_value(value: &Value) {
match value {
Value::Null => println!("NULL"),
Value::String(s) => println!("String: {}", s),
Value::Integer(i) => println!("Integer: {}", i),
Value::Float(f) => println!("Float: {}", f),
_ => println!("Other type"),
}
}§Type Conversions
Values can be converted to Rust types using the accessor methods:
use oracle_rs::Value;
let value = Value::Integer(42);
let num: i64 = value.as_i64().unwrap();
assert_eq!(num, 42);Variants§
Null
NULL value
String(String)
String value (VARCHAR2, CHAR, CLOB as string)
Bytes(Vec<u8>)
Byte array (RAW, BLOB as bytes)
Integer(i64)
Integer value (NUMBER that fits in i64)
Float(f64)
Floating point value (NUMBER, BINARY_FLOAT, BINARY_DOUBLE)
Number(OracleNumber)
Oracle NUMBER as string (for full precision)
Date(OracleDate)
Date value
Timestamp(OracleTimestamp)
Timestamp value (with optional timezone)
RowId(RowId)
ROWID value
Boolean(bool)
Boolean value
Lob(LobValue)
LOB value (CLOB, BLOB, BFILE)
Json(Value)
JSON value (Oracle 21c+, stored as OSON binary format)
Vector(OracleVector)
Vector value (Oracle 23ai+, for AI/ML embeddings)
Cursor(RefCursor)
REF CURSOR value (SYS_REFCURSOR from PL/SQL) Contains cursor metadata that can be used for fetching rows
Collection(DbObject)
Collection value (VARRAY, Nested Table) Contains the collection type name and elements
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_date(&self) -> Option<&OracleDate>
pub fn as_date(&self) -> Option<&OracleDate>
Try to get as a date
Sourcepub fn as_timestamp(&self) -> Option<&OracleTimestamp>
pub fn as_timestamp(&self) -> Option<&OracleTimestamp>
Try to get as a timestamp
Sourcepub fn as_vector(&self) -> Option<&OracleVector>
pub fn as_vector(&self) -> Option<&OracleVector>
Try to get as a vector
Sourcepub fn as_cursor_id(&self) -> Option<u16>
pub fn as_cursor_id(&self) -> Option<u16>
Try to get cursor ID (for REF CURSOR)
Sourcepub fn as_collection(&self) -> Option<&DbObject>
pub fn as_collection(&self) -> Option<&DbObject>
Try to get as a collection (VARRAY, Nested Table)
Trait Implementations§
Source§impl From<OracleVector> for Value
impl From<OracleVector> for Value
Source§fn from(v: OracleVector) -> Self
fn from(v: OracleVector) -> Self
Auto Trait Implementations§
impl !Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)