コード例 #1
0
 private Timestamp getScaledCurrentTimestamp(Timestamp time) {
   assert (this.clientStartTime != null);
   tmp_now.setTime(System.currentTimeMillis());
   time.setTime(
       AuctionMarkUtil.getScaledTimestamp(this.loaderStartTime, this.clientStartTime, tmp_now));
   if (LOG.isTraceEnabled())
     LOG.trace(
         String.format(
             "Scaled:%d / Now:%d / BenchmarkStart:%d / ClientStart:%d",
             time.getTime(),
             tmp_now.getTime(),
             this.loaderStartTime.getTime(),
             this.clientStartTime.getTime()));
   return (time);
 }
コード例 #2
0
ファイル: NewComment.java プロジェクト: nissanmodi/oltpbench
  public Object[] run(
      Connection conn,
      Timestamp benchmarkTimes[],
      long item_id,
      long seller_id,
      long buyer_id,
      String question)
      throws SQLException {
    final Timestamp currentTime = AuctionMarkUtil.getProcTimestamp(benchmarkTimes);

    // Set comment_id
    long ic_id = 0;
    PreparedStatement stmt = this.getPreparedStatement(conn, getItemComments, item_id, seller_id);
    ResultSet results = stmt.executeQuery();
    if (results.next()) {
      ic_id = results.getLong(1) + 1;
    }
    results.close();

    this.getPreparedStatement(
            conn,
            insertItemComment,
            ic_id,
            item_id,
            seller_id,
            buyer_id,
            question,
            currentTime,
            currentTime)
        .executeUpdate();
    this.getPreparedStatement(conn, updateItemComments, item_id, seller_id).executeUpdate();
    this.getPreparedStatement(conn, updateUser, currentTime, seller_id).executeUpdate();

    // Return new ic_id
    return new Object[] {ic_id, item_id, seller_id};
  }