Package org.voltdb

Examples of org.voltdb.VoltTable$Row


        " WHERE custid = ?"
    );
 
    public VoltTable run(long acctId) {
        voltQueueSQL(GetAccount, acctId);
        VoltTable results[] = voltExecuteSQL();
       
        if (results[0].getRowCount() != 1) {
            String msg = "Invalid account '" + acctId + "'";
            throw new VoltAbortException(msg);
        }
        // long acctId = results[0].asScalarLong();
       
        voltQueueSQL(GetSavingsBalance, acctId);
        voltQueueSQL(GetCheckingBalance, acctId);
        results = voltExecuteSQL(true);
       
        if (results[0].getRowCount() != 1) {
            String msg = String.format("No %s for customer #%d",
                                       SmallBankConstants.TABLENAME_SAVINGS,
                                       acctId);
            throw new VoltAbortException(msg);
        }
        if (results[1].getRowCount() != 1) {
            String msg = String.format("No %s for customer #%d",
                                       SmallBankConstants.TABLENAME_CHECKING,
                                       acctId);
            throw new VoltAbortException(msg);
        }
        results[0].advanceRow();
        results[1].advanceRow();
        double total = results[0].getDouble(0) + results[1].getDouble(0);
       
        final VoltTable finalResult = new VoltTable(RESULT_COLS);
        finalResult.addRow(total);
        return (finalResult);
    }
View Full Code Here


        " WHERE custid = ?"
    );
   
    public VoltTable run(long acctId, double amount) {
        voltQueueSQL(GetAccount, acctId);
        VoltTable results[] = voltExecuteSQL();
       
        if (results[0].getRowCount() != 1) {
            String msg = "Invalid account '" + acctId + "'";
            LOG.error(msg);
            throw new VoltAbortException(msg);
View Full Code Here

   
    public VoltTable[] run(long sendAcct, long destAcct, double amount) {
        // Get Account Information
        voltQueueSQL(GetAccount, sendAcct);
        voltQueueSQL(GetAccount, destAcct);
        final VoltTable acctResults[] = voltExecuteSQL();
        if (acctResults[0].getRowCount() != 1) {
            String msg = "Invalid sender account '" + sendAcct + "'";
            LOG.error(this.getTransactionState() + " - " + msg + " / hash=" + TheHashinator.hashToPartition(sendAcct));
            throw new VoltAbortException(msg);
        }
        else if (acctResults[1].getRowCount() != 1) {
            String msg = "Invalid destination account '" + destAcct + "'";
            LOG.error(this.getTransactionState() + " - " + msg + " / hash=" + TheHashinator.hashToPartition(destAcct));
            throw new VoltAbortException(msg);
        }
       
        // Get the sender's account balance
        voltQueueSQL(GetCheckingBalance, sendAcct);
        final VoltTable balResults[] = voltExecuteSQL();
        if (balResults[0].getRowCount() != 1) {
            String msg = String.format("No %s for customer #%d",
                                       SmallBankConstants.TABLENAME_SAVINGS,
                                       sendAcct);
            LOG.error(msg);
View Full Code Here

        " WHERE custid = ?"
    );
   
    public VoltTable run(long acctId, double amount) {
        voltQueueSQL(GetAccount, acctId);
        VoltTable results[] = voltExecuteSQL();
       
        if (results[0].getRowCount() != 1) {
            String msg = "Invalid account name '" + acctId + "'";
            throw new VoltAbortException(msg);
        }
View Full Code Here

        " WHERE custid = ?"
    );
   
    public VoltTable run(long acctId, double amount) {
        voltQueueSQL(GetAccount, acctId);
        VoltTable results[] = voltExecuteSQL();
       
        if (results[0].getRowCount() != 1) {
            String msg = "Invalid account name '" + acctId + "'";
            throw new VoltAbortException(msg);
        }
View Full Code Here

   
    public VoltTable run(long acctId0, long acctId1) {
        // Get Account Information
        voltQueueSQL(GetAccount, acctId1);
        voltQueueSQL(GetAccount, acctId0);
        final VoltTable acctResults[] = voltExecuteSQL();
        if (acctResults[0].getRowCount() != 1) {
            String msg = "Invalid account '" + acctId0 + "'\n" + acctResults[0];
            LOG.error(this.getTransactionState() + " - " + msg + " / hash=" + TheHashinator.hashToPartition(acctId0));
            throw new VoltAbortException(msg);
        }
        if (acctResults[1].getRowCount() != 1) {
            String msg = "Invalid account '" + acctId1 + "'\n" + acctResults[1];
            LOG.error(this.getTransactionState() + " - " + msg + " / hash=" + TheHashinator.hashToPartition(acctId1));
            throw new VoltAbortException(msg);
        }
       
        // Get Balance Information
        voltQueueSQL(GetSavingsBalance, acctId0);
        voltQueueSQL(GetCheckingBalance, acctId1);
        final VoltTable balResults[] = voltExecuteSQL();
        if (balResults[0].getRowCount() != 1) {
            String msg = String.format("No %s for customer #%d",
                                       SmallBankConstants.TABLENAME_SAVINGS,
                                       acctId0);
            LOG.error(msg);
View Full Code Here

       
    public void testTPCC() throws IOException, InterruptedException, ProcCallException {
       
        System.out.println("Starting testTPCC - Physical Recovery");               
      
        VoltTable results[] = null;
        ClientResponse cresponse = null;
        Client client = this.getClient();
        CatalogContext cc = this.getCatalogContext();      

        // Load database       
View Full Code Here

        Client client = this.getClient();
        String procName = VoltSystemProcedure.procCallName(AdHoc.class);
        ClientResponse cr;
       
        cr = client.callProcedure(procName, "INSERT INTO NEW_ORDER VALUES (1, 1, 1);");
        VoltTable modCount = cr.getResults()[0];
        assertTrue(modCount.getRowCount() == 1);
        assertTrue(modCount.asScalarLong() == 1);

        cr = client.callProcedure(procName, "SELECT * FROM NEW_ORDER;");
        VoltTable result = cr.getResults()[0];
        assertTrue(result.getRowCount() == 1);
        // System.out.println(result.toString());

        boolean caught = false;
        try {
            client.callProcedure("@AdHoc", "SLEECT * FROOM NEEEW_OOORDERERER;");
View Full Code Here

        this.initializeDatabase(client, NUM_TUPLES);
       
        String query = "SELECT COUNT(*) FROM " + YCSBConstants.TABLE_NAME;
        ClientResponse cresponse = client.callProcedure("@AdHoc", query);
        assertEquals(Status.OK, cresponse.getStatus());
        VoltTable results[] = cresponse.getResults();
        assertEquals(1, results.length);
        assertEquals(NUM_TUPLES, results[0].asScalarLong());
        System.err.println(results[0]);
    }
View Full Code Here

        ClientResponse cresponse = client.callProcedure(procName, params);
        assertNotNull(cresponse);
        assertEquals(Status.OK, cresponse.getStatus());
        assertEquals(1, cresponse.getResults().length);
       
        VoltTable vt = cresponse.getResults()[0];
        boolean adv = vt.advanceRow();
        assert(adv);
        assertEquals(key, vt.getLong(0));
    }
View Full Code Here

TOP

Related Classes of org.voltdb.VoltTable$Row

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.