コード例 #1
0
 /*
  * Execute Query with Query Object
  */
 public void executeQuery(Query query, byte queryType) {
   if (query.isParametrized)
     executeQuery(
         query.getParametrizedQueryString(),
         query.getEncodedParamString(),
         queryType,
         query.getNr(),
         query.getQueryMix());
   else executeQuery(query.getQueryString(), "", queryType, query.getNr(), query.getQueryMix());
 }
コード例 #2
0
  /*
   * (non-Javadoc)
   * @see benchmark.testdriver.ServerConnection#executeValidation(benchmark.testdriver.Query, byte, java.lang.String[])
   * Gather information about the result a query returns.
   */
  public QueryResult executeValidation(Query query, byte queryType) {
    String queryString = query.getQueryString();
    String parametrizedQueryString = query.getParametrizedQueryString();
    String encodedParamString = query.getEncodedParamString();
    int queryNr = query.getNr();
    String[] rowNames = query.getRowNames();
    boolean sorted = queryString.toLowerCase().contains("order by");
    QueryResult queryResult = null;
    NetQuery qe;
    if (query.isParametrized)
      qe =
          new NetQuery(
              serverURL, parametrizedQueryString, encodedParamString, queryType, defaultGraph, 0);
    else qe = new NetQuery(serverURL, queryString, "", queryType, defaultGraph, 0);
    InputStream is = qe.exec();
    Document doc = getXMLDocument(is);
    XMLOutputter outputter = new XMLOutputter();
    logResultInfo(query, outputter.outputString(doc));

    if (queryType == Query.SELECT_TYPE)
      queryResult = gatherResultInfoForSelectQuery(queryString, queryNr, sorted, doc, rowNames);

    if (queryResult != null) queryResult.setRun(query.getQueryMix().getRun());
    return queryResult;
  }
コード例 #3
0
  private void logResultInfo(Query query, String queryResult) {
    StringBuffer sb = new StringBuffer();

    sb.append(
        "\n\n\tQuery "
            + query.getNr()
            + " of run "
            + (query.getQueryMix().getQueryMixRuns() + 1)
            + ":\n");
    sb.append("\n\tQuery string:\n\n");
    sb.append(query.getQueryString());
    sb.append("\n\n\tResult:\n\n");
    sb.append(queryResult);
    sb.append(
        "\n\n__________________________________________________________________________________\n");
    logger.log(Level.ALL, sb.toString());
  }