Package org.voltdb

Examples of org.voltdb.VoltTableRow


        } catch (Exception e) {
            e.printStackTrace();
        }

        final int index = (namecnt-1)/2;
        final VoltTableRow customer = customers.fetchRow(index);
        final long c_id = customer.getLong(C_ID_IDX);

        voltQueueSQL(getWarehouse, W_ID);
        voltQueueSQL(getDistrict, W_ID, D_ID);
        final VoltTable[] results = voltExecuteSQL();
        final VoltTable warehouse = results[0];
        final VoltTable district = results[1];

        try {
            System.out.println("WAREHOUSE PRE: " + warehouse.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }

        voltQueueSQL(getWarehouses);
        VoltTable warehouses = voltExecuteSQL()[0];
        try {
            System.out.println("WAREHOUSE PRE: " + warehouses.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }

        voltQueueSQL(updateWarehouseBalance, paymentAmount, W_ID);
        voltQueueSQL(updateDistrictBalance, paymentAmount, W_ID, D_ID);
        voltExecuteSQL();

        voltQueueSQL(getWarehouses);
        warehouses = voltExecuteSQL()[0];
        try {
            System.out.println("WAREHOUSE PRE: " + warehouses.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }

        //do stuff to extract district and warehouse info.

        //customer info
        final byte[] c_first = customer.getStringAsBytes(C_FIRST_IDX);
        final byte[] c_middle = customer.getStringAsBytes(C_MIDDLE_IDX);
        final byte[] c_last = customer.getStringAsBytes(C_LAST_IDX);
        final byte[] c_street_1 = customer.getStringAsBytes(C_STREET_1_IDX);
        final byte[] c_street_2 = customer.getStringAsBytes(C_STREET_2_IDX);
        final byte[] c_city = customer.getStringAsBytes(C_CITY_IDX);
        final byte[] c_state = customer.getStringAsBytes(C_STATE_IDX);
        final byte[] c_zip = customer.getStringAsBytes(C_ZIP_IDX);
        final byte[] c_phone = customer.getStringAsBytes(C_PHONE_IDX);
        final TimestampType c_since = customer.getTimestampAsTimestamp(C_SINCE_IDX);
        final byte[] c_credit = customer.getStringAsBytes(C_CREDIT_IDX);
        final double c_credit_lim = customer.getDouble(C_CREDIT_LIM_IDX);
        final double c_discount = customer.getDouble(C_DISCOUNT_IDX);
        final double c_balance = customer.getDouble(C_BALANCE_IDX) - paymentAmount;
        final double c_ytd_payment = customer.getDouble(C_YTD_PAYMENT_IDX) + paymentAmount;
        final long c_payment_cnt = customer.getLong(C_PAYMENT_CNT_IDX) + 1;
        byte[] c_data;
        if (Arrays.equals(c_credit, Constants.BAD_CREDIT_BYTES)) {
            c_data = customer.getStringAsBytes(C_DATA_IDX);
            byte[] newData = (c_id + " " + D_ID + " " + W_ID + " " + D_ID + " " + W_ID  + " " + paymentAmount + "|").getBytes();

            int newLength = newData.length + c_data.length;
            if (newLength > Constants.MAX_C_DATA) {
                newLength = Constants.MAX_C_DATA;
View Full Code Here


        voltQueueSQL(truncate);
        voltQueueSQL(count);
        voltQueueSQL(scancount);
        VoltTable[] results = voltExecuteSQL(true);
        VoltTable data = results[1];
        VoltTableRow row = data.fetchRow(0);
        long optCount = row.getLong(0);
        if (optCount != 0) {
            throw new VoltAbortException("after truncate (opt) count not zero");
        }
        data = results[2];
        row = data.fetchRow(0);
        long scanCount = row.getLong(0);
        if (scanCount != 0) {
            throw new VoltAbortException("after truncate (scan) count not zero");
        }
        if (shouldRollback != 0) {
            throw new VoltAbortException("EXPECTED ROLLBACK");
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

        voltQueueSQL(truncate);
        voltQueueSQL(count);
        voltQueueSQL(scancount);
        VoltTable[] results = voltExecuteSQL(true);
        VoltTable data = results[1];
        VoltTableRow row = data.fetchRow(0);
        long optCount = row.getLong(0);
        if (optCount != 0) {
            throw new VoltAbortException("after truncate (opt) count not zero");
        }
        data = results[2];
        row = data.fetchRow(0);
        long scanCount = row.getLong(0);
        if (scanCount != 0) {
            throw new VoltAbortException("after truncate (scan) count not zero");
        }
        if (shouldRollback != 0) {
            throw new VoltAbortException("EXPECTED ROLLBACK");
View Full Code Here

        );

        // get the seller id and item name from ITEM table
        voltQueueSQL(getItemInfo, itemId);
        VoltTable itemTable = voltExecuteSQL()[0];
        VoltTableRow itemRow = itemTable.fetchRow(0);
        // resulting info:
        long sellerId = itemRow.getLong("SELLERID");
        String itemName = itemRow.getString("ITEMNAME");
        long endTime = itemRow.getTimestampAsLong("ENDTIME");
       
        long highBidId = itemRow.getLong("HIGHBIDID");

        // get high bid info
        voltQueueSQL(getBidInfo, highBidId);
        VoltTable statusTable = voltExecuteSQL()[0];
        VoltTableRow row = statusTable.fetchRow(0);
        // resulting info:
        long bidderId = row.getLong("BIDDERID");
        double bidPrice = row.getDouble("BIDPRICE");

        // count the number of bids on the auction
        voltQueueSQL(getBidCount, itemId);
        VoltTable bidCountTable = voltExecuteSQL()[0];
        VoltTableRow bidCountRow = bidCountTable.fetchRow(0);
        // resulting info:
        // the minus one is for the fake initial bid
        long bidCount = bidCountRow.getLong(0) - 1;

        // get the names of the bidder and seller
        voltQueueSQL(getUserName, sellerId);
        if (bidderId >= 0) {
            voltQueueSQL(getUserName, bidderId);
        }
        VoltTable[] nameTables = voltExecuteSQL();
        VoltTableRow sellerNameRow = nameTables[0].fetchRow(0);
        // we should always have a seller name
        String sellerName = sellerNameRow.getString("FIRSTNAME") + " " + sellerNameRow.getString("LASTNAME");
        // we might not always have a bidder name, so need this if statement
        String bidderName = "NO BIDDER";
        if (bidderId >= 0) {
            VoltTableRow bidderNameRow = nameTables[1].fetchRow(0);
            bidderName = bidderNameRow.getString("FIRSTNAME") + " " + bidderNameRow.getString("LASTNAME");
        }

        // check the timing and set the auction status accordingly
        String status = "OPEN";
        long now = new TimestampType().getTime();
View Full Code Here

        if (rowCount != 1) {
            throw new VoltAbortException(getClass().getName() +
                    " invalid row count " + rowCount + " for count query" +
                    " on dimension table for cid " + cid);
        }
        VoltTableRow row = dim.fetchRow(0);
        long c = row.getLong(0);
        switch ((int)c) {
        case 0:
            voltQueueSQL(d_Insert, cid, cid);
            results = voltExecuteSQL(true);
        case 1:
View Full Code Here

        final long cidallhash = MiscUtils.cheesyBufferCheckSum(data.getBuffer());

        // get the most recent row's data
        int rowCount = data.getRowCount();
        if (rowCount != 0) {
            VoltTableRow row = data.fetchRow(0);
            cnt = row.getLong("cnt") + 1;
            prevtxnid = row.getLong("txnid");
            prevrid = row.getLong("rid");
        }

        validateCIDData(data, getClass().getName());

        // check the rids monotonically increase
View Full Code Here

        final long cidallhash = MiscUtils.cheesyBufferCheckSum(data.getBuffer());

        // get the most recent row's data
        int rowCount = data.getRowCount();
        if (rowCount != 0) {
            VoltTableRow row = data.fetchRow(0);
            cnt = row.getLong("cnt") + 1;
            prevtxnid = row.getLong("txnid");
            prevrid = row.getLong("rid");
        }

        validateCIDData(data, getClass().getName());

        // check the rids monotonically increase
View Full Code Here

        voltQueueSQL(truncate);
        voltQueueSQL(count);
        voltQueueSQL(scancount);
        VoltTable[] results = voltExecuteSQL(true);
        VoltTable data = results[1];
        VoltTableRow row = data.fetchRow(0);
        long optCount = row.getLong(0);
        if (optCount != 0) {
            throw new VoltAbortException("after truncate (opt) count not zero");
        }
        data = results[2];
        row = data.fetchRow(0);
        long scanCount = row.getLong(0);
        if (scanCount != 0) {
            throw new VoltAbortException("after truncate (scan) count not zero");
        }
        if (shouldRollback != 0) {
            throw new VoltAbortException("EXPECTED ROLLBACK");
View Full Code Here

                continue;
            }
            assert otherresults[resultoffset + 0].getRowCount() == 1;
            assert otherresults[resultoffset + 1].getRowCount() == 1;
            final long c_id = (otherresults[resultoffset + 0].asScalarLong());
            final VoltTableRow row = otherresults[resultoffset + 1].fetchRow(0);
            final double ol_total = row.getDouble(0);
            final boolean ol_total_wasnull = row.wasNull();

            // If there are no order lines, SUM returns null. There should always be order lines.
            if (ol_total_wasnull) {
                throw new VoltAbortException(
                        "ol_total is NULL: there are no order lines. This should not happen");
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.