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

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

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

NULLBytes(Vec<u8>)Int(i64)UInt(u64)Float(f64)Date(u16u8u8u8u8u8u32)

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

Time(boolu32u8u8u8u32)

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

Methods

impl Value
[src]

fn into_str(&self) -> String

Get correct string representation of a mysql value

Trait Implementations

impl Debug for Value
[src]

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

Formats the value using the given formatter.

impl PartialOrd for Value
[src]

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

This method returns an ordering between self and other values if one exists. Read more

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

This method tests less than (for self and other) and is used by the < operator. Read more

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

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

This method tests greater than (for self and other) and is used by the > operator. Read more

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialEq for Value
[src]

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

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

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

This method tests for !=.

impl Clone for Value
[src]

fn clone(&self) -> Value

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl<'a, T: ToValue> From<&'a T> for Value
[src]

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

Performs the conversion.

impl<T: Into<Value>> From<Option<T>> for Value
[src]

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

Performs the conversion.

impl From<i8> for Value
[src]

fn from(x: i8) -> Value

Performs the conversion.

impl From<u8> for Value
[src]

fn from(x: u8) -> Value

Performs the conversion.

impl From<i16> for Value
[src]

fn from(x: i16) -> Value

Performs the conversion.

impl From<u16> for Value
[src]

fn from(x: u16) -> Value

Performs the conversion.

impl From<i32> for Value
[src]

fn from(x: i32) -> Value

Performs the conversion.

impl From<u32> for Value
[src]

fn from(x: u32) -> Value

Performs the conversion.

impl From<isize> for Value
[src]

fn from(x: isize) -> Value

Performs the conversion.

impl From<i64> for Value
[src]

fn from(x: i64) -> Value

Performs the conversion.

impl From<u64> for Value
[src]

fn from(x: u64) -> Value

Performs the conversion.

impl From<usize> for Value
[src]

fn from(x: usize) -> Value

Performs the conversion.

impl From<f32> for Value
[src]

fn from(x: f32) -> Value

Performs the conversion.

impl From<f64> for Value
[src]

fn from(x: f64) -> Value

Performs the conversion.

impl From<bool> for Value
[src]

fn from(x: bool) -> Value

Performs the conversion.

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

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

Performs the conversion.

impl From<Vec<u8>> for Value
[src]

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

Performs the conversion.

impl<'a> From<&'a str> for Value
[src]

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

Performs the conversion.

impl From<String> for Value
[src]

fn from(x: String) -> Value

Performs the conversion.

impl From<NaiveDateTime> for Value
[src]

fn from(x: NaiveDateTime) -> Value

Performs the conversion.

impl From<NaiveDate> for Value
[src]

fn from(x: NaiveDate) -> Value

Performs the conversion.

impl From<NaiveTime> for Value
[src]

fn from(x: NaiveTime) -> Value

Performs the conversion.

impl From<Timespec> for Value
[src]

fn from(x: Timespec) -> Value

Performs the conversion.

impl From<Duration> for Value
[src]

fn from(x: Duration) -> Value

Performs the conversion.

impl From<Duration> for Value
[src]

fn from(x: Duration) -> Value

Performs the conversion.

impl From<[u8; 0]> for Value
[src]

fn from(x: [u8; 0]) -> Value

Performs the conversion.

impl From<[u8; 1]> for Value
[src]

fn from(x: [u8; 1]) -> Value

Performs the conversion.

impl From<[u8; 2]> for Value
[src]

fn from(x: [u8; 2]) -> Value

Performs the conversion.

impl From<[u8; 3]> for Value
[src]

fn from(x: [u8; 3]) -> Value

Performs the conversion.

impl From<[u8; 4]> for Value
[src]

fn from(x: [u8; 4]) -> Value

Performs the conversion.

impl From<[u8; 5]> for Value
[src]

fn from(x: [u8; 5]) -> Value

Performs the conversion.

impl From<[u8; 6]> for Value
[src]

fn from(x: [u8; 6]) -> Value

Performs the conversion.

impl From<[u8; 7]> for Value
[src]

fn from(x: [u8; 7]) -> Value

Performs the conversion.

impl From<[u8; 8]> for Value
[src]

fn from(x: [u8; 8]) -> Value

Performs the conversion.

impl From<[u8; 9]> for Value
[src]

fn from(x: [u8; 9]) -> Value

Performs the conversion.

impl From<[u8; 10]> for Value
[src]

fn from(x: [u8; 10]) -> Value

Performs the conversion.

impl From<[u8; 11]> for Value
[src]

fn from(x: [u8; 11]) -> Value

Performs the conversion.

impl From<[u8; 12]> for Value
[src]

fn from(x: [u8; 12]) -> Value

Performs the conversion.

impl From<[u8; 13]> for Value
[src]

fn from(x: [u8; 13]) -> Value

Performs the conversion.

impl From<[u8; 14]> for Value
[src]

fn from(x: [u8; 14]) -> Value

Performs the conversion.

impl From<[u8; 15]> for Value
[src]

fn from(x: [u8; 15]) -> Value

Performs the conversion.

impl From<[u8; 16]> for Value
[src]

fn from(x: [u8; 16]) -> Value

Performs the conversion.

impl From<[u8; 17]> for Value
[src]

fn from(x: [u8; 17]) -> Value

Performs the conversion.

impl From<[u8; 18]> for Value
[src]

fn from(x: [u8; 18]) -> Value

Performs the conversion.

impl From<[u8; 19]> for Value
[src]

fn from(x: [u8; 19]) -> Value

Performs the conversion.

impl From<[u8; 20]> for Value
[src]

fn from(x: [u8; 20]) -> Value

Performs the conversion.

impl From<[u8; 21]> for Value
[src]

fn from(x: [u8; 21]) -> Value

Performs the conversion.

impl From<[u8; 22]> for Value
[src]

fn from(x: [u8; 22]) -> Value

Performs the conversion.

impl From<[u8; 23]> for Value
[src]

fn from(x: [u8; 23]) -> Value

Performs the conversion.

impl From<[u8; 24]> for Value
[src]

fn from(x: [u8; 24]) -> Value

Performs the conversion.

impl From<[u8; 25]> for Value
[src]

fn from(x: [u8; 25]) -> Value

Performs the conversion.

impl From<[u8; 26]> for Value
[src]

fn from(x: [u8; 26]) -> Value

Performs the conversion.

impl From<[u8; 27]> for Value
[src]

fn from(x: [u8; 27]) -> Value

Performs the conversion.

impl From<[u8; 28]> for Value
[src]

fn from(x: [u8; 28]) -> Value

Performs the conversion.

impl From<[u8; 29]> for Value
[src]

fn from(x: [u8; 29]) -> Value

Performs the conversion.

impl From<[u8; 30]> for Value
[src]

fn from(x: [u8; 30]) -> Value

Performs the conversion.

impl From<[u8; 31]> for Value
[src]

fn from(x: [u8; 31]) -> Value

Performs the conversion.

impl From<[u8; 32]> for Value
[src]

fn from(x: [u8; 32]) -> Value

Performs the conversion.

impl FromValue for Value
[src]

type Intermediate = ValueIr

fn from_value(v: Value) -> Value

Will panic if could not convert v to Self.

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

Will return Err(Error::FromValueError(v)) if could not convert v to Self.

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

Will return Err(Error::FromValueError(v)) if v is not convertible to Self.