pub fn into_str(&self) -> String {
        match *self {
            Value::NULL => "NULL".to_owned(),
            Value::Bytes(ref x) => {
                String::from_utf8(x.clone()).ok().map_or_else(|| {
                    let mut s = "0x".to_owned();
                    for c in x.iter() {
                        s.extend(format!("{:02X}", *c).chars());
                    }
                    s
                }, |s: String| {
                    let replaced = s.replace("\x5c", "\x5c\x5c")
                                    .replace("\x00", "\x5c\x00")
                                    .replace("\n", "\x5c\n")
                                    .replace("\r", "\x5c\r")
                                    .replace("'", "\x5c'")
                                    .replace("\"", "\x5c\"")
                                    .replace("\x1a", "\x5c\x1a");
                    format!("'{}'", replaced)
                })
            },
            Value::Int(x) => format!("{}", x),
            Value::UInt(x) => format!("{}", x),
            Value::Float(x) => format!("{}", x),
            Value::Date(0, 0, 0, 0, 0, 0, 0) => "''".to_owned(),
            Value::Date(y, m, d, 0, 0, 0, 0) => format!("'{:04}-{:02}-{:02}'", y, m, d),
            Value::Date(y, m, d, h, i, s, 0) => format!("'{:04}-{:02}-{:02} {:02}:{:02}:{:02}'", y, m, d, h, i, s),
            Value::Date(y, m, d, h, i, s, u) => format!("'{:04}-{:02}-{:02} {:02}:{:02}:{:02}.{:06}'", y, m, d, h, i, s, u),
            Value::Time(_, 0, 0, 0, 0, 0) => "''".to_owned(),
            Value::Time(neg, d, h, i, s, 0) => {
                if neg {
                    format!("'-{:03}:{:02}:{:02}'", d * 24 + h as u32, i, s)
                } else {
                    format!("'{:03}:{:02}:{:02}'", d * 24 + h as u32, i, s)
                }
            },
            Value::Time(neg, d, h, i, s, u) => {
                if neg {
                    format!("'-{:03}:{:02}:{:02}.{:06}'",
                            d * 24 + h as u32, i, s, u)
                } else {
                    format!("'{:03}:{:02}:{:02}.{:06}'",
                            d * 24 + h as u32, i, s, u)
                }
            }
        }
    }
/// Get correct string representation of a mysql value
Get correct string representation of a mysql value
Get correct string representation of a mysql value
pub fn into_str(&self) -> String {
        match *self {
            Value::NULL => "NULL".to_owned(),
            Value::Bytes(ref x) => {
                String::from_utf8(x.clone()).ok().map_or_else(|| {
                    let mut s = "0x".to_owned();
                    for c in x.iter() {
                        s.extend(format!("{:02X}", *c).chars());
                    }
                    s
                }, |s: String| {
                    let replaced = s.replace("\x5c", "\x5c\x5c")
                                    .replace("\x00", "\x5c\x00")
                                    .replace("\n", "\x5c\n")
                                    .replace("\r", "\x5c\r")
                                    .replace("'", "\x5c'")
                                    .replace("\"", "\x5c\"")
                                    .replace("\x1a", "\x5c\x1a");
                    format!("'{}'", replaced)
                })
            },
            Value::Int(x) => format!("{}", x),
            Value::UInt(x) => format!("{}", x),
            Value::Float(x) => format!("{}", x),
            Value::Date(0, 0, 0, 0, 0, 0, 0) => "''".to_owned(),
            Value::Date(y, m, d, 0, 0, 0, 0) => format!("'{:04}-{:02}-{:02}'", y, m, d),
            Value::Date(y, m, d, h, i, s, 0) => format!("'{:04}-{:02}-{:02} {:02}:{:02}:{:02}'", y, m, d, h, i, s),
            Value::Date(y, m, d, h, i, s, u) => format!("'{:04}-{:02}-{:02} {:02}:{:02}:{:02}.{:06}'", y, m, d, h, i, s, u),
            Value::Time(_, 0, 0, 0, 0, 0) => "''".to_owned(),
            Value::Time(neg, d, h, i, s, 0) => {
                if neg {
                    format!("'-{:03}:{:02}:{:02}'", d * 24 + h as u32, i, s)
                } else {
                    format!("'{:03}:{:02}:{:02}'", d * 24 + h as u32, i, s)
                }
            },
            Value::Time(neg, d, h, i, s, u) => {
                if neg {
                    format!("'-{:03}:{:02}:{:02}.{:06}'",
                            d * 24 + h as u32, i, s, u)
                } else {
                    format!("'{:03}:{:02}:{:02}.{:06}'",
                            d * 24 + h as u32, i, s, u)
                }
            }
        }
    }
pub fn into_str ( & self ) -> String { match * self { Value :: NULL => " " . to_owned ( ) , Value :: Bytes ( ref x ) => { String :: from_utf8 ( x . clone ( ) ) . ok ( ) . map_or_else ( | | { let mut s = " " . to_owned ( ) ; for c in x . iter ( ) { s . extend ( format ! ( " " c ) . chars ( ) ) ; } s } , | s : String | { let replaced = s . replace ( " \x5c " , " \x5c \x5c " ) . replace ( " \x00 " , " \x5c \x00 " ) . replace ( " \n " , " \x5c \n " ) . replace ( " \r " , " \x5c \r " ) . replace ( " " , " \x5c " ) . replace ( " \" " , " \x5c \" " ) . replace ( " \x1a " , " \x5c \x1a " ) ; format ! ( " " replaced ) } ) } , Value :: Int ( x ) => format ! ( " " x ) , Value :: UInt ( x ) => format ! ( " " x ) , Value :: Float ( x ) => format ! ( " " x ) , Value :: Date ( 0 , 0 , 0 , 0 , 0 , 0 , 0 ) => " " . to_owned ( ) , Value :: Date ( y , m , d , 0 , 0 , 0 , 0 ) => format ! ( " " y m d ) , Value :: Date ( y , m , d , h , i , s , 0 ) => format ! ( " " y m d h i s ) , Value :: Date ( y , m , d , h , i , s , u ) => format ! ( " " y m d h i s u ) , Value :: Time ( _ , 0 , 0 , 0 , 0 , 0 ) => " " . to_owned ( ) , Value :: Time ( neg , d , h , i , s , 0 ) => { if neg { format ! ( " " d 24 h as u32 i s ) } else { format ! ( " " d 24 h as u32 i s ) } } , Value :: Time ( neg , d , h , i , s , u ) => { if neg { format ! ( " " d 24 h as u32 i s u ) } else { format ! ( " " d 24 h as u32 i s u ) } } } }
Get correct string representation of a mysql value
Get correct string representation of a mysql value
&self
&self