Package org.apache.tuscany.das.rdb

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


        insert.setParameterValue("NAME", "AAA Rental");
        insert.execute();

        // insert another using same command
        insert.setParameterValue("NAME", "BBB 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 testInsert3() throws Exception {

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

        // Verify insert
        Command select = Command.FACTORY.createCommand("Select ID, NAME from COMPANY where ID = :ID");
        select.setConnection(getConnection());
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", "");
        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

        // Verify
        assertEquals(1, customer.getInt("ID"));

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

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

        ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand();
        apply.setConnection(getConnection());
View Full Code Here

  public void testDelete() throws Exception {
   
    Command delete = Command.FACTORY.createCommand("{call DELETECUSTOMER(?)}")
    delete.setConnection(getConnection());
    delete.setParameterValue(1, new Integer(1));
    delete.execute();

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

        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command insert = das.createCommand(sql);
        insert.setParameter(1, Integer.valueOf(316405209));
        insert.setParameter(2, "2005-11-23 19:29:52.636");
        insert.execute();

        // Verify
        Command select = das.createCommand("Select * from conmgt.SERVERSTATUS");
        DataObject root = select.executeQuery();
        assertEquals(1, root.getList("SERVERSTATUS").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, null);
        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

        insert.setParameter(1, Integer.valueOf(10));
        // insert.setParameterValue("LASTNAME", null);
        insert.setParameter(3, "5528 Wells Fargo Dr");

        try {
            insert.execute();
            fail();
        } catch (RuntimeException e) {
            // Expected since "LASTNAME" parameter not set
        }
    }
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, "");
        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

        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, null);
        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.