|
1 | 1 | #[cfg(feature = "chrono")] |
2 | 2 | mod date_and_time; |
3 | 3 |
|
4 | | -use byteorder::{WriteBytesExt}; |
5 | | -use mysql::{Mysql, MysqlType, backend}; |
| 4 | +use mysql::{Mysql, MysqlType}; |
6 | 5 | use std::error::Error as StdError; |
7 | 6 | use std::io::Write; |
8 | | -use types::{ToSql, IsNull, FromSql, HasSqlType, Unsigned}; |
9 | | -use backend::Backend; |
| 7 | +use types::{ToSql, IsNull, FromSql, HasSqlType}; |
10 | 8 |
|
11 | 9 | impl ToSql<::types::Bool, Mysql> for bool { |
12 | 10 | fn to_sql<W: Write>(&self, out: &mut W) -> Result<IsNull, Box<StdError+Send+Sync>> { |
@@ -42,49 +40,3 @@ impl HasSqlType<::types::Timestamp> for Mysql { |
42 | 40 | MysqlType::Timestamp |
43 | 41 | } |
44 | 42 | } |
45 | | - |
46 | | -impl FromSql<Unsigned<::types::SmallInt>, Mysql> for u16 { |
47 | | - fn from_sql(bytes: Option<&[u8]>) -> Result<Self, Box<StdError+Send+Sync>> { |
48 | | - let value: i16 = FromSql::<::types::SmallInt, Mysql>::from_sql(bytes)?; |
49 | | - Ok(value as u16) |
50 | | - } |
51 | | -} |
52 | | - |
53 | | -impl ToSql<Unsigned<::types::SmallInt>, Mysql> for u16 { |
54 | | - fn to_sql<W: Write>(&self, out: &mut W) -> Result<IsNull, Box<StdError+Send+Sync>> { |
55 | | - out.write_u16::<<backend::Mysql as Backend>::ByteOrder>(*self) |
56 | | - .map(|_| IsNull::No) |
57 | | - .map_err(|e| Box::new(e) as Box<StdError+Send+Sync>) |
58 | | - } |
59 | | -} |
60 | | - |
61 | | -impl FromSql<Unsigned<::types::Integer>, Mysql> for u32 { |
62 | | - fn from_sql(bytes: Option<&[u8]>) -> Result<Self, Box<StdError+Send+Sync>> { |
63 | | - let value: i32 = FromSql::<::types::Integer, Mysql>::from_sql(bytes)?; |
64 | | - Ok(value as u32) |
65 | | - } |
66 | | -} |
67 | | - |
68 | | -impl ToSql<Unsigned<::types::Integer>, Mysql> for u32 { |
69 | | - fn to_sql<W: Write>(&self, out: &mut W) -> Result<IsNull, Box<StdError+Send+Sync>> { |
70 | | - out.write_u32::<<backend::Mysql as Backend>::ByteOrder>(*self) |
71 | | - .map(|_| IsNull::No) |
72 | | - .map_err(|e| Box::new(e) as Box<StdError+Send+Sync>) |
73 | | - } |
74 | | -} |
75 | | - |
76 | | -impl FromSql<Unsigned<::types::BigInt>, Mysql> for u64 { |
77 | | - fn from_sql(bytes: Option<&[u8]>) -> Result<Self, Box<StdError+Send+Sync>> { |
78 | | - let value: i64 = FromSql::<::types::BigInt, Mysql>::from_sql(bytes)?; |
79 | | - Ok(value as u64) |
80 | | - } |
81 | | -} |
82 | | - |
83 | | -impl ToSql<Unsigned<::types::BigInt>, Mysql> for u64 { |
84 | | - fn to_sql<W: Write>(&self, out: &mut W) -> Result<IsNull, Box<StdError+Send+Sync>> { |
85 | | - out.write_u64::<<backend::Mysql as Backend>::ByteOrder>(*self) |
86 | | - .map(|_| IsNull::No) |
87 | | - .map_err(|e| Box::new(e) as Box<StdError+Send+Sync>) |
88 | | - } |
89 | | -} |
90 | | - |
0 commit comments