Package org.apache.tuscany.das.rdb

Examples of org.apache.tuscany.das.rdb.Command.execute()


        // 19:29:52.636')";
        String sql = "insert into conmgt.serverstatus (managedserverid, timestamp) "
                + "values (316405209, '2005-11-23 19:29:52.636')";
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command insert = das.createCommand(sql);
        insert.execute();

        // Verify
        Command select = das.createCommand("Select * from conmgt.serverstatus where statusid = 316405209");
        DataObject root = select.executeQuery();
        assertEquals(1, root.getList("conmgt.serverstatus").size());
View Full Code Here


        DataObject customer = root.getDataObject("CUSTOMER[1]");
        // Verify
        assertEquals(1, customer.getInt("ID"));

        Command update = das.createCommand("update CUSTOMER set LASTNAME = 'modified' where ID = 1");
        update.execute();

        customer.setString("ADDRESS", "main street");

        das.applyChanges(root);
View Full Code Here

    // Simplest possible SP write
    public void testDelete() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command delete = das.createCommand("{call DELETECUSTOMER(?)}");
        delete.setParameter(1, Integer.valueOf(1));
        delete.execute();

        // Verify DELETE
        Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
        DataObject root = select.executeQuery();
        assertTrue(root.getList("CUSTOMER").isEmpty());
View Full Code Here

        assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick"));
        int id = root.getInt("CUSTOMER[1]/ID");

        Command update = das.getCommand("update customer");
        update.setParameter(1, Integer.valueOf(id));
        update.execute();

        // Verify update - reuse select command
        root = read.executeQuery();
        assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME"));
View Full Code Here

        book.setInt("QUANTITY", 2);

        // Explicitly change OCC column in database to force collision
        Command update = das.getCommand("update book 1");
        update.setParameter(1, new Integer(100));
        update.execute();

        // Try to apply changes and catch the expected An update collision occurred
        try {
            das.applyChanges(root);
            fail("An OCCException should be thrown");
View Full Code Here

    }

    public void testInsert() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command insert = das.createCommand("insert into CUSTOMER values (10, 'Williams', '5528 Wells Fargo Dr')");
        insert.execute();

        // Verify
        Command select = das.createCommand("Select * from CUSTOMER where ID = 10");
        DataObject root = select.executeQuery();
        assertEquals(1, root.getList("CUSTOMER").size());
View Full Code Here

        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command insert = das.createCommand("insert into CUSTOMER values (?, ?, ?)");
        insert.setParameter(1, Integer.valueOf(10));
        insert.setParameter(2, "Williams");
        insert.setParameter(3, "5528 Wells Fargo Dr");
        insert.execute();

        // Verify
        Command select = das.createCommand("Select * from CUSTOMER where ID = 10");
        DataObject root = select.executeQuery();
        assertEquals(1, root.getList("CUSTOMER").size());
View Full Code Here

        DataObject root = select.executeQuery();
        assertEquals(1, root.getList("CUSTOMER").size());

        // Create and execute the delete command
        Command delete = das.createCommand("delete from CUSTOMER where ID = 1");
        delete.execute();

        // Verify delete by reusing the original select command
        root = select.executeQuery();
        assertEquals(0, root.getList("CUSTOMER").size());
View Full Code Here

        Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
        DataObject root = select.executeQuery();
        assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick"));

        Command update = das.createCommand("update CUSTOMER set LASTNAME = 'Pavick' where ID = 1");
        update.execute();

        // Verify update - reuse select command
        root = select.executeQuery();
        assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME"));

View Full Code Here

        assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick"));

        Command update = das.createCommand("update CUSTOMER set LASTNAME = ? where ID = ?");
        update.setParameter(1, "Pavick");
        update.setParameter(2, Integer.valueOf(1));
        update.execute();

        // Verify update - reuse select command
        root = select.executeQuery();
        assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.