Java Code Examples for ru.yandex.clickhouse.settings.ClickHouseProperties#isUseServerTimeZoneForDates()
The following examples show how to use
ru.yandex.clickhouse.settings.ClickHouseProperties#isUseServerTimeZoneForDates() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClickHousePreparedStatementImpl.java From clickhouse-jdbc with Apache License 2.0 | 6 votes |
public ClickHousePreparedStatementImpl(CloseableHttpClient client, ClickHouseConnection connection, ClickHouseProperties properties, String sql, TimeZone serverTimeZone, int resultSetType) throws SQLException { super(client, connection, properties, resultSetType); this.sql = sql; PreparedStatementParser parser = PreparedStatementParser.parse(sql); this.parameterList = parser.getParameters(); this.insertBatchMode = parser.isValuesMode(); this.sqlParts = parser.getParts(); int numParams = countNonConstantParams(); this.binds = new ClickHousePreparedStatementParameter[numParams]; dateTimeTimeZone = serverTimeZone; if (properties.isUseServerTimeZoneForDates()) { dateTimeZone = serverTimeZone; } else { dateTimeZone = TimeZone.getDefault(); } }
Example 2
Source File: ClickHouseResultSet.java From clickhouse-jdbc with Apache License 2.0 | 5 votes |
public ClickHouseResultSet(InputStream is, int bufferSize, String db, String table, boolean usesWithTotals, ClickHouseStatement statement, TimeZone timeZone, ClickHouseProperties properties) throws IOException { this.db = db; this.table = table; this.statement = statement; this.properties = properties; this.usesWithTotals = usesWithTotals; this.dateTimeTimeZone = timeZone; this.dateTimeZone = properties.isUseServerTimeZoneForDates() ? timeZone : TimeZone.getDefault(); dateTimeFormat.setTimeZone(dateTimeTimeZone); dateFormat.setTimeZone(dateTimeZone); bis = new StreamSplitter(is, (byte) 0x0A, bufferSize); /// \n ByteFragment headerFragment = bis.next(); if (headerFragment == null) { throw new IllegalArgumentException("ClickHouse response without column names"); } String header = headerFragment.asString(true); if (header.startsWith("Code: ") && !header.contains("\t")) { is.close(); throw new IOException("ClickHouse error: " + header); } String[] cols = toStringArray(headerFragment); ByteFragment typesFragment = bis.next(); if (typesFragment == null) { throw new IllegalArgumentException("ClickHouse response without column types"); } String[] types = toStringArray(typesFragment); columns = new ArrayList<ClickHouseColumnInfo>(cols.length); for (int i = 0; i < cols.length; i++) { columns.add(ClickHouseColumnInfo.parse(types[i], cols[i])); } }
Example 3
Source File: ClickHouseRowBinaryInputStream.java From clickhouse-jdbc with Apache License 2.0 | 5 votes |
public ClickHouseRowBinaryInputStream(InputStream is, TimeZone timeZone, ClickHouseProperties properties) { this.in = new LittleEndianDataInputStream(is); if (properties.isUseServerTimeZoneForDates()) { this.timeZone = timeZone; } else { this.timeZone = TimeZone.getDefault(); } }
Example 4
Source File: ClickHouseRowBinaryStream.java From clickhouse-jdbc with Apache License 2.0 | 5 votes |
public ClickHouseRowBinaryStream(OutputStream outputStream, TimeZone timeZone, ClickHouseProperties properties) { this.out = new LittleEndianDataOutputStream(outputStream); if (properties.isUseServerTimeZoneForDates()) { this.timeZone = timeZone; } else { this.timeZone = TimeZone.getDefault(); } }