File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -211,6 +211,11 @@ name = "sqlite"
211
211
path = " tests/sqlite/sqlite.rs"
212
212
required-features = [" sqlite" ]
213
213
214
+ [[test ]]
215
+ name = " sqlite-any"
216
+ path = " tests/sqlite/any.rs"
217
+ required-features = [" sqlite" ]
218
+
214
219
[[test ]]
215
220
name = " sqlite-types"
216
221
path = " tests/sqlite/types.rs"
Original file line number Diff line number Diff line change @@ -205,6 +205,7 @@ fn map_arguments(args: AnyArguments<'_>) -> SqliteArguments<'_> {
205
205
. into_iter ( )
206
206
. map ( |val| match val {
207
207
AnyValueKind :: Null => SqliteArgumentValue :: Null ,
208
+ AnyValueKind :: Bool ( b) => SqliteArgumentValue :: Int ( b as i32 ) ,
208
209
AnyValueKind :: SmallInt ( i) => SqliteArgumentValue :: Int ( i as i32 ) ,
209
210
AnyValueKind :: Integer ( i) => SqliteArgumentValue :: Int ( i) ,
210
211
AnyValueKind :: BigInt ( i) => SqliteArgumentValue :: Int64 ( i) ,
Original file line number Diff line number Diff line change
1
+ use sqlx:: { Any , Sqlite } ;
2
+ use sqlx_test:: new;
3
+
4
+ #[ sqlx_macros:: test]
5
+ async fn it_encodes_bool_with_any ( ) -> anyhow:: Result < ( ) > {
6
+ sqlx:: any:: install_default_drivers ( ) ;
7
+ let mut conn = new :: < Any > ( ) . await ?;
8
+
9
+ let res = sqlx:: query ( "INSERT INTO accounts VALUES (?, ?, ?)" )
10
+ . bind ( 87 )
11
+ . bind ( "Harrison Ford" )
12
+ . bind ( true )
13
+ . execute ( & mut conn)
14
+ . await
15
+ . expect ( "failed to encode bool" ) ;
16
+ assert_eq ! ( res. rows_affected( ) , 1 ) ;
17
+
18
+ Ok ( ( ) )
19
+ }
You can’t perform that action at this time.
0 commit comments