@Override
    public void enterQueryStmt(ClickHouseParser.QueryStmtContext ctx) {
        ClickHouseParser.QueryContext qCtx = ctx.query();
        if (qCtx != null) {
            if (qCtx.selectStmt() != null || qCtx.selectUnionStmt() != null || qCtx.showStmt() != null || qCtx.describeStmt() != null) {
                setHasResultSet(true);
            }
        }
    }
Parser listener that collects information for prepared statement.
jdbc-v2/src/main/java/com/clickhouse/jdbc/internal/ParsedPreparedStatement.java