Skip to content

Commit

Permalink
Merge pull request #630 from keeps/alindo-dev-decimal-fix
Browse files Browse the repository at this point in the history
fixed error when decimal or numeric type dont have precision or scale
  • Loading branch information
006627 committed Nov 28, 2024
2 parents 02cea63 + d6a0f67 commit 571f6e8
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class SimpleTypeNumericExact extends Type {

private Integer scale;

private static final Integer SIMPLE_TYPE_NUMERIC_EXACT_DEFAULT_PRECISION = 53;
private static final Integer SIMPLE_TYPE_NUMERIC_EXACT_DEFAULT_SCALE = 10;

/**
* Exact numeric, like int or integer
*/
Expand All @@ -37,8 +40,13 @@ public SimpleTypeNumericExact() {
* the number of digits after the radix point (optional)
*/
public SimpleTypeNumericExact(Integer precision, Integer scale) {
this.precision = precision;
this.scale = scale;
if (precision == 0 && scale == 0) {
this.precision = SIMPLE_TYPE_NUMERIC_EXACT_DEFAULT_PRECISION;
this.scale = SIMPLE_TYPE_NUMERIC_EXACT_DEFAULT_SCALE;
} else {
this.precision = precision;
this.scale = scale;
}
}

/**
Expand Down

0 comments on commit 571f6e8

Please sign in to comment.