当前位置: 首页>>代码示例>>Java>>正文


Java TimestampType类代码示例

本文整理汇总了Java中org.voltdb.types.TimestampType的典型用法代码示例。如果您正苦于以下问题:Java TimestampType类的具体用法?Java TimestampType怎么用?Java TimestampType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TimestampType类属于org.voltdb.types包,在下文中一共展示了TimestampType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import org.voltdb.types.TimestampType; //导入依赖的package包/类
public VoltTable run(TimestampType benchmarkTimes[], long item_id, long seller_id, long buyer_id, String question) {
    final TimestampType currentTime = AuctionMarkProfile.getScaledTimestamp(benchmarkTimes[0], benchmarkTimes[1], new TimestampType());
    long ic_id;
    
    // Set comment_id
    voltQueueSQL(getMaxItemCommentId, item_id, seller_id);
    VoltTable[] results = voltExecuteSQL();
    assert (1 == results.length);
    if (0 == results[0].getRowCount()) {
        ic_id = 0;
    } else {
        boolean adv = results[0].advanceRow();
        assert(adv);
        ic_id = results[0].getLong(0) + 1;
    }

    voltQueueSQL(insertItemComment, ic_id, item_id, seller_id, buyer_id, question, currentTime, currentTime);
    voltQueueSQL(updateUser, currentTime, seller_id);
    voltExecuteSQL();

    // Return new ic_id
    VoltTable ret = new VoltTable(RESULT_COLS);
    ret.addRow(ic_id, item_id, seller_id);
    return ret;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:26,代码来源:NewComment.java

示例2: run

import org.voltdb.types.TimestampType; //导入依赖的package包/类
public long run(int id) {
    // update 100 times using different values
    byte base = 1;

    for (int i = 0; i < 100; i++, base++) {
        char[] uninlineable = new char[1000];
        for (int j = 0; j < uninlineable.length; j++)
            uninlineable[j] = (char) (base + 32);

        voltQueueSQL(update, base + 1, base + 2, base + 3,
                     new TimestampType().getTime(),
                     (double) base / 100.0, new BigDecimal(base),
                     String.valueOf(base + 32),
                     String.valueOf(uninlineable), id);
    }

    long tupleChanged = voltExecuteSQL()[0].asScalarLong();
    assert(tupleChanged > 0);

    // divide by 0 to ensure the transaction gets rolled back
    return (5 / 0);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:23,代码来源:AllTypesUpdateJavaError.java

示例3: loadItems

import org.voltdb.types.TimestampType; //导入依赖的package包/类
private final void loadItems(VoltTable vt, ItemStatus status) {
    int ctr = 0;
    while (vt.advanceRow()) {
        int col = 0;
        ItemId i_id = new ItemId(vt.getLong(col++));
        double i_current_price = vt.getDouble(col++);
        TimestampType i_end_date = vt.getTimestampAsTimestamp(col++);
        int i_num_bids = (int)vt.getLong(col++);
        ItemStatus i_status = ItemStatus.get(vt.getLong(col++));
        assert(i_status == status);
        
        ItemInfo itemInfo = new ItemInfo(i_id, i_current_price, i_end_date, i_num_bids);
        this.addItemToProperQueue(itemInfo, false);
        ctr++;
    } // WHILE
    
    if (debug.val)
        LOG.debug(String.format("Loaded %d records from %s",
                                ctr, AuctionMarkConstants.TABLENAME_ITEM));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:21,代码来源:AuctionMarkProfile.java

示例4: next

import org.voltdb.types.TimestampType; //导入依赖的package包/类
@Override
public Object[] next() {
    Object tuple[] = new Object[columnsNum];
    
    long coId = generateCompId();
    int openDay = rnd.intRange(dayJan1_1800, dayJan2_2000);
    
    tuple[0] = coId; // co_id
    tuple[1] = compRecord[1]; // co_st_id
    tuple[2] = generateCompanyName(compRecord[2], counter); // co_name
    tuple[3] = compRecord[3]; // co_in
    tuple[4] = generateSP(coId); // co_sp_rate
    tuple[5] = person.getFirstName(multCEO * coId) + " " + person.getLastName(multCEO * coId); // co_ceo
    tuple[6] = ++companyAddrId; // co_ad_id
    tuple[7] = compRecord[4]; // co_desc
    tuple[8] = new TimestampType(EGenDate.getDateFromDayNo(openDay)); // co_open_date
    
    return tuple;
}
 
开发者ID:s-store,项目名称:s-store,代码行数:20,代码来源:CompanyGenerator.java

示例5: testExtractParams

import org.voltdb.types.TimestampType; //导入依赖的package包/类
/**
 * testExtractParams
 */
@Test
public void testExtractParams() throws Exception {
    Object params[] = {
        12345,
        123.45,
        new TimestampType(),
        "This is a string",
    };
    
    StringBuilder paramStr = new StringBuilder();
    for (Object obj : params) {
        if (obj instanceof String || obj instanceof TimestampType) paramStr.append('"');
        paramStr.append(obj);
        if (obj instanceof String || obj instanceof TimestampType) paramStr.append('"');
        paramStr.append(" ");
    } // FOR
    System.err.println("ORIG: " + paramStr);
    
    // Just check that we get the same number of parameters back
    List<String> extracted = HStoreTerminal.extractParams(paramStr.toString());
    System.err.println("EXTRACTED: " + extracted);
    assertEquals(params.length, extracted.size());
}
 
开发者ID:s-store,项目名称:s-store,代码行数:27,代码来源:TestHStoreTerminal.java

示例6: run

import org.voltdb.types.TimestampType; //导入依赖的package包/类
public long run() {
    // insert 100 times using different values
    byte base = 1;

    for (int i = 0; i < 100; i++, base++) {
        char[] uninlineable = new char[1000];
        for (int j = 0; j < uninlineable.length; j++)
            uninlineable[j] = (char) (base + 32);

        voltQueueSQL(insert, base, base + 1, base + 2, base + 3,
                     new TimestampType().getTime(),
                     (double) base / 100.0, new BigDecimal(base),
                     String.valueOf(base + 32),
                     String.valueOf(uninlineable));
    }

    long tupleChanged = voltExecuteSQL()[0].asScalarLong();
    assert(tupleChanged > 0);

    // divide by 0 to ensure the transaction gets rolled back
    return (5 / 0);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:23,代码来源:AllTypesJavaError.java

示例7: generateOrderLine

import org.voltdb.types.TimestampType; //导入依赖的package包/类
public void generateOrderLine(long ol_w_id, long ol_d_id, long ol_o_id, long ol_number, boolean newOrder) {
    long ol_i_id = m_generator.number(1, m_parameters.num_items);
    long ol_supply_w_id = ol_w_id;
    TimestampType ol_delivery_d = m_generationDateTime;
    long ol_quantity = TPCCConstants.INITIAL_QUANTITY;

    double ol_amount;
    if (!newOrder) {
        ol_amount = 0.00;
    } else {
        ol_amount = m_generator.fixedPoint(TPCCConstants.MONEY_DECIMALS, TPCCConstants.MIN_AMOUNT, TPCCConstants.MAX_PRICE
                * TPCCConstants.MAX_OL_QUANTITY);
        ol_delivery_d = null;
    }
    String ol_dist_info = m_generator.astring(TPCCConstants.DIST, TPCCConstants.DIST);

    data_tables[IDX_ORDERLINES].addRow(ol_o_id, ol_d_id, ol_w_id, ol_number, ol_i_id, ol_supply_w_id,
            ol_delivery_d, ol_quantity, ol_amount, ol_dist_info);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:TPCCLoader.java

示例8: run

import org.voltdb.types.TimestampType; //导入依赖的package包/类
public VoltTable[] run(
        short[] shorts,
        int[] ints,
        long[] longs,
        double[] doubles,
        String[] strings,
        TimestampType[] tss,
        BigDecimal[] bds,
        byte[] bytes
        )
{
    return new VoltTable[0];
    // new VoltTable[] { new VoltTable() };
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:15,代码来源:ParamSetArrays.java

示例9: offsetCheckpointTime

import org.voltdb.types.TimestampType; //导入依赖的package包/类
/**
 * We're coming in after a checkpoint restart, so we need to offset the
 * total time by the time that already elapsed
 * 
 * @param orig_start_time
 * @param last_checkpoint
 */
public void offsetCheckpointTime(TimestampType orig_start_time, TimestampType last_checkpoint) {
    if (this.limit_total_time != null) {
        assert (last_checkpoint.getTime() > orig_start_time.getTime());
        int delta = (int) (last_checkpoint.getMSTime() - orig_start_time.getMSTime()) / 1000;
        this.limit_total_time -= delta;
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:15,代码来源:DesignerHints.java

示例10: startGlobalSearchTimer

import org.voltdb.types.TimestampType; //导入依赖的package包/类
/**
 * Start the timer used to keep track of how long we are searching for
 * solutions
 */
public TimestampType startGlobalSearchTimer() {
    if (this.start_time == null) {
        this.start_time = new TimestampType();
    }
    return (this.start_time);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:11,代码来源:DesignerHints.java

示例11: getGlobalStopTime

import org.voltdb.types.TimestampType; //导入依赖的package包/类
public TimestampType getGlobalStopTime() {
    long stop = 9999999;
    if (this.limit_total_time != null && this.limit_total_time >= 0) {
        stop = (this.limit_total_time * 1000);
    }
    return new TimestampType((this.startGlobalSearchTimer().getMSTime() + stop) * 1000);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:8,代码来源:DesignerHints.java

示例12: compare

import org.voltdb.types.TimestampType; //导入依赖的package包/类
protected void compare(Object param0, Object param1) {
        // Workaround for comparing dates...
        if (param0 instanceof TimestampType) {
            assertEquals(((TimestampType)param0).toString(), ((TimestampType)param1).toString());
        } else {
            assertEquals(param0.toString(), param1.toString());
//            assertEquals(param0, param1);
        }
        return;
    }
 
开发者ID:s-store,项目名称:s-store,代码行数:11,代码来源:TestTransactionTrace.java

示例13: run

import org.voltdb.types.TimestampType; //导入依赖的package包/类
public long run(long voteId, long phoneNumber, int contestantNumber) {
      // Queue up validation statements
voltQueueSQL(checkContestantStmt, contestantNumber);
      voltQueueSQL(checkVoterStmt, phoneNumber);
      voltQueueSQL(checkStateStmt, (short)(phoneNumber / 10000000l));
      
      VoltTable validation[] = voltExecuteSQL(); //voltExecuteSQL() sends the queue of SQL commands to the Execution Engine

      // validate the maximum limit for votes number
      if (validation[0].getRowCount() == 0) {
          return VoterConstants.ERR_INVALID_CONTESTANT;
      }
      
      if ((validation[1].getRowCount() == 1) &&
	(validation[1].fetchRow(0).getLong(0) >= VoterSStoreExampleConstants.MAX_VOTES)) {
          return VoterConstants.ERR_VOTER_OVER_VOTE_LIMIT;
      }

      TimestampType timestamp = new TimestampType();
      long ts = System.currentTimeMillis() / 1000;

      // Some sample client libraries use the legacy random phone generation that mostly
      // created invalid phone numbers. Until refactoring, re-assign all such votes to
      // the "XX" fake state (those votes will not appear on the Live Statistics dashboard,
      // but are tracked as legitimate instead of invalid, as old clients would mostly get
      // it wrong and see all their transactions rejected).
      final String state = (validation[2].getRowCount() > 0) ? validation[2].fetchRow(0).getString(0) : "XX";
 		
      // Post the vote
      voltQueueSQL(insertVoteStmt, voteId, phoneNumber, state, contestantNumber, timestamp);

      // Send the vote downstream
     	voltQueueSQL(insertProcEndStmt, voteId, phoneNumber, state, contestantNumber, timestamp, ts);
      voltExecuteSQL(true);

      // Set the return value to 0: successful vote
      return VoterSStoreExampleConstants.VOTE_SUCCESSFUL;
  }
 
开发者ID:s-store,项目名称:s-store,代码行数:39,代码来源:Vote.java

示例14: executePlanFragment

import org.voltdb.types.TimestampType; //导入依赖的package包/类
@Override
public DependencySet executePlanFragment(Long txn_id,
                                         Map<Integer, List<VoltTable>> dependencies,
                                         int fragmentId,
                                         ParameterSet params,
                                         PartitionExecutor.SystemProcedureExecutionContext context) {
    // Nothing to do
    System.out.println("executePlanFragment!!! in get configuration");
    assert(fragmentId == SysProcFragmentId.PF_getConfiguration);
    HStoreConf hstore_conf = executor.getHStoreConf();
    String confNames[] = (String[])params.toArray();
    for (int i = 0; i < confNames.length; i++) {
        if (hstore_conf.hasParameter((String)params.toArray()[i]) == false) {
            String msg = String.format("Invalid configuration parameter '%s'", confNames[i]);
            throw new VoltAbortException(msg);
        }
    } // FOR
    
    VoltTable vt = new VoltTable(nodeResultsColumns);
    TimestampType timestamp = new TimestampType();
    for (int i = 0; i < confNames.length; i++) {
        Object val = hstore_conf.get(confNames[i]);
        vt.addRow(executor.getSiteId(),         
                  confNames[i], 
                  val.toString(),
                  timestamp);
    } // FOR
    DependencySet result = new DependencySet(SysProcFragmentId.PF_getConfiguration, vt);
    return (result);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:31,代码来源:GetConfiguration.java

示例15: run

import org.voltdb.types.TimestampType; //导入依赖的package包/类
public VoltTable[] run(long[] ol_o_id, long[] ol_d_id, long ol_w_id, long[] ol_number,
    long[] ol_i_id, long[] ol_supply_w_id, TimestampType[] ol_delivery_d, long[] ol_quantity,
    double[] ol_amount, String[] ol_dist_info) {

    int size = ol_o_id.length;
    for (int i = 0; i < size; ++i) {
        voltQueueSQL(insert, ol_o_id[i], ol_d_id[i], ol_w_id, ol_number[i],
        ol_i_id[i], ol_supply_w_id[i], ol_delivery_d[i], ol_quantity[i],
        ol_amount[i], ol_dist_info[i]);
    }
    return voltExecuteSQL();
}
 
开发者ID:s-store,项目名称:s-store,代码行数:13,代码来源:InsertOrderLineBatched.java


注:本文中的org.voltdb.types.TimestampType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。