Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix decimal parse #178

Merged
merged 5 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ members = [
]

[workspace.package]
version = "0.4.4"
version = "0.5.1"
edition = "2021"
license = "Apache-2.0"
authors = ["Databend Authors <[email protected]>"]
Expand All @@ -18,5 +18,5 @@ keywords = ["databend", "database"]
repository = "https://github.com/datafuselabs/bendsql"

[workspace.dependencies]
databend-client = { path = "core", version = "0.4.4" }
databend-driver = { path = "driver", version = "0.4.4" }
databend-client = { path = "core", version = "0.5.1" }
databend-driver = { path = "driver", version = "0.5.1" }
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-darwin-arm64",
"repository": "https://github.com/datafuselabs/bendsql.git",
"version": "0.4.4",
"version": "0.5.1",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-darwin-x64",
"repository": "https://github.com/datafuselabs/bendsql.git",
"version": "0.4.4",
"version": "0.5.1",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-linux-x64-gnu",
"repository": "https://github.com/datafuselabs/bendsql.git",
"version": "0.4.4",
"version": "0.5.1",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@databend-driver/lib-win32-x64-msvc",
"repository": "https://github.com/datafuselabs/bendsql.git",
"version": "0.4.4",
"version": "0.5.1",
"os": [
"win32"
],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "databend-driver",
"author": "Databend Authors <[email protected]>",
"version": "0.4.4",
"version": "0.5.1",
"license": "Apache-2.0",
"main": "index.js",
"types": "index.d.ts",
Expand Down
4 changes: 1 addition & 3 deletions driver/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,7 @@ pub fn parse_decimal(text: &str, size: DecimalSize) -> Result<NumberValue> {
(Some(p1), Some(p2)) => (&text[..p1], &text[(p1 + 1)..p2], Some(&text[(p2 + 1)..])),
(Some(p), None) => (&text[..p], &text[(p + 1)..], None),
(None, Some(p)) => (&text[..p], "", Some(&text[(p + 1)..])),
_ => {
unreachable!()
}
(None, None) => (text, "", None),
};
let exp = match e_part {
Some(s) => s.parse::<i32>()?,
Expand Down
9 changes: 8 additions & 1 deletion driver/tests/driver/select_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ async fn select_datetime() {
async fn select_decimal() {
let conn = prepare().await;
let row = conn
.query_row("select 1::Decimal(15,2), 2.0 + 3.0")
.query_row("select 1::Decimal(15,2), 2.0 + 3.0, 3::Decimal(20, 0)")
.await
.unwrap();
assert!(row.is_some());
Expand All @@ -146,6 +146,13 @@ async fn select_decimal() {
scale: 1
},
)),
Value::Number(NumberValue::Decimal128(
3i128,
DecimalSize {
precision: 20,
scale: 0
},
)),
]
);
}
Expand Down
Loading