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 Into<Value> for it.

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

let result = conn.prep_exec("SELECT ? * ?", (20i32, 0.8_f32)).unwrap();
for row in result {
    let c = from_row::<f32>(row.unwrap());
    assert_eq!(c, 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<'a, T: ToValue> From<&'a T> for Value

fn from(x: &'a T) -> Value

impl<T: Into<Value>> From<Option<T>> for Value

fn from(x: Option<T>) -> Value

impl From<i8> for Value

fn from(x: i8) -> Value

impl From<u8> for Value

fn from(x: u8) -> Value

impl From<i16> for Value

fn from(x: i16) -> Value

impl From<u16> for Value

fn from(x: u16) -> Value

impl From<i32> for Value

fn from(x: i32) -> Value

impl From<u32> for Value

fn from(x: u32) -> Value

impl From<isize> for Value

fn from(x: isize) -> Value

impl From<i64> for Value

fn from(x: i64) -> Value

impl From<u64> for Value

fn from(x: u64) -> Value

impl From<usize> for Value

fn from(x: usize) -> Value

impl From<f32> for Value

fn from(x: f32) -> Value

impl From<f64> for Value

fn from(x: f64) -> Value

impl From<bool> for Value

fn from(x: bool) -> Value

impl<'a> From<&'a [u8]> for Value

fn from(x: &'a [u8]) -> Value

impl From<Vec<u8>> for Value

fn from(x: Vec<u8>) -> Value

impl<'a> From<&'a str> for Value

fn from(x: &'a str) -> Value

impl From<String> for Value

fn from(x: String) -> Value

impl From<NaiveDateTime> for Value

fn from(x: NaiveDateTime) -> Value

impl From<NaiveDate> for Value

fn from(x: NaiveDate) -> Value

impl From<NaiveTime> for Value

fn from(x: NaiveTime) -> Value

impl From<Timespec> for Value

fn from(x: Timespec) -> Value

impl From<Duration> for Value

fn from(x: Duration) -> Value

impl From<Duration> for Value

fn from(x: Duration) -> Value

impl FromValue for Value

type Intermediate = ValueIr

fn from_value(v: Value) -> Value

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

fn get_intermediate(v: Value) -> MyResult<Self::Intermediate>

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)