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

pub enum SqlValue {
    VarChar(String),
    Integer(i64),
    Float(f64),
    Null,
}

The types that support conversion from OCI to Rust types.

Variants

Anything specified as VARCHAR or VARCHAR2 will end up here.

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.

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 covert 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.

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 !=.