Skip to content

Commit f556af1

Browse files
committed
Fixed a bug with REAL value decoding in Microsoft SQL Server.
1 parent e0825a7 commit f556af1

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Fixed Microsoft SQL Server driver not being able to read VARCHAR columns from databases with non-european collations.
99
- Added support for `BIT` columns in Microsoft SQL Server.
1010
- Avoid generating file names that contain spaces in `sqlpage.persist_uploaded_file`. This makes it easier to use the file name in URLs without URL-encoding it.
11+
- Fixed a bug with REAL value decoding in Microsoft SQL Server.
1112

1213
## 0.30.1 (2024-10-31)
1314
- fix a bug where table sorting would break if table search was not also enabled.

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ panic = "abort"
1818
codegen-units = 2
1919

2020
[dependencies]
21-
sqlx = { package = "sqlx-oldapi", version = "0.6.32", features = [
21+
sqlx = { package = "sqlx-oldapi", version = "0.6.33", features = [
2222
"any",
2323
"runtime-actix-rustls",
2424
"sqlite",

src/webserver/database/sql_to_json.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ mod tests {
164164
42::INT2 as small_int,
165165
42::INT4 as integer,
166166
42::INT8 as big_int,
167-
42.42::FLOAT4 as float4,
168-
42.42::FLOAT8 as float8,
167+
42.25::FLOAT4 as float4,
168+
42.25::FLOAT8 as float8,
169169
TRUE as boolean,
170170
'2024-03-14'::DATE as date,
171171
'13:14:15'::TIME as time,
@@ -183,8 +183,8 @@ mod tests {
183183
"small_int": 42,
184184
"integer": 42,
185185
"big_int": 42,
186-
"float4": 42.42,
187-
"float8": 42.42,
186+
"float4": 42.25,
187+
"float8": 42.25,
188188
"boolean": true,
189189
"date": "2024-03-14",
190190
"time": "13:14:15",
@@ -207,7 +207,7 @@ mod tests {
207207
"SELECT
208208
CAST(42 AS SIGNED) as signed_int,
209209
CAST(42 AS UNSIGNED) as unsigned_int,
210-
42.42 as decimal_number,
210+
42.25 as decimal_number,
211211
CAST('2024-03-14' AS DATE) as date,
212212
CAST('13:14:15' AS TIME) as time,
213213
CAST('2024-03-14 13:14:15' AS DATETIME) as datetime,
@@ -222,7 +222,7 @@ mod tests {
222222
serde_json::json!({
223223
"signed_int": 42,
224224
"unsigned_int": 42,
225-
"decimal_number": 42.42,
225+
"decimal_number": 42.25,
226226
"date": "2024-03-14",
227227
"time": "13:14:15",
228228
"datetime": "2024-03-14T13:14:15+00:00",
@@ -242,7 +242,7 @@ mod tests {
242242
let row = sqlx::query(
243243
"SELECT
244244
42 as integer,
245-
42.42 as real,
245+
42.25 as real,
246246
'xxx' as string,
247247
x'68656c6c6f20776f726c64' as blob",
248248
)
@@ -253,7 +253,7 @@ mod tests {
253253
row_to_json(&row),
254254
serde_json::json!({
255255
"integer": 42,
256-
"real": 42.42,
256+
"real": 42.25,
257257
"string": "xxx",
258258
"blob": "hello world",
259259
})
@@ -275,9 +275,9 @@ mod tests {
275275
CAST(42 AS SMALLINT) as small_int,
276276
CAST(42 AS INT) as integer,
277277
CAST(42 AS BIGINT) as big_int,
278-
CAST(42.42 AS REAL) as real,
279-
CAST(42.42 AS FLOAT) as float,
280-
CAST(42.42 AS DECIMAL(10,2)) as decimal,
278+
CAST(42.25 AS REAL) as real,
279+
CAST(42.25 AS FLOAT) as float,
280+
CAST(42.25 AS DECIMAL(10,2)) as decimal,
281281
CAST('2024-03-14' AS DATE) as date,
282282
CAST('13:14:15' AS TIME) as time,
283283
CAST('2024-03-14 13:14:15' AS DATETIME) as datetime,
@@ -298,9 +298,9 @@ mod tests {
298298
"small_int": 42,
299299
"integer": 42,
300300
"big_int": 42,
301-
"real": 42.42,
302-
"float": 42.42,
303-
"decimal": 42.42,
301+
"real": 42.25,
302+
"float": 42.25,
303+
"decimal": 42.25,
304304
"date": "2024-03-14",
305305
"time": "13:14:15",
306306
"datetime": "2024-03-14T13:14:15+00:00",

0 commit comments

Comments
 (0)