File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ pub(super) struct ToSqlHelper {
12
12
fn to_value ( ( metadata, bind) : ( MysqlType , Option < Vec < u8 > > ) ) -> Value {
13
13
match bind {
14
14
Some ( bind) => match metadata {
15
- MysqlType :: Tiny => Value :: Int ( bind[ 0 ] as _ ) ,
15
+ MysqlType :: Tiny => Value :: Int ( ( bind[ 0 ] as i8 ) as i64 ) ,
16
16
MysqlType :: Short => Value :: Int ( i16:: from_ne_bytes ( bind. try_into ( ) . unwrap ( ) ) as _ ) ,
17
17
MysqlType :: Long => Value :: Int ( i32:: from_ne_bytes ( bind. try_into ( ) . unwrap ( ) ) as _ ) ,
18
18
MysqlType :: LongLong => Value :: Int ( i64:: from_ne_bytes ( bind. try_into ( ) . unwrap ( ) ) ) ,
Original file line number Diff line number Diff line change @@ -67,6 +67,14 @@ async fn check_tiny_int() {
67
67
type_check :: < _ , sql_types:: TinyInt > ( conn, -1_i8 ) . await ;
68
68
type_check :: < _ , sql_types:: TinyInt > ( conn, i8:: MIN ) . await ;
69
69
type_check :: < _ , sql_types:: TinyInt > ( conn, i8:: MAX ) . await ;
70
+
71
+ // test case for https://github.com/weiznich/diesel_async/issues/91
72
+ let res = diesel:: dsl:: sql :: < diesel:: sql_types:: Bool > ( "SELECT -1 = " )
73
+ . bind :: < sql_types:: TinyInt , _ > ( -1 )
74
+ . get_result :: < bool > ( conn)
75
+ . await
76
+ . unwrap ( ) ;
77
+ assert ! ( res) ;
70
78
}
71
79
72
80
#[ cfg( feature = "mysql" ) ]
You can’t perform that action at this time.
0 commit comments