Skip to content

Commit 094d238

Browse files
author
Paultagoras
committed
Removing some implementation to simply
1 parent 904c68e commit 094d238

File tree

9 files changed

+66
-327
lines changed

9 files changed

+66
-327
lines changed

jdbc-v2/src/main/java/com/clickhouse/jdbc/ConnectionImpl.java

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -323,31 +323,19 @@ public PreparedStatement prepareStatement(String sql, String[] columnNames) thro
323323
@Override
324324
public Clob createClob() throws SQLException {
325325
checkOpen();
326-
try {
327-
return new com.clickhouse.jdbc.types.Clob();
328-
} catch (Exception e) {
329-
throw new SQLException("Failed to create Clob", e);
330-
}
326+
throw new SQLFeatureNotSupportedException("Clob not supported");
331327
}
332328

333329
@Override
334330
public Blob createBlob() throws SQLException {
335331
checkOpen();
336-
try {
337-
return new com.clickhouse.jdbc.types.Blob();
338-
} catch (Exception e) {
339-
throw new SQLException("Failed to create Blob", e);
340-
}
332+
throw new SQLFeatureNotSupportedException("Blob not supported");
341333
}
342334

343335
@Override
344336
public NClob createNClob() throws SQLException {
345337
checkOpen();
346-
try {
347-
return new com.clickhouse.jdbc.types.Clob.NClob();
348-
} catch (Exception e) {
349-
throw new SQLException("Failed to create NClob", e);
350-
}
338+
throw new SQLFeatureNotSupportedException("NClob not supported");
351339
}
352340

353341
@Override
@@ -369,40 +357,44 @@ public boolean isValid(int timeout) throws SQLException {
369357

370358
@Override
371359
public void setClientInfo(String name, String value) throws SQLClientInfoException {
372-
try {
373-
checkOpen();
374-
this.defaultQuerySettings.setOption(name, value);
375-
} catch (Exception e) {
376-
throw new SQLClientInfoException("Failed to set client info.", Collections.singletonMap(name, ClientInfoStatus.REASON_UNKNOWN), e);
377-
}
360+
// try {
361+
// checkOpen();
362+
// this.defaultQuerySettings.setOption(name, value);
363+
// } catch (Exception e) {
364+
// throw new SQLClientInfoException("Failed to set client info.", Collections.singletonMap(name, ClientInfoStatus.REASON_UNKNOWN), e);
365+
// }
366+
throw new SQLClientInfoException("Failed to set client info.", new HashMap<>(), new SQLFeatureNotSupportedException("setClientInfo not supported"));
378367
}
379368

380369
@Override
381370
public void setClientInfo(Properties properties) throws SQLClientInfoException {
382-
try {
383-
checkOpen();
384-
} catch (SQLException e) {
385-
throw new SQLClientInfoException("Failed to set client info.", new HashMap<>(), e);
386-
}
387-
388-
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
389-
setClientInfo(entry.getKey().toString(), entry.getValue().toString());
390-
}
371+
// try {
372+
// checkOpen();
373+
// } catch (SQLException e) {
374+
// throw new SQLClientInfoException("Failed to set client info.", new HashMap<>(), e);
375+
// }
376+
//
377+
// for (Map.Entry<Object, Object> entry : properties.entrySet()) {
378+
// setClientInfo(entry.getKey().toString(), entry.getValue().toString());
379+
// }
380+
throw new SQLClientInfoException("Failed to set client info.", new HashMap<>(), new SQLFeatureNotSupportedException("setClientInfo not supported"));
391381
}
392382

393383
@Override
394384
public String getClientInfo(String name) throws SQLException {
395385
checkOpen();
396-
Object value = this.defaultQuerySettings.getAllSettings().get(name);
397-
return value == null ? null : String.valueOf(value);
386+
// Object value = this.defaultQuerySettings.getAllSettings().get(name);
387+
// return value == null ? null : String.valueOf(value);
388+
throw new SQLFeatureNotSupportedException("getClientInfo not supported");
398389
}
399390

