Package org.voltdb

Examples of org.voltdb.VoltTableRow


    }

    public VoltTable[] run(short w_id, byte d_id, double h_amount, short c_w_id, byte c_d_id, int c_id, TimestampType timestamp) {
        // assert (w_id == c_w_id); cross partition should be supported (at least in future)
        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);
    }
View Full Code Here


                    + " in warehouse: "
                    + c_w_id + " and in district " + c_d_id);
        }

        final int index = (namecnt-1)/2;
        final VoltTableRow customer = result.fetchRow(index);

        final long c_id = customer.getLong(0);
        return processPayment(w_id, d_id, h_amount, c_w_id, c_d_id, c_id, timestamp);
    }
View Full Code Here

        if (validation[0].getRowCount() != 1) {
            return ERR_INVALID_COUNTER;
        }

        VoltTableRow row = validation[0].fetchRow(0);

        // what happens when this overflows?
        long count = row.getLong(0)+inc;

        voltQueueSQL(updateCounterStmt, EXPECT_ONE_ROW, count, id, row.getLong(0));
        VoltTable result[] = voltExecuteSQL(true);

        // return the updated value
        return count;
    }
View Full Code Here

            // Randomly decide whether to delete (or update) the record
            if (rand.nextBoolean())
            {
                voltQueueSQL(delete, rowid);
                // Export deletion
                VoltTableRow row = item.fetchRow(0);
                voltQueueSQL(
                              export
                            , txid
                            , rowid
                            , row.get( 1, VoltType.TINYINT)
                            , row.get( 2, VoltType.TINYINT)
                            , row.get( 3, VoltType.TINYINT)
                            , row.get( 4, VoltType.SMALLINT)
                            , row.get( 5, VoltType.SMALLINT)
                            , row.get( 6, VoltType.INTEGER)
                            , row.get( 7, VoltType.INTEGER)
                            , row.get( 8, VoltType.BIGINT)
                            , row.get( 9, VoltType.BIGINT)
                            , row.get(10, VoltType.TIMESTAMP)
                            , row.get(11, VoltType.TIMESTAMP)
                            , row.get(12, VoltType.FLOAT)
                            , row.get(13, VoltType.FLOAT)
                            , row.get(14, VoltType.DECIMAL)
                            , row.get(15, VoltType.DECIMAL)
                            , row.get(16, VoltType.STRING)
                            , row.get(17, VoltType.STRING)
                            , row.get(18, VoltType.STRING)
                            , row.get(19, VoltType.STRING)
                            , row.get(20, VoltType.STRING)
                            , row.get(21, VoltType.STRING)
                            );
            }
            else
            {
                SampleRecord record = new SampleRecord(rowid, rand);
View Full Code Here

                                foundFullRowset = true;
                            }

                            // write out the rows
                            for (intCounter = 0; intCounter < rowCount; intCounter++) {
                                VoltTableRow row = vtArchiveVisits[0].fetchRow(intCounter);
                                playerId = row.getLong(0);
                                gameId = row.getLong(1);
                                socialId = row.getLong(2);
                                clientId = row.getLong(3);
                                visitTime = row.getLong(4);

                                Date visitDate = new Date(visitTime);

                                new PrintStream(fout).print(playerId + "\t" + gameId + "\t" + socialId + "\t" + clientId + "\t" + visitDate + "\n");
                            }
View Full Code Here

    }

    public VoltTable[] run(short w_id, byte d_id, double h_amount, short c_w_id, byte c_d_id, int c_id, TimestampType timestamp) {
        // assert (w_id == c_w_id); cross partition should be supported (at least in future)
        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);
    }
View Full Code Here

            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 customer = customers.fetchRow(index);
        final int c_id = (int)customer.getLong(C_ID_IDX);
        return processPayment(w_id, d_id, c_w_id, c_d_id, c_id, h_amount, customer, timestamp);
    }
View Full Code Here

                    " in warehouse: "
                    + c_w_id + " and in district " + c_d_id);
        }

        final int index = (namecnt-1)/2;
        final VoltTableRow customer = customers.fetchRow(index);
        final int c_id = (int)customer.getLong(C_ID_IDX);
        return processPayment(w_id, d_id, c_w_id, c_d_id, c_id, h_amount, customer, timestamp);
    }
