Enum oci_rs::types::SqlValue[][src]

pub enum SqlValue {
    VarChar(String),
    Char(String),
    Integer(i64),
    Float(f64),
    Null,
    Date(Date<Utc>, [u8; 7]),
    Timestamp(DateTime<Utc>, [u8; 11]),
    TimestampTz(DateTime<FixedOffset>, [u8; 13]),
}

The types that support conversion from OCI to Rust types.

Variants

Anything specified as VARCHAR or VARCHAR2 will end up here.

Represents CHAR

All integers regardless of their stated size are represented with this variant. e.g. SMALLINT and INTEGER will both be held.

All floating point types regardless of their size are represented with this variant. e.g. REAL and FLOAT will both be held.

Represents null values in columns.

Represents a date

Represents a timestamp without time zone

Represents a timestamp with a time zone

Methods

impl SqlValue
[src]

Returns the internal value converting on the way to whichever type implements FromSqlValue.

It returns an Option because conversion might not be possible. For example converting an SqlValue::Integer to a String works just fine, but converting an SqlValue::Null to an i64 does not make sense.

Examples

use oci_rs::types::{SqlValue, ToSqlValue};

let v = SqlValue::Integer(42);
let i: i64 = v.value().expect("Won't convert to an i64");
let s: String = v.value().expect("Won't convert to a String");

assert_eq!(i, 42);
assert_eq!(s, "42");

let null = SqlValue::Null;
let null_as_i64: Option<i64> = null.value();

assert_eq!(null_as_i64, None);

Trait Implementations

impl Debug for SqlValue
[src]

Formats the value using the given formatter. Read more

impl PartialEq for SqlValue
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Clone for SqlValue
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for SqlValue

impl Sync for SqlValue