400391
@Override
401392
public Properties getClientInfo() throws SQLException {
402393
checkOpen();
403-
Properties clientInfo = new Properties();
404-
clientInfo.putAll(this.defaultQuerySettings.getAllSettings());
405-
return clientInfo;
394+
// Properties clientInfo = new Properties();
395+
// clientInfo.putAll(this.defaultQuerySettings.getAllSettings());
396+
// return clientInfo;
397+
throw new SQLFeatureNotSupportedException("getClientInfo not supported");
406398
}
407399

408400
@Override

jdbc-v2/src/main/java/com/clickhouse/jdbc/ResultSetImpl.java

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -891,8 +891,7 @@ public Statement getStatement() throws SQLException {
891891
@Override
892892
public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException {
893893
checkClosed();
894-
//TODO: Should we implement?
895-
return null;
894+
return getObject(columnIndex);
896895
}
897896

898897
@Override
@@ -904,21 +903,13 @@ public Ref getRef(int columnIndex) throws SQLException {
904903
@Override
905904
public Blob getBlob(int columnIndex) throws SQLException {
906905
checkClosed();
907-
try {
908-
return new com.clickhouse.jdbc.types.Blob(reader.getString(columnIndex));
909-
} catch (Exception e) {
910-
throw new SQLException(e);
911-
}
906+
throw new SQLFeatureNotSupportedException("Blob is not supported.");
912907
}
913908

914909
@Override
915910
public java.sql.Clob getClob(int columnIndex) throws SQLException {
916911
checkClosed();
917-
try {
918-
return new com.clickhouse.jdbc.types.Clob(reader.getString(columnIndex));
919-
} catch (Exception e) {
920-
throw new SQLException(e);
921-
}
912+
throw new SQLFeatureNotSupportedException("Clob is not supported.");
922913
}
923914

924915
@Override
@@ -946,21 +937,13 @@ public Ref getRef(String columnLabel) throws SQLException {
946937
@Override
947938
public Blob getBlob(String columnLabel) throws SQLException {
948939
checkClosed();
949-
try {
950-
return new com.clickhouse.jdbc.types.Blob(reader.getString(columnLabel));
951-
} catch (Exception e) {
952-
throw new SQLException(e);
953-
}
940+
throw new SQLFeatureNotSupportedException("Blob is not supported.");
954941
}
955942

956943
@Override
957944
public Clob getClob(String columnLabel) throws SQLException {
958945
checkClosed();
959-
try {
960-
return new com.clickhouse.jdbc.types.Clob(reader.getString(columnLabel));
961-
} catch (Exception e) {
962-
throw new SQLException(e);
963-
}
946+
throw new SQLFeatureNotSupportedException("Clob is not supported.");
964947
}
965948

966949
@Override

jdbc-v2/src/main/java/com/clickhouse/jdbc/StatementImpl.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,12 @@ public ResultSet executeQuery(String sql, QuerySettings settings) throws SQLExce
112112

113113
try {
114114
sql = parseJdbcEscapeSyntax(sql);
115-
QueryResponse response = connection.client.query(sql, mergedSettings).get(queryTimeout, TimeUnit.SECONDS);
115+
QueryResponse response;
116+
if (queryTimeout == 0) {
117+
response = connection.client.query(sql, mergedSettings).get();
118+
} else {
119+
response = connection.client.query(sql, mergedSettings).get(queryTimeout, TimeUnit.SECONDS);
120+
}
116121
ClickHouseBinaryFormatReader reader = connection.client.newBinaryFormatReader(response);
117122
currentResultSet = new ResultSetImpl(this, response, reader);
118123
metrics = response.getMetrics();
@@ -140,7 +145,12 @@ public int executeUpdate(String sql, QuerySettings settings) throws SQLException
140145

141146
try {
142147
sql = parseJdbcEscapeSyntax(sql);
143-
QueryResponse response = connection.client.query(sql, mergedSettings).get(queryTimeout, TimeUnit.SECONDS);
148+
QueryResponse response;
149+
if (queryTimeout == 0) {
150+
response = connection.client.query(sql, mergedSettings).get();
151+
} else {
152+
response = connection.client.query(sql, mergedSettings).get(queryTimeout, TimeUnit.SECONDS);
153+
}
144154
currentResultSet = null;
145155
metrics = response.getMetrics();
146156
response.close();

jdbc-v2/src/main/java/com/clickhouse/jdbc/types/Blob.java

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)