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


Java VoltTable.fetchRow方法代码示例

本文整理汇总了Java中org.voltdb.VoltTable.fetchRow方法的典型用法代码示例。如果您正苦于以下问题:Java VoltTable.fetchRow方法的具体用法?Java VoltTable.fetchRow怎么用?Java VoltTable.fetchRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.voltdb.VoltTable的用法示例。


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

示例1: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public long run(int partId, VoltTable sp2Data, long[] extraArgs) {


    	
		for (int i=0; i < sp2Data.getRowCount(); i++) {
			VoltTableRow row = sp2Data.fetchRow(i);
			String symbol = row.getString("T_S_SYMB");
			voltQueueSQL(getSecurityID, symbol, partId);
			VoltTable v[] = voltExecuteSQL();
			long SK_SecurityID = v[0].fetchRow(0).getLong(0);
			long SK_CompanyID = v[0].fetchRow(0).getLong(1);

			voltQueueSQL(insertSP3Out, row.getLong("T_ID"), row.getLong("SK_CreateDateID"), row.getLong("SK_CreateTimeID"),
					row.getLong("SK_CloseDateID"), row.getLong("SK_CloseTimeID"), row.getString("Status"), row.getString("Type"),
					(short) row.getLong("T_IS_CASH"), SK_SecurityID, SK_CompanyID, (int) row.getLong("T_QTY"),
					row.getDouble("T_BID_PRICE"), (int) row.getLong("T_CA_ID"), row.getString("T_EXEC_NAME"),
					row.getDouble("T_TRADE_PRICE"), row.getDouble("T_CHRG"), row.getDouble("T_COMM"), row.getDouble("T_TAX"),
					row.getLong("batch_id"), partId);

			int destinationPartition = TPCDIUtil.hashCode(TPCDIConstants.DIMACCOUNT_TABLE,String.valueOf(row.getLong("T_CA_ID")));
			voltExecuteSQLDownStream("SP3out", destinationPartition);
		}
        // Set the return value to 0: successful vote
        return TPCDIConstants.PROC_SUCCESSFUL;
    }
 
开发者ID:s-store,项目名称:s-store,代码行数:26,代码来源:SP3GetSecurityID.java

