1313import java .sql .ResultSetMetaData ;
1414import java .sql .Statement ;
1515import 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 .*;
2017
2118import static org .testng .Assert .assertEquals ;
2219import static org .testng .Assert .assertFalse ;
@@ -583,7 +580,7 @@ void testClearParameters() throws Exception {
583580 }
584581
585582 @ Test (groups = {"integration" })
586- void testWriteCollection () throws Exception {
583+ void testWriteUUID () throws Exception {
587584 String sql = "insert into `test_issue_2327` (`id`, `uuid`) values (?, ?)" ;
588585 try (Connection conn = getJdbcConnection ();
589586 PreparedStatementImpl ps = (PreparedStatementImpl ) conn .prepareStatement (sql )) {
@@ -604,4 +601,31 @@ void testWriteCollection() throws Exception {
604601 }
605602
606603 }
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+ }
607631}
0 commit comments