Package org.apache.tuscany.das.rdb

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


        Command insert = das.createCommand("insert into CUSTOMER (ID, LASTNAME, ADDRESS) values (?, ?, ?)");
        String key = "10";
        insert.setParameter(1, key);
        insert.setParameter(2, "CUST10");
        insert.setParameter(3, "ADDR10");
        insert.execute();
       
        // Verify insert
        Command select = das.createCommand("Select ID, LASTNAME from CUSTOMER where ID = ?");
        select.setParameter(1, key);
        DataObject root = select.executeQuery();
View Full Code Here


        Command insert = das.createCommand("insert into CUSTOMER (ID, LASTNAME, ADDRESS) values (?, ?, ?)");
        String key = "10";
        insert.setParameter(1, key);
        insert.setParameter(2, "CUST10");
        insert.setParameter(3, "ADDR10");
        insert.execute();
        try{
          Integer retkey = new Integer(insert.getGeneratedKey());
          fail("Should not be able to retrieve key "+retkey);
        }catch(RuntimeException e){
          //e.printStackTrace();
View Full Code Here

        Command insert = das.createCommand("insert into CUSTOMER (ID, LASTNAME, ADDRESS) values (?, ?, ?)");
        String key = "10";
        insert.setParameter(1, key);
        insert.setParameter(2, "CUST10");
        insert.setParameter(3, "ADDR10");
        insert.execute();
       
        // Verify insert
        Command select = das.createCommand("Select ID, LASTNAME from CUSTOMER where ID = ?");
        select.setParameter(1, key);
        DataObject root = select.executeQuery();
View Full Code Here

        Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
        DataObject root = select.executeQuery();

        // Explicitly update the DB to force a collision
        Command update = das.createCommand("update CUSTOMER set LASTNAME = 'Smith' where ID = 1");
        update.execute();
       
        DataObject customer = root.getDataObject("CUSTOMER[1]");

        // Modify customer
        customer.set("LASTNAME", "Pavick");
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

        // 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 = 1");
        DataObject root = select.executeQuery();
               
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

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

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

        // Verify update - reuse select command
        root = read.executeQuery();
        assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME"));
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, new Integer(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

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.