Exemple #1
0
  public byte[] exportDrillthroughCsv(String queryName, int maxrows) {
    OlapStatement stmt = null;
    try {
      final OlapConnection con =
          olapDiscoverService.getNativeConnection(
              getQuery(queryName).getCube().getConnectionName());
      stmt = con.createStatement();
      String mdx = getMDXQuery(queryName);
      if (maxrows > 0) {
        mdx = "DRILLTHROUGH MAXROWS " + maxrows + " " + mdx;
      } else {
        mdx = "DRILLTHROUGH " + mdx;
      }

      ResultSet rs = stmt.executeQuery(mdx);
      return CsvExporter.exportCsv(rs);
    } catch (SQLException e) {
      throw new SaikuServiceException("Error DRILLTHROUGH: " + queryName, e);
    } finally {
      try {
        if (stmt != null) stmt.close();
      } catch (Exception e) {
      }
    }
  }
Exemple #2
0
 public byte[] exportResultSetCsv(
     ResultSet rs,
     String delimiter,
     String enclosing,
     boolean printHeader,
     List<KeyValue<String, String>> additionalColumns) {
   return CsvExporter.exportCsv(rs, delimiter, enclosing, printHeader, additionalColumns);
 }
Exemple #3
0
  public byte[] getExport(String queryName, String type, ICellSetFormatter formatter) {
    if (type != null) {
      IQuery query = getIQuery(queryName);
      CellSet rs = query.getCellset();
      List<SaikuDimensionSelection> filters = new ArrayList<SaikuDimensionSelection>();

      if (query.getType().equals(QueryType.QM)) {
        filters = getAxisSelection(queryName, "FILTER");
      }
      if (type.toLowerCase().equals("xls")) {
        return ExcelExporter.exportExcel(rs, formatter, filters);
      }
      if (type.toLowerCase().equals("csv")) {
        return CsvExporter.exportCsv(rs, ",", "\"", formatter);
      }
    }
    return new byte[0];
  }
Exemple #4
0
 public byte[] exportResultSetCsv(ResultSet rs) {
   return CsvExporter.exportCsv(rs);
 }