Problem with Array(DateTime) in PreparedStatement
In current implementation "Timestamp.toString()" is used in setValue for arrays. It leads to inability to insert Array(DateTime).
And this code will not work:
statement.setArray(index, statement.connection.createArrayOf("Array(DateTime)", array))
with following exception (with example DateTime)
String is too long for DateTime: 2001-01-01 11:11:11.0
Thanks for report. In fact arrays are currently serialized different from single values of corresponding types set with setObject. For example timezones are not considered for Date and Timestamp in arrays.
Is it the same issue?
Timestamp[] arr = {...};
statement.setArray(2, new ClickHouseArray(type, arr));
throws an exception:
DB::Exception: Cannot parse input: expected \' before: .358\',\'2019-04-03 16:52:43.358\']\n2019-04-03 13:52:43\t[\'2019-04-03 15:52:43.358\',\'2019-04-03 16:52:43.358\']\n: (at row 1)
Looks like
The driver has transitioned to the RowBinary data format starting from v0.3.2. It's now recommended to utilize input functions and appropriate objects for insertion, such as LocalDateTime[] in this instance.