diff --git a/src/main/java/cc/blynk/clickhouse/util/ClickHouseValueFormatter.java b/src/main/java/cc/blynk/clickhouse/util/ClickHouseValueFormatter.java index 23fb27b..1e3b780 100644 --- a/src/main/java/cc/blynk/clickhouse/util/ClickHouseValueFormatter.java +++ b/src/main/java/cc/blynk/clickhouse/util/ClickHouseValueFormatter.java @@ -86,18 +86,21 @@ public static String formatBoolean(boolean myBoolean) { } public static String formatDate(Date date, TimeZone timeZone) { - getDateFormat().setTimeZone(timeZone); - return getDateFormat().format(date); + SimpleDateFormat simpleDateFormat = dateFormat.get(); + simpleDateFormat.setTimeZone(timeZone); + return simpleDateFormat.format(date); } public static String formatTime(Time time, TimeZone timeZone) { - getDateTimeFormat().setTimeZone(timeZone); - return getDateTimeFormat().format(time); + SimpleDateFormat simpleDateFormat = dateTimeFormat.get(); + simpleDateFormat.setTimeZone(timeZone); + return simpleDateFormat.format(time); } public static String formatTimestamp(Timestamp time, TimeZone timeZone) { - getDateTimeFormat().setTimeZone(timeZone); - return getDateTimeFormat().format(time); + SimpleDateFormat simpleDateFormat = dateTimeFormat.get(); + simpleDateFormat.setTimeZone(timeZone); + return simpleDateFormat.format(time); } private static String formatUUID(UUID x) { @@ -168,13 +171,5 @@ public static boolean needsQuoting(Object o) { return true; } - private static SimpleDateFormat getDateFormat() { - return dateFormat.get(); - } - - private static SimpleDateFormat getDateTimeFormat() { - return dateTimeFormat.get(); - } - private ClickHouseValueFormatter() { /* NOP */ } } diff --git a/src/test/java/cc/blynk/clickhouse/integration/ClickHousePreparedStatementRealTablesTest.java b/src/test/java/cc/blynk/clickhouse/integration/ClickHousePreparedStatementRealTablesTest.java index a37e204..b7bd118 100644 --- a/src/test/java/cc/blynk/clickhouse/integration/ClickHousePreparedStatementRealTablesTest.java +++ b/src/test/java/cc/blynk/clickhouse/integration/ClickHousePreparedStatementRealTablesTest.java @@ -17,7 +17,7 @@ public class ClickHousePreparedStatementRealTablesTest { - private static int RECORDS = 3_000_000; + private static int RECORDS = 10_000_000; private ClickHouseDataSource dataSource; private Connection connection;