@@ -679,7 +679,9 @@ public void testBooleanTypes() throws SQLException {
679
679
@ Test (groups = { "integration" })
680
680
public void testArrayTypes () throws SQLException {
681
681
runQuery ("CREATE TABLE test_arrays (order Int8, "
682
- + "array Array(Int8), arraystr Array(String), arraytuple Array(Tuple(Int8, String)), arraydate Array(Date)"
682
+ + "array Array(Int8), arraystr Array(String), "
683
+ + "arraytuple Array(Tuple(Int8, String)), "
684
+ + "arraydate Array(Date)"
683
685
+ ") ENGINE = MergeTree ORDER BY ()" );
684
686
685
687
// Insert random (valid) values
@@ -707,7 +709,7 @@ public void testArrayTypes() throws SQLException {
707
709
arraydate [i ] = Date .valueOf (LocalDate .now ().plusDays (rand .nextInt (100 )));
708
710
}
709
711
710
- // Insert random (valid) values
712
+ // Insert using `Connection#createArrayOf`
711
713
try (Connection conn = getConnection ()) {
712
714
try (PreparedStatement stmt = conn .prepareStatement ("INSERT INTO test_arrays VALUES ( 1, ?, ?, ?, ?)" )) {
713
715
stmt .setArray (1 , conn .createArrayOf ("Int8" , array ));
@@ -718,6 +720,18 @@ public void testArrayTypes() throws SQLException {
718
720
}
719
721
}
720
722
723
+ // Insert using common java objects
724
+ final String INSERT_SQL = "INSERT INTO test_arrays VALUES ( 1, ?, ?, ?, ?)" ;
725
+ try (Connection conn = getConnection ()) {
726
+ try (PreparedStatement stmt = conn .prepareStatement (INSERT_SQL )) {
727
+ stmt .setObject (1 , array );
728
+ stmt .setObject (2 , arraystr );
729
+ stmt .setObject (3 , arraytuple );
730
+ stmt .setObject (4 , arraydate );
731
+ stmt .executeUpdate ();
732
+ }
733
+ }
734
+
721
735
// Check the results
722
736
try (Connection conn = getConnection ()) {
723
737
try (Statement stmt = conn .createStatement ()) {
0 commit comments