File tree 3 files changed +39
-2
lines changed
main/user-impl/java/com/mysql/cj/jdbc
test/java/testsuite/regression
3 files changed +39
-2
lines changed Original file line number Diff line number Diff line change 3
3
4
4
Version 8.0.28
5
5
6
+ - Fix for Bug#105211 (33468860), class java.time.LocalDate cannot be cast to class java.sql.Date.
7
+
6
8
- Fix for Bug#101389 (32089018), GETWARNINGS SHOULD CHECK WARNING COUNT BEFORE SENDING SHOW.
7
9
8
10
- Fix for Bug#33488091, Remove all references to xdevapi.useAsyncProtocol from properties and code.
Original file line number Diff line number Diff line change 34
34
import java .io .Reader ;
35
35
import java .io .UnsupportedEncodingException ;
36
36
import java .net .URL ;
37
- import java .sql .Date ;
38
37
import java .sql .ParameterMetaData ;
39
38
import java .sql .SQLException ;
40
39
import java .sql .Time ;
@@ -760,7 +759,7 @@ protected int setOneBatchedParameterSet(java.sql.PreparedStatement batchedStatem
760
759
batchedStatement .setTime (batchedParamIndex ++, (Time ) paramArg [j ].value );
761
760
break ;
762
761
case MysqlType .FIELD_TYPE_DATE :
763
- batchedStatement .setDate (batchedParamIndex ++, ( Date ) paramArg [j ].value );
762
+ batchedStatement .setObject (batchedParamIndex ++, paramArg [j ].value , MysqlType . DATE );
764
763
break ;
765
764
case MysqlType .FIELD_TYPE_DATETIME :
766
765
batchedStatement .setObject (batchedParamIndex ++, paramArg [j ].value );
Original file line number Diff line number Diff line change @@ -11790,4 +11790,40 @@ public void testBlobWithSJIS() throws Exception {
11790
11790
}
11791
11791
}
11792
11792
}
11793
+
11794
+ /**
11795
+ * Test fix for Bug#105211 (33468860), class java.time.LocalDate cannot be cast to class java.sql.Date.
11796
+ *
11797
+ * @throws Exception
11798
+ */
11799
+ @Test
11800
+ public void testBug105211() throws Exception {
11801
+ createTable("testBug105211", "(dt date)");
11802
+
11803
+ Properties props = new Properties();
11804
+ props.setProperty(PropertyKey.sslMode.getKeyName(), SslMode.DISABLED.name());
11805
+ props.setProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName(), "true");
11806
+ props.setProperty(PropertyKey.rewriteBatchedStatements.getKeyName(), "true");
11807
+
11808
+ boolean useSPS = false;
11809
+ do {
11810
+ props.setProperty(PropertyKey.useServerPrepStmts.getKeyName(), Boolean.toString(useSPS));
11811
+
11812
+ Connection con = getConnectionWithProps(props);
11813
+ this.pstmt = con.prepareStatement("insert into testBug105211(dt) values(?)");
11814
+ con.setAutoCommit(false);
11815
+
11816
+ for (int i = 0; i <= 1000; i++) {
11817
+ this.pstmt.setObject(1, LocalDate.now());
11818
+ this.pstmt.addBatch();
11819
+ if (i % 100 == 0) {
11820
+ this.pstmt.executeBatch();
11821
+ this.pstmt.clearBatch();
11822
+ }
11823
+ }
11824
+ con.commit();
11825
+
11826
+ con.close();
11827
+ } while (useSPS = !useSPS);
11828
+ }
11793
11829
}
You can’t perform that action at this time.
0 commit comments