Enum mysql::value::Value [] [src]

pub enum Value {
    NULL,
    Bytes(Vec<u8>),
    Int(i64),
    UInt(u64),
    Float(f64),
    Date(u16, u8, u8, u8, u8, u8, u32),
    Time(bool, u32, u8, u8, u8, u32),
}

Value enumerates possible values in mysql cells. Also Value used to fill prepared statements.

Note that to receive something different than Value::NULL or Value::Bytes from mysql you should use prepared statements.

If you want to get something more useful from Value you should implement FromValue on it. To get T: FromValue from nullable value you should rely on FromValue implemented on Option<T>.

To convert something to Value you should implement IntoValue on it.

use mysql::value::from_value;
let mut conn = pool.get_conn().unwrap();

let result = conn.prep_exec("SELECT ? * ?", (20i32, 0.8_f32)).unwrap();
for row in result {
    let mut row = row.unwrap();
    assert_eq!(from_value::<f32>(row.pop().unwrap()), 16.0_f32);
}

Variants

NULL
Bytes
Int
UInt
Float
Date

year, month, day, hour, minutes, seconds, micro seconds

Time

is negative, days, hours, minutes, seconds, micro seconds

Methods

impl Value

fn into_str(&self) -> String

Get correct string representation of a mysql value

Trait Implementations

impl IntoValue for Value

fn into_value(self) -> Value

impl FromValue for Value

fn from_value(v: Value) -> Value

fn from_value_opt(v: Value) -> Option<Value>

Derived Implementations

impl Debug for Value

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl PartialOrd for Value

fn partial_cmp(&self, __arg_0: &Value) -> Option<Ordering>

fn lt(&self, __arg_0: &Value) -> bool

fn le(&self, __arg_0: &Value) -> bool

fn gt(&self, __arg_0: &Value) -> bool

fn ge(&self, __arg_0: &Value) -> bool

impl PartialEq for Value

fn eq(&self, __arg_0: &Value) -> bool

fn ne(&self, __arg_0: &Value) -> bool

impl Clone for Value

fn clone(&self) -> Value

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