Skip to content

Commit fe585c8

Browse files
author
Paultagoras
committed
Adjusting index and statement types
1 parent 4edda9c commit fe585c8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/AbstractBinaryFormatReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ public ClickHouseGeoMultiPolygonValue getGeoMultiPolygon(int index) {
618618

619619
@Override
620620
public <T> List<T> getList(int index) {
621-
return getList(schema.indexToName(index));
621+
return getList(schema.indexToName(index - 1));
622622
}
623623

624624
@Override

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ public int executeUpdate(String sql) throws SQLException {
151151
public int executeUpdate(String sql, QuerySettings settings) throws SQLException {
152152
// TODO: close current result set?
153153
checkClosed();
154-
155-
if (parseStatementType(sql) == StatementType.SELECT) {
156-
throw new SQLException("executeUpdate() cannot be called with a SELECT statement", ExceptionUtils.SQL_STATE_SQL_ERROR);
154+
StatementType type = parseStatementType(sql);
155+
if (type == StatementType.SELECT || type == StatementType.SHOW || type == StatementType.DESCRIBE || type == StatementType.EXPLAIN) {
156+
throw new SQLException("executeUpdate() cannot be called with a SELECT/SHOW/DESCRIBE/EXPLAIN statement", ExceptionUtils.SQL_STATE_SQL_ERROR);
157157
}
158158

159159
QuerySettings mergedSettings = QuerySettings.merge(connection.getDefaultQuerySettings(), settings);
@@ -262,7 +262,7 @@ private boolean execute(String sql, QuerySettings settings) throws SQLException
262262
checkClosed();
263263
StatementType type = parseStatementType(sql);
264264

265-
if (type == StatementType.SELECT) {
265+
if (type == StatementType.SELECT || type == StatementType.SHOW || type == StatementType.DESCRIBE || type == StatementType.EXPLAIN) {
266266
executeQuery(sql, settings); // keep open to allow getResultSet()
267267
return true;
268268
} else if(type == StatementType.SET) {

0 commit comments

Comments
 (0)