示例#1
0
  /** @since 2.0.3 */
  @ScriptUsage(
      description = "delete saved query result",
      arguments = {
        @ScriptArgument(
            name = "guid",
            type = "string",
            description = "the guid of saved query result")
      })
  public void deleteSavedResult(String[] args) throws IOException {
    String guid = args[0];
    SavedResult sr = savedResultManager.getResult(guid);
    if (sr == null) {
      context.println("query result not found");
      return;
    }

    savedResultManager.deleteResult(guid);
    context.println(
        "deleted '"
            + sr.getTitle()
            + "', "
            + sr.getFileSize()
            + " bytes, "
            + sr.getRowCount()
            + " rows");
  }
示例#2
0
  /** @since 2.0.3 */
  @ScriptUsage(
      description = "list all saved query results",
      arguments = {
        @ScriptArgument(
            name = "owner",
            type = "string",
            description = "login name",
            optional = true)
      })
  public void savedResults(String[] args) {
    String owner = args.length > 0 ? args[0] : null;
    List<SavedResult> savedResults = savedResultManager.getResultList(owner);

    context.println("Saved Query Results");
    context.println("---------------------");

    for (SavedResult sr : savedResults) {
      context.println(sr);
    }

    context.println("total " + savedResults.size() + " results");
  }