Package org.apache.tuscany.das.rdb

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


        Command insert = commandGroup.getCommand("insert customer");
        insert.setParameterValue("ID", new Integer(10));
        insert.setParameterValue("LASTNAME", "Williams");
        insert.setParameterValue("ADDRESS", null);
        insert.execute();

        // Verify
        Command select = commandGroup.getCommand("read customer 10");
        DataObject root = select.executeQuery();
        assertEquals(1, root.getList("CUSTOMER").size());
View Full Code Here


        insert.setConnection(getConnection());
        insert.setParameterValue("ID", new Integer(10));
        insert.setParameterValue("LASTNAME", null);
        insert.setParameterType("LASTNAME", SDODataTypes.STRING);
        insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr");
        insert.execute();

        //Verify
        Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10");
        select.setConnection(getConnection());
        DataObject root = select.executeQuery();   
View Full Code Here

        insert.setParameterValue("ID", new Integer(10));
//        insert.setParameterValue("LASTNAME", null);
        insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr");
       
        try {
            insert.execute();
            fail();
        }
        catch (RuntimeException e) {
            //Expected since "LASTNAME" parameter not set
        }
View Full Code Here

    Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)")
    insert.setConnection(getConnection());
    insert.setParameterValue("ID", new Integer(10));
    insert.setParameterValue("LASTNAME", "Williams");
    insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr");
    insert.execute();

    //Verify
    Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10");
    select.setConnection(getConnection());
    DataObject root = select.executeQuery()
View Full Code Here

    assertEquals(1, root.getList("CUSTOMER").size())
   
    //Create and execute the delete command
    Command delete = Command.FACTORY.createCommand("delete from CUSTOMER where ID = 1");
    delete.setConnection(getConnection());
    delete.execute();
   
    //Verify delete by reusing the original select command
    root = select.executeQuery()
    assertEquals(0, root.getList("CUSTOMER").size());
   
View Full Code Here

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

    Command update = Command.FACTORY.createCommand("update CUSTOMER set LASTNAME = 'Pavick' where ID = 1")
    update.setConnection(getConnection());
    update.execute();
   
    //Verify update - reuse select command
    root = select.executeQuery()
    assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME"));
   
View Full Code Here

   
    Command update = Command.FACTORY.createCommand("update CUSTOMER set LASTNAME = :LASTNAME where ID = :ID")
    update.setConnection(getConnection());
    update.setParameterValue("LASTNAME", "Pavick");
    update.setParameterValue("ID", new Integer(1));
    update.execute();
   
    //Verify update - reuse select command
    root = select.executeQuery()
    assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME"));
   
View Full Code Here

       
        Command update = Command.FACTORY.createCommand("update CUSTOMER set LASTNAME = ? where ID = ?")
        update.setConnection(getConnection());
        update.setParameterValue(1, "Pavick");
        update.setParameterValue(2, new Integer(1));
        update.execute();
       
        //Verify update - reuse select command
        root = select.executeQuery();  
        assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME"));
       
View Full Code Here

    public void testInsert() throws Exception {

        Command insert = Command.FACTORY.createCommand("insert into COMPANY (NAME) values (:NAME)");
        insert.setConnection(getConnection());
        insert.setParameterValue("NAME", "AAA Rental");
        insert.execute();

        // Verify insert
        // Verify
        Command select = Command.FACTORY.createCommand("Select ID, NAME from COMPANY");
        select.setConnection(getConnection());
View Full Code Here

    public void testInsert2() throws Exception {

        Command insert = Command.FACTORY.createCommand("insert into COMPANY (NAME) values (:NAME)");
        insert.setConnection(getConnection());
        insert.setParameterValue("NAME", "AAA Rental");
        insert.execute();

        // insert another using same command
        insert.setParameterValue("NAME", "BBB Rental");
        insert.execute();
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.