File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
main/java/com/clickhouse/jdbc/internal
test/java/com/clickhouse/jdbc Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -452,7 +452,7 @@ protected ClickHouseResultSet newEmptyResultSet() throws SQLException {
452452 }
453453
454454 protected ResultSet updateResult (ClickHouseSqlStatement stmt , ClickHouseResponse response ) throws SQLException {
455- if (stmt .isQuery ()) {
455+ if (stmt .isQuery () || (! stmt . isRecognized () && ! response . getColumns (). isEmpty ()) ) {
456456 currentUpdateCount = -1L ;
457457 currentResult = new ClickHouseResultSet (stmt .getDatabaseOrDefault (getConnection ().getCurrentDatabase ()),
458458 stmt .getTable (), this , response );
Original file line number Diff line number Diff line change 2828import java .sql .Connection ;
2929import java .sql .PreparedStatement ;
3030import java .sql .ResultSet ;
31+ import java .sql .ResultSetMetaData ;
3132import java .sql .SQLException ;
3233import java .sql .Statement ;
3334import java .sql .Struct ;
@@ -1477,4 +1478,19 @@ public void testUseOffsetDateTime() {
14771478 Assert .fail ("Failed to create connection" , e );
14781479 }
14791480 }
1481+
1482+
1483+ @ Test (groups = "integration" )
1484+ public void testDescMetadata () {
1485+ try (ClickHouseConnection conn = newConnection ();
1486+ ClickHouseStatement stmt = conn .createStatement ()) {
1487+ ResultSet rs = stmt .executeQuery ("DESC (select timezone(), number FROM system.numbers)" );
1488+ rs .next ();
1489+ ResultSetMetaData metaData = rs .getMetaData ();
1490+ Assert .assertEquals (metaData .getColumnCount (), 7 );
1491+ } catch (Exception e ) {
1492+ e .printStackTrace ();
1493+ Assert .fail ("Failed to create connection" , e );
1494+ }
1495+ }
14801496}
You can’t perform that action at this time.
0 commit comments