示例#1
0
  /**
   * Creates query plans.
   *
   * @param comp compiled flag
   */
  private void plan(final boolean comp) {
    if (comp != options.get(MainOptions.COMPPLAN)) return;

    // show dot plan
    try {
      if (options.get(MainOptions.DOTPLAN)) {
        final String path = options.get(MainOptions.QUERYPATH);
        final String dot =
            path.isEmpty() ? "plan.dot" : new IOFile(path).name().replaceAll("\\..*?$", ".dot");

        try (final BufferOutput bo = new BufferOutput(dot)) {
          try (final DOTSerializer d = new DOTSerializer(bo, options.get(MainOptions.DOTCOMPACT))) {
            d.serialize(qp.plan());
          }
        }
      }

      // show XML plan
      if (options.get(MainOptions.XMLPLAN)) {
        info(NL + QUERY_PLAN + COL);
        info(qp.plan().serialize().toString());
      }
    } catch (final Exception ex) {
      Util.stack(ex);
    }
  }