示例2: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public VoltTable[] run(long acct_id) throws VoltAbortException {
    voltQueueSQL(getTradeStatus, acct_id);
    voltQueueSQL(getName, acct_id);
    
    // we need only the first table
    VoltTable ts = voltExecuteSQL()[0];
    VoltTable result = trade_status_ret_template.clone(256);
    
    for (int i = 0; i < ts.getRowCount(); i++) {
        VoltTableRow ts_row = ts.fetchRow(i);
        
        String status_name = ts_row.getString("ST_NAME");
        long trade_id = ts_row.getLong("T_ID");
        
        result.addRow(status_name, trade_id);
    }
    
    return new VoltTable[] {result};
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:TradeStatus.java

示例3: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public long run(int partId, VoltTable sp2Data, long[] extraArgs) {


    	
		for (int i=0; i < sp2Data.getRowCount(); i++) {
			VoltTableRow row = sp2Data.fetchRow(i);
			String symbol = row.getString("T_S_SYMB");
			voltQueueSQL(getSecurityID, symbol, partId);
			VoltTable v[] = voltExecuteSQL();
			long SK_SecurityID = v[0].fetchRow(0).getLong(0);
			long SK_CompanyID = v[0].fetchRow(0).getLong(1);

			voltQueueSQL(insertSP3Out, row.getLong("T_ID"), row.getLong("SK_CreateDateID"), row.getLong("SK_CreateTimeID"),
					row.getLong("SK_CloseDateID"), row.getLong("SK_CloseTimeID"), row.getString("Status"), row.getString("Type"),
					(short) row.getLong("T_IS_CASH"), SK_SecurityID, SK_CompanyID, (int) row.getLong("T_QTY"),
					row.getDouble("T_BID_PRICE"), (int) row.getLong("T_CA_ID"), row.getString("T_EXEC_NAME"),
					row.getDouble("T_TRADE_PRICE"), row.getDouble("T_CHRG"), row.getDouble("T_COMM"), row.getDouble("T_TAX"),
					row.getLong("batch_id"), partId);

			int destinationPartition = TPCDIUtil.hashCode(String.valueOf(row.getLong("T_CA_ID")), TPCDIConstants.NUM_PARTITIONS);
			voltExecuteSQLDownStream("SP3out", destinationPartition);
		}
        // Set the return value to 0: successful vote
        return TPCDIConstants.PROC_SUCCESSFUL;
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:26,代码来源:SP3GetSecurityID.java

示例4: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public VoltTable[] run(short w_id, byte d_id, double h_amount, short c_w_id, byte c_d_id, String c_last, TimestampType timestamp) throws VoltAbortException {
//        voltQueueSQL(getCustomersByLastName, c_last, c_d_id, c_w_id);
        voltQueueSQL(getCidByLastName, c_last, c_d_id, c_w_id);
        final VoltTable customersIds = voltExecuteSQL()[0];
        final int namecnt = customersIds.getRowCount();
        if (namecnt == 0) {
            throw new VoltAbortException("no customers with last name: " + c_last + " in warehouse: "
                    + c_w_id + " and in district " + c_d_id);
        }

        final int index = (namecnt-1)/2;
        final VoltTableRow customerIdRow = customersIds.fetchRow(index);
        final int c_id = (int)customerIdRow.getLong(C_ID_IDX);
        
        voltQueueSQL(getCustomersByCustomerId, c_id, c_d_id, c_w_id);
        final VoltTableRow customer = voltExecuteSQL()[0].fetchRow(0);
        return processPayment(w_id, d_id, c_w_id, c_d_id, c_id, h_amount, customer, timestamp);
    }
 
开发者ID:s-store,项目名称:s-store,代码行数:19,代码来源:paymentByCustomerName.java

示例5: compareTables

import org.voltdb.VoltTable; //导入方法依赖的package包/类
private void compareTables(VoltTable vt0, VoltTable vt1) {
        assertEquals(vt0.getRowCount(), vt1.getRowCount());
        assertEquals(vt0.getColumnCount(), vt1.getColumnCount());
        assert(vt1.getColumnCount() > 0);
        int rows = 0;
        while (vt0.advanceRow() && vt1.advanceRow()) {
            VoltTableRow row0 = vt0.fetchRow(vt0.getActiveRowIndex());
            VoltTableRow row1 = vt1.fetchRow(vt1.getActiveRowIndex());
            
            for (int i = 0; i < vt0.getColumnCount(); i++) {
//                System.err.println(i + ": " + row1.get(i));
                assertEquals(row0.get(i), row1.get(i));
            } // FOR
            rows++;
        } // WHILE
        assert(rows > 0);
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:18,代码来源:TestMapReduceTransaction.java

示例6: storeData

import org.voltdb.VoltTable; //导入方法依赖的package包/类
/**
 * Store Data from MapOutput table into reduceInput table
 * ReduceInput table is the result of all incoming mapOutput table from other partitions
 * @see edu.brown.hstore.txns.AbstractTransaction#storeData(int, org.voltdb.VoltTable)
 */
@Override
public synchronized Status storeData(int partition, VoltTable vt) {
    VoltTable input = this.getReduceInputByPartition(partition);
    
    assert(input != null);
    if (debug.val)
        LOG.debug(String.format("StoreData into Partition #%d: RowCount=%d ",
                partition, vt.getRowCount()));
    
    if (debug.val)
        LOG.debug(String.format("<StoreData, change to ReduceInputTable> to Partition:%d>\n %s",partition,vt));
    while (vt.advanceRow()) {
        VoltTableRow row = vt.fetchRow(vt.getActiveRowIndex());
        assert(row != null);
        input.add(row);
    }
    vt.resetRowPosition();
    
    return Status.OK;
}
 
开发者ID:s-store,项目名称:s-store,代码行数:26,代码来源:MapReduceTransaction.java

示例7: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public long run(int partId, VoltTable sp4Data, long[] extraArgs) {
  	
for (int i=0; i < sp4Data.getRowCount(); i++) {
	VoltTableRow row = sp4Data.fetchRow(i);
	double tradePrice = row.getDouble("T_TRADE_PRICE");
	double quantity = (double)row.getLong("T_QTY");
	Double commission = row.getDouble("T_COMM");
	Double fee = row.getDouble("T_CHRG");
	long tradeID = row.getLong("T_ID");
	long batchID = row.getLong("batch_id");
	String messageText = "";
	String messageData = "";
	
	if(commission != null && commission > tradePrice*quantity){
		messageText = "Invalid trade commission";
		messageData = "T_ID=" + tradeID + ", T_COMM=" + commission;
		voltQueueSQL(insertMessage, batchID,"DimTrade","Alert",messageText,messageData,partId);
	}
	if(fee != null && fee > tradePrice*quantity){
		messageText = "Invalid trade fee";
		messageData = "T_ID=" + tradeID + ", T_CHRG=" + fee;
		voltQueueSQL(insertMessage, batchID, "DimTrade","Alert",messageText,messageData,partId);
	}

	voltQueueSQL(insertDimTrade, row.getLong("T_ID"), row.getLong("SK_BrokerID"), row.getLong("SK_CreateDateID"),
			row.getLong("SK_CreateTimeID"), row.getLong("SK_CloseDateID"), row.getLong("SK_CloseTimeID"),
			row.getString("Status"), row.getString("Type"), (short) row.getLong("T_IS_CASH"),
			row.getLong("SK_SecurityID"), row.getLong("SK_CompanyID"), (int) row.getLong("T_QTY"),
			row.getDouble("T_BID_PRICE"), row.getLong("SK_CustomerID"), row.getLong("SK_AccountID"),
			row.getString("T_EXEC_NAME"), row.getDouble("T_TRADE_PRICE"), row.getDouble("T_CHRG"),
			row.getDouble("T_COMM"), row.getDouble("T_TAX"), row.getLong("batch_id"), partId);
	
	voltExecuteSQL();
}
      // Set the return value to 0: successful vote
      return TPCDIConstants.PROC_SUCCESSFUL;
  }
 
开发者ID:s-store,项目名称:s-store,代码行数:38,代码来源:SP5InsertTrade.java

示例8: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public long run(int partId, VoltTable sp3Data, long[] extraArgs) {

		for (int i=0; i < sp3Data.getRowCount(); i++) {
			VoltTableRow row = sp3Data.fetchRow(i);
			long ca_id = row.getLong("T_CA_ID");
			voltQueueSQL(getAccountInfo, ca_id, partId);
			VoltTable v[] = voltExecuteSQL();
			long SK_AccountID = v[0].fetchRow(0).getLong(0);
			long SK_CustomerID = v[0].fetchRow(0).getLong(1);
			long SK_BrokerID = v[0].fetchRow(0).getLong(2);

			voltQueueSQL(insertSP4Out,row.getLong("T_ID"),row.getLong("SK_CreateDateID"),
					row.getLong("SK_CreateTimeID"),	row.getLong("SK_CloseDateID"),
					row.getLong("SK_CloseTimeID"),row.getString("Status"),
					row.getString("Type"),(short)row.getLong("T_IS_CASH"),
					row.getLong("SK_SecurityID"),row.getLong("SK_CompanyID"),(int)row.getLong("T_QTY"),row.getDouble("T_BID_PRICE"),
					SK_AccountID,SK_CustomerID,SK_BrokerID,
					row.getString("T_EXEC_NAME"),row.getDouble("T_TRADE_PRICE"),
					row.getDouble("T_CHRG"),row.getDouble("T_COMM"),row.getDouble("T_TAX"),row.getLong("batch_id"), partId
					);


			int destinationPartition = TPCDIUtil.hashCode(TPCDIConstants.DIMTRADE_TABLE,String.valueOf(row.getLong("T_ID")));
			voltExecuteSQLDownStream("SP4out", destinationPartition);
		}
        // Set the return value to 0: successful vote
        return TPCDIConstants.PROC_SUCCESSFUL;
    }
 
开发者ID:s-store,项目名称:s-store,代码行数:29,代码来源:SP4GetAccountInfo.java

示例9: pickRandomVal

import org.voltdb.VoltTable; //导入方法依赖的package包/类
private Object pickRandomVal(VoltTable table, Column col)
{
    int size = table.getRowCount();
    int i_row = RandUtil.randLong(0, size - 1).intValue();
    VoltTableRow row = table.fetchRow(i_row);
    return row.get(col.getIndex(), VoltType.get((byte) col.getType()));
}
 
开发者ID:s-store,项目名称:s-store,代码行数:8,代码来源:AbstractLoader.java

示例10: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public long run(int partId, VoltTable sp3Data, long[] extraArgs) {

		for (int i=0; i < sp3Data.getRowCount(); i++) {
			VoltTableRow row = sp3Data.fetchRow(i);
			long ca_id = row.getLong("T_CA_ID");
			voltQueueSQL(getAccountInfo, ca_id, partId);
			VoltTable v[] = voltExecuteSQL();
			long SK_AccountID = v[0].fetchRow(0).getLong(0);
			long SK_CustomerID = v[0].fetchRow(0).getLong(1);
			long SK_BrokerID = v[0].fetchRow(0).getLong(2);

			voltQueueSQL(insertSP4Out,row.getLong("T_ID"),row.getLong("SK_CreateDateID"),
					row.getLong("SK_CreateTimeID"),	row.getLong("SK_CloseDateID"),
					row.getLong("SK_CloseTimeID"),row.getString("Status"),
					row.getString("Type"),(short)row.getLong("T_IS_CASH"),
					row.getLong("SK_SecurityID"),row.getLong("SK_CompanyID"),(int)row.getLong("T_QTY"),row.getDouble("T_BID_PRICE"),
					SK_AccountID,SK_CustomerID,SK_BrokerID,
					row.getString("T_EXEC_NAME"),row.getDouble("T_TRADE_PRICE"),
					row.getDouble("T_CHRG"),row.getDouble("T_COMM"),row.getDouble("T_TAX"),row.getLong("batch_id"), partId
					);


			int destinationPartition = TPCDIUtil.hashCode(String.valueOf(row.getLong("T_ID")), TPCDIConstants.NUM_PARTITIONS);
			voltExecuteSQLDownStream("SP4out", destinationPartition);
		}
        // Set the return value to 0: successful vote
        return TPCDIConstants.PROC_SUCCESSFUL;
    }
 
开发者ID:s-store,项目名称:s-store,代码行数:29,代码来源:SP4GetAccountInfo.java

示例11: execute

import org.voltdb.VoltTable; //导入方法依赖的package包/类
/**
     * Execute stmt with args, and put result, which is an array of columns,
     * into map
     * 
     * @param map
     *            the container of results of executing stmt
     * @param sp
     *            the store procedure that executes stmt
     * @param stmt
     *            the SQLStmt to be executed
     * @param args
     *            the argument needed by stmt
     * @param keys
     *            the names of columns in map
     * @param value_refs
     *            the references of values matching the keys. Each reference is
     *            one of {column_index, column_name, key_name}
     * @return the size of the first VoltTable among the array of VoltTable
     *         returned by executing stmt
     */
    public static int execute(Map<String, Object[]> map, VoltProcedure sp, SQLStmt stmt, Object[] args, String[] keys, Object[] value_refs) {
        LOG.info("Executing SQL: " + stmt);
System.out.println("ProcedureUtil line 97: " + args.length);
        String debug = "PARAMS:";
        for (Object arg : args) {
            debug += " " + arg;
        }
        LOG.info(debug);

        sp.voltQueueSQL(stmt, args);
        VoltTable table = sp.voltExecuteSQL()[0];
        System.out.println(table);

        if (keys == null) {
            assert (value_refs == null);
            return -1;
        }

        assert (keys.length == value_refs.length);

        int row_count = table.getRowCount();
System.out.println("ProcedureUtil line 116: " + row_count);
        // each key corresponds to a column of length row_count
        for (String key : keys)
            map.put(key, new Object[row_count]);

        // for update, delete, insert, keys is empty
        if (keys.length > 0) {
            for (int i = 0; i < row_count; i++) {
                VoltTableRow row = table.fetchRow(i);
                for (int j = 0; j < keys.length; j++) {
                    Object[] vals = map.get(keys[j]);
                    Object ref = value_refs[j];
                    if (ref instanceof Integer) {
                        // ref is column_index
                        vals[i] = row.get(j, table.getColumnType(j));
                    } else {
                        assert (ref instanceof String);
                        int idx = table.getColumnIndex((String) ref);
                        if (idx >= 0) {
                            // ref is column_name
                            vals[i] = row.get(idx, table.getColumnType(idx));
                        } else {
                            // ref is key_name
                            if (map.get(ref).length == 1) {
                                vals[i] = map.get(ref)[0];
                            } else {
                                vals[i] = map.get(ref)[i];
                            }
                        }
                    }
                }
            }
        }

        return row_count;
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:78,代码来源:ProcedureUtil.java

示例12: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public VoltTable run() {

        voltQueueSQL(getCurrentLocation);
        VoltTable i[] = voltExecuteSQL();

        Double lat = i[0].fetchRow(0).getDouble("c_lat");
        Double lon = i[0].fetchRow(0).getDouble("c_lon");
        Integer month = new Integer((int) i[0].fetchRow(0).getLong("c_month"));

//        Double a = SeaflowUtil.roundToHalf(lon);
//        Double b = SeaflowUtil.roundToHalf(lat);

        int k = 3;

        List<Double> tempMult = new ArrayList<>();
        List<Double> salMult = new ArrayList<>();
        List<Vector2D> tempVect = new ArrayList<>();
        List<Vector2D> salVect = new ArrayList<>();

        voltQueueSQL(getTemperatureStrip, lon - k, lat + k, lon - k, lat + k, month);
        VoltTable v = voltExecuteSQL()[0];

        for (int j = 0; j < v.getRowCount(); j++) {
            VoltTableRow row = v.fetchRow(j);

            Double thisLat = row.getDouble("a_lat");
            if (row.wasNull()) continue;

            Double thisLon = row.getDouble("a_lon");
            if (row.wasNull() || thisLon == lon || thisLat == lat) continue;

            Double thisTemp = row.getDouble("a_temp");
            if (!row.wasNull()) {
                tempVect.add(new Vector2D(1 / (thisLon - lon), 1 / (thisLat - lat)));
                tempMult.add(thisTemp);
            }

            Double thisSal = row.getDouble("a_salinity");
            if (!row.wasNull()) {
                salVect.add(new Vector2D(1 / (thisLon - lon), 1 / (thisLat - lat)));
                salMult.add(thisSal);
            }
        }

        Vector2D posTempSum = new Vector2D(tempMult, tempVect);
        Vector2D posSaltSum = new Vector2D(salMult, salVect);

        Vector2D posTempPosSaltSum = new Vector2D(1.0, posTempSum, 1.0, posSaltSum);
        Vector2D posTempNegSaltSum = new Vector2D(1.0, posTempSum, -1.0, posSaltSum);
        Vector2D negTempPosSaltSum = new Vector2D(-1.0, posTempSum, 1.0, posSaltSum);
        Vector2D negTempNegSaltSum = new Vector2D(-1.0, posTempSum, -1.0, posSaltSum);


        double posTempDegrees = toDegrees(posTempSum);
        double posSaltDegrees = toDegrees(posSaltSum);
        double negTempDegrees = (posTempDegrees + 180.0) % 360.0;
        double negSaltDegrees = (posSaltDegrees + 180.0) % 360.0;

        double posTempSaltPosSaltDegrees = toDegrees(posTempPosSaltSum);
        double posTempSaltNegSaltDegrees = toDegrees(posTempNegSaltSum);
        double negTempSaltPosSaltDegrees = toDegrees(negTempPosSaltSum);
        double negTempSaltNegSaltDegrees = toDegrees(negTempNegSaltSum);

        voltQueueSQL(multiUpdateSteering, posTempDegrees, negTempDegrees, posSaltDegrees, negSaltDegrees, posTempSaltPosSaltDegrees, posTempSaltNegSaltDegrees, negTempSaltPosSaltDegrees, negTempSaltNegSaltDegrees);
        voltQueueSQL(getSteering);

        VoltTable result[] = voltExecuteSQL();

        return result[1];

    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:72,代码来源:MultiSteering.java

示例13: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public VoltTable run() {

        voltQueueSQL(getCurrentLocation);
        VoltTable i[] = voltExecuteSQL();

        Double lat = i[0].fetchRow(0).getDouble("c_lat");
        Double lon = i[0].fetchRow(0).getDouble("c_lon");
        Integer month = new Integer( (int) i[0].fetchRow(0).getLong("c_month"));

//        Double a = SeaflowUtil.roundToHalf(lon);
//        Double b = SeaflowUtil.roundToHalf(lat);

        int k = 3;

        List<Double> mult = new ArrayList<>();
        List<Vector2D> vect = new ArrayList<>();

        voltQueueSQL(getTemperatureStrip, lon-k, lat+k, lon-k, lat+k, month);
        VoltTable v = voltExecuteSQL()[0];

        for(int j=0; j < v.getRowCount(); j++) {
            VoltTableRow row = v.fetchRow(j);
            Double thisLat = row.getDouble("a_lat");
            Double thisLon = row.getDouble("a_lon");
            Double thisTemp = row.getDouble("a_temp");
            if(row.wasNull())
            	continue;

            if(thisLon != lon && thisLat != lat) {
                vect.add( new Vector2D( 1 / (thisLon - lon), 1 / ( thisLat - lat)) );
                mult.add( thisTemp );
            }
        }

        
        Vector2D sum = new Vector2D(mult, vect);

        double tangent = Math.abs(sum.getY().doubleValue()) / Math.abs(sum.getX().doubleValue());
        double degrees = Math.toDegrees(Math.atan(tangent));
        
        if (sum.getX() >= 0 && sum.getY() >= 0) {
            degrees += 0.0;
        } else if (sum.getX() <= 0 && sum.getY() >= 0) {
            degrees += 90.0;
        } else if (sum.getX() <= 0 && sum.getY() <= 0) {
            degrees += 180.0;
        } else if(sum.getX() >= 0 && sum.getY() <= 0) {
            degrees += 270.0;
        }

        voltQueueSQL(updateSteering, degrees);
        voltQueueSQL(getSteering);

        VoltTable result[] = voltExecuteSQL();

        return result[1];

    }
 
开发者ID:s-store,项目名称:s-store,代码行数:59,代码来源:Steering.java

示例14: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public long run(int partId, VoltTable sp1Data, long[] extraArgs) {
  	

for (int i=0; i < sp1Data.getRowCount(); i++) {
	VoltTableRow row = sp1Data.fetchRow(i);
	String T_ST_ID = row.getString("T_ST_ID");
	String T_TT_ID = row.getString("T_TT_ID");
	
	//get date and time
	String T_DTS = row.getString("T_DTS");
	String date = T_DTS.split(" ")[0];
	
	
	String[] time = T_DTS.split(" ")[1].split(":");
	int hour = new Integer(time[0]);
	int min = new Integer(time[1]);
	int sec = new Integer(time[2]);
	
	voltQueueSQL(getStatus, T_ST_ID, partId);
	voltQueueSQL(getTradeType, T_TT_ID, partId);
	voltQueueSQL(getDateID, date, partId);
	voltQueueSQL(getTimeID, hour,min,sec, partId);
	VoltTable[] results = voltExecuteSQL();
	
	String status = results[0].fetchRow(0).getString(0);
	String type = results[1].fetchRow(0).getString(0);
	String symbol = row.getString("T_S_SYMB");
	long SK_CreateDateID = -1;
	long SK_CreateTimeID = -1;
	long SK_CloseDateID = -1;
	long SK_CloseTimeID = -1;
	
	if((T_ST_ID.equals("SBMT") && (T_TT_ID.equals("TMB") || T_TT_ID.equals("TMS"))) || T_ST_ID.equals("PNDG")) {
		SK_CreateDateID = results[2].fetchRow(0).getLong(0);
		SK_CreateTimeID = results[3].fetchRow(0).getLong(0);
	}
	else if (T_ST_ID.equals("CMPT") || T_ST_ID.equals("CNCL")) {
		SK_CloseDateID = results[2].fetchRow(0).getLong(0);
		SK_CloseTimeID = results[3].fetchRow(0).getLong(0);
	}
	
	voltQueueSQL(insertSP2Out, row.getLong("T_ID"), SK_CreateDateID, SK_CreateTimeID, SK_CloseDateID, SK_CloseTimeID,
			status, type, (short) row.getLong("T_IS_CASH"), symbol, (int) row.getLong("T_QTY"),
			row.getDouble("T_BID_PRICE"), (int) row.getLong("T_CA_ID"), row.getString("T_EXEC_NAME"),
			row.getDouble("T_TRADE_PRICE"), row.getDouble("T_CHRG"), row.getDouble("T_COMM"), row.getDouble("T_TAX"),
			row.getLong("batch_id"), partId);

	int destinationPartition = TPCDIUtil.hashCode(TPCDIConstants.DIMSECURITY_TABLE,symbol);
	voltExecuteSQLDownStream("SP2out", destinationPartition);
}

      // Set the return value to 0: successful vote
      return TPCDIConstants.PROC_SUCCESSFUL;
  }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:55,代码来源:SP2GetTypes.java

示例15: run

import org.voltdb.VoltTable; //导入方法依赖的package包/类
public long run(int partId, VoltTable sp1Data, long[] extraArgs) {
  	

for (int i=0; i < sp1Data.getRowCount(); i++) {
	VoltTableRow row = sp1Data.fetchRow(i);
	String T_ST_ID = row.getString("T_ST_ID");
	String T_TT_ID = row.getString("T_TT_ID");
	
	//get date and time
	String T_DTS = row.getString("T_DTS");
	String date = T_DTS.split(" ")[0];
	
	
	String[] time = T_DTS.split(" ")[1].split(":");
	int hour = new Integer(time[0]);
	int min = new Integer(time[1]);
	int sec = new Integer(time[2]);
	
	voltQueueSQL(getStatus, T_ST_ID, partId);
	voltQueueSQL(getTradeType, T_TT_ID, partId);
	voltQueueSQL(getDateID, date, partId);
	voltQueueSQL(getTimeID, hour,min,sec, partId);
	VoltTable[] results = voltExecuteSQL();
	
	String status = results[0].fetchRow(0).getString(0);
	String type = results[1].fetchRow(0).getString(0);
	String symbol = row.getString("T_S_SYMB");
	long SK_CreateDateID = -1;
	long SK_CreateTimeID = -1;
	long SK_CloseDateID = -1;
	long SK_CloseTimeID = -1;
	
	if((T_ST_ID.equals("SBMT") && (T_TT_ID.equals("TMB") || T_TT_ID.equals("TMS"))) || T_ST_ID.equals("PNDG")) {
		SK_CreateDateID = results[2].fetchRow(0).getLong(0);
		SK_CreateTimeID = results[3].fetchRow(0).getLong(0);
	}
	else if (T_ST_ID.equals("CMPT") || T_ST_ID.equals("CNCL")) {
		SK_CloseDateID = results[2].fetchRow(0).getLong(0);
		SK_CloseTimeID = results[3].fetchRow(0).getLong(0);
	}
	
	voltQueueSQL(insertSP2Out, row.getLong("T_ID"), SK_CreateDateID, SK_CreateTimeID, SK_CloseDateID, SK_CloseTimeID,
			status, type, (short) row.getLong("T_IS_CASH"), symbol, (int) row.getLong("T_QTY"),
			row.getDouble("T_BID_PRICE"), (int) row.getLong("T_CA_ID"), row.getString("T_EXEC_NAME"),
			row.getDouble("T_TRADE_PRICE"), row.getDouble("T_CHRG"), row.getDouble("T_COMM"), row.getDouble("T_TAX"),
			row.getLong("batch_id"), partId);

	int destinationPartition = TPCDIUtil.hashCode(symbol, TPCDIConstants.NUM_PARTITIONS);
	voltExecuteSQLDownStream("SP2out", destinationPartition);
}

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


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