Skip to content

Commit 9be1512

Browse files
committed
mysql: use double literals in test
1 parent 493e520 commit 9be1512

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

sqlx-core/src/mysql/protocol/type.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ type_id_consts! {
5757
// Numeric: FLOAT, DOUBLE
5858
pub const FLOAT: TypeId = TypeId(4);
5959
pub const DOUBLE: TypeId = TypeId(5);
60+
// pub const NEWDECIMAL: TypeId = TypeId(246);
6061

6162
// Date/Time: DATE, TIME, DATETIME, TIMESTAMP
6263
pub const DATE: TypeId = TypeId(10);

sqlx-test/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,21 @@ macro_rules! test_prepared_type {
7575
.await?;
7676

7777
assert!(rec.0,
78-
"DB value mismatch; given value: {:?}\n\
78+
"[1] DB value mismatch; given value: {:?}\n\
7979
as received: {:?}\n\
8080
as returned: {:?}\n\
8181
round-trip: {:?}",
8282
$value, rec.1, rec.2, rec.3);
8383

8484
assert_eq!($value, rec.2,
85-
"DB value mismatch; given value: {:?}\n\
85+
"[2] DB value mismatch; given value: {:?}\n\
8686
as received: {:?}\n\
8787
as returned: {:?}\n\
8888
round-trip: {:?}",
8989
$value, rec.1, rec.2, rec.3);
9090

9191
assert_eq!($value, rec.3,
92-
"DB value mismatch; given value: {:?}\n\
92+
"[3] DB value mismatch; given value: {:?}\n\
9393
as received: {:?}\n\
9494
as returned: {:?}\n\
9595
round-trip: {:?}",
@@ -105,7 +105,7 @@ macro_rules! test_prepared_type {
105105
#[macro_export]
106106
macro_rules! MySql_query_for_test_prepared_type {
107107
() => {
108-
"SELECT {0} <=> ?, cast(? as text) as _1, {0} as _2, ? as _3"
108+
"SELECT {0} <=> ?, '<UNKNOWN>' as _1, ? as _2, ? as _3"
109109
};
110110
}
111111

tests/mysql-types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ test_type!(i32(MySql, i32, "2141512" == 2141512_i32));
2121
test_type!(u64(MySql, u64, "2141512" == 2141512_u64));
2222
test_type!(i64(MySql, i64, "2141512" == 2141512_i64));
2323

24-
test_type!(double(MySql, f64, "3.14159265" == 3.14159265f64));
24+
test_type!(double(MySql, f64, "3.14159265E0" == 3.14159265f64));
2525

2626
// NOTE: This behavior can be very surprising. MySQL implicitly widens FLOAT bind parameters
2727
// to DOUBLE. This results in the weirdness you see below. MySQL generally recommends to stay
2828
// away from FLOATs.
2929
test_type!(float(
3030
MySql,
3131
f32,
32-
"3.1410000324249268" == 3.141f32 as f64 as f32
32+
"3.1410000324249268e0" == 3.141f32 as f64 as f32
3333
));
3434

3535
test_type!(string(

0 commit comments

Comments
 (0)