View Full Code Here

        VoltTable customer = itemresults[item_id.length + 2];

        final double w_tax = itemresults[item_id.length].fetchRow(0).getDouble(0);
        final int D_TAX_COL = 0, D_NEXT_O_ID = 1;
        final int C_DISCOUNT = 0;
        final VoltTableRow tempRow = itemresults[item_id.length + 1].fetchRow(0);
        final double d_tax = tempRow.getDouble(D_TAX_COL);
        final double c_discount = itemresults[item_id.length + 2].fetchRow(0).getDouble(C_DISCOUNT);
        final long d_next_o_id = tempRow.getLong(D_NEXT_O_ID);
        final long ol_cnt = item_id.length;
        final long all_local = isAllLocal ? 1 : 0;

        voltQueueSQL(incrementNextOrderId, d_next_o_id + 1, d_id, w_id);
        voltQueueSQL(createOrder, d_next_o_id, d_id, w_id, c_id, timestamp,
                Constants.NULL_CARRIER_ID, ol_cnt, all_local);
        voltQueueSQL(createNewOrder, d_next_o_id, d_id, w_id);
        voltExecuteSQL();

        // values the client is missing: i_name, s_quantity, brand_generic, i_price, ol_amount
        final VoltTable item_data = item_data_template.clone(2048);

        double total = 0;
        for (int i = 0; i < item_id.length; ++i) {
            final long ol_supply_w_id = supware[i];
            final long ol_i_id = item_id[i];

            // One getStockInfo SQL statement for each district
            voltQueueSQL(getStockInfo[d_id-1], ol_i_id, ol_supply_w_id);
        }
        final VoltTable[] stockresults = voltExecuteSQL();
        assert stockresults.length == item_id.length;

        for (int i = 0; i < item_id.length; ++i) {
            final long ol_number = i + 1;
            final long ol_supply_w_id = supware[i];
            final long ol_i_id = item_id[i];
            final long ol_quantity = quantity[i];

            assert stockresults[i].getRowCount() == 1 : "Cannot find stock info for item; should not happen with valid database";
            final VoltTableRow itemInfo = items[i];
            final VoltTableRow stockInfo = stockresults[i].fetchRow(0);

            final int I_PRICE = 0, I_NAME = 1, I_DATA = 2;
            final byte[] i_name = itemInfo.getStringAsBytes(I_NAME);
            final byte[] i_data = itemInfo.getStringAsBytes(I_DATA);
            final double i_price = itemInfo.getDouble(I_PRICE);

            final int S_QUANTITY = 0, S_DATA = 1, S_YTD = 2, S_ORDER_CNT = 3, S_REMOTE_CNT = 4, S_DIST_XX = 5;
            long s_quantity = stockInfo.getLong(S_QUANTITY);
            long s_ytd = stockInfo.getLong(S_YTD);
            long s_order_cnt = stockInfo.getLong(S_ORDER_CNT);
            long s_remote_cnt = stockInfo.getLong(S_REMOTE_CNT);
            final byte[] s_data = stockInfo.getStringAsBytes(S_DATA);
            // Fetches data from the s_dist_[d_id] column
            final byte[] s_dist_xx = stockInfo.getStringAsBytes(S_DIST_XX);

            // Update stock
            s_ytd += ol_quantity;
            if (s_quantity >= ol_quantity + 10) {
                s_quantity = s_quantity - ol_quantity;
View Full Code Here

                // loop over all auction ids, printing a row of status for each one
                for (int auctionId : allAuctionIds) {
                    VoltTable[] statusResultSet = client.callProcedure("AuctionStatus", auctionId).getResults();
                    if (statusResultSet.length != 1) throw new Exception("AuctionStatus returned no results");
                    VoltTable statusTable = statusResultSet[0];
                    VoltTableRow row = statusTable.fetchRow(0);
                    System.out.printf("| %-20s | %-16s | %-16s | %5d | %8.2f | %9tT | %-6s |\n",
                            row.getString("item"), row.getString("bidder"), row.getString("seller"),
                            row.getLong("bidcount"), row.getDouble("price"),
                            row.getTimestampAsTimestamp("endtime").asApproximateJavaDate(),
                            row.getString("status"));
                    if (row.getString("status").equals("OPEN"))
                        auctionsOver = false;
                }

                // print the status footer
                System.out.printf("+-----------------------------------------------------" +
View Full Code Here

TOP

Related Classes of org.voltdb.VoltTableRow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.