13
13
import java .sql .ResultSetMetaData ;
14
14
import java .sql .Statement ;
15
15
import java .sql .Types ;
16
- import java .util .Arrays ;
17
- import java .util .GregorianCalendar ;
18
- import java .util .TimeZone ;
19
- import java .util .UUID ;
16
+ import java .util .*;
20
17
21
18
import static org .testng .Assert .assertEquals ;
22
19
import static org .testng .Assert .assertFalse ;
@@ -583,7 +580,7 @@ void testClearParameters() throws Exception {
583
580
}
584
581
585
582
@ Test (groups = {"integration" })
586
- void testWriteCollection () throws Exception {
583
+ void testWriteUUID () throws Exception {
587
584
String sql = "insert into `test_issue_2327` (`id`, `uuid`) values (?, ?)" ;
588
585
try (Connection conn = getJdbcConnection ();
589
586
PreparedStatementImpl ps = (PreparedStatementImpl ) conn .prepareStatement (sql )) {
@@ -604,4 +601,31 @@ void testWriteCollection() throws Exception {
604
601
}
605
602
606
603
}
604
+
605
+ @ Test (groups = {"integration" })
606
+ void testWriteCollection () throws Exception {
607
+ String sql = "insert into `test_issue_2329` (`id`, `name`, `age`, `arr`) values (?, ?, ?, ?)" ;
608
+ try (Connection conn = getJdbcConnection ();
609
+ PreparedStatementImpl ps = (PreparedStatementImpl ) conn .prepareStatement (sql )) {
610
+
611
+ try (Statement stmt = conn .createStatement ()) {
612
+ stmt .execute ("CREATE TABLE IF NOT EXISTS `test_issue_2329` (`id` Nullable(String), `name` Nullable(String), `age` Int32, `arr` Array(String)) ENGINE Memory;" );
613
+ }
614
+
615
+ Assert .assertEquals (ps .getParametersCount (), 4 );
616
+ Collection <String > arr = new ArrayList <String >();
617
+ ps .setString (1 , "testId01" );
618
+ ps .setString (2 , "testName" );
619
+ ps .setInt (3 , 18 );
620
+ ps .setObject (4 , arr );
621
+ ps .execute ();
622
+
623
+ try (Statement stmt = conn .createStatement ()) {
624
+ ResultSet rs = stmt .executeQuery ("SELECT count(*) FROM `test_issue_2329`" );
625
+ Assert .assertTrue (rs .next ());
626
+ Assert .assertEquals (rs .getInt (1 ), 1 );
627
+ }
628
+ }
629
+
630
+ }
607
631
}
0 commit comments