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 |