Skip to content

Commit

Permalink
add DbInsertDecimalTest.bigValue
Browse files Browse the repository at this point in the history
  • Loading branch information
t-horikawa committed Jan 30, 2024
1 parent 7813436 commit e7223ce
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void beforeEach(TestInfo info) throws Exception {
private static void createTable() throws IOException, InterruptedException {
var sql = "create table " + TEST //
+ "(" //
+ " value decimal(5,2)" //
+ " value decimal(30,3)" //
+ ")";
executeDdl(getSession(), sql);
}
Expand All @@ -64,6 +64,25 @@ void normal(String s) throws Exception {
assertEquals(value.setScale(2), actual);
}

@ParameterizedTest
@ValueSource(strings = { "184467440737095513.02" })
void bigValue(String s) throws Exception {
var value = new BigDecimal(s);
var variable = TgBindVariable.ofDecimal(VNAME);
var mapping = TgParameterMapping.of(variable);

var session = getSession();
var tm = createTransactionManagerOcc(session);
try (var ps = session.createStatement(SQL, mapping)) {
var parameter = TgBindParameters.of(variable.bind(value));
int count = tm.executeAndGetCount(ps, parameter);
assertUpdateCount(1, count);
}

var actual = selectValue();
assertEquals(value.setScale(2), actual);
}

@ParameterizedTest
@ValueSource(strings = { "1234", "1.001" })
void outOfRange(String s) throws Exception {
Expand Down

0 comments on commit e7223ce

Please sign in to comment.