Package org.apache.tuscany.das.rdb

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


      assertEquals(0, customers.size());

      //delete - cfg command with no param
      Command deleteNoParam = das.getCommand("deleteCustomerNoParam");
      deleteNoParam.setParameter("ID", new Integer(7));
      deleteNoParam.execute();
      select.setParameter("ID", new Integer(7));
      root = select.executeQuery();
      customers = root.getList("CUSTOMER");
      assertEquals(0, customers.size());     
    }
View Full Code Here


    //setup is over, now set values in params and execute
    Command insert = das.getCommand("insertCustomer");
    insert.setParameter("ID", new Integer(6));
    insert.setParameter("LASTNAME", "Anthony");
    insert.setParameter("ADDRESS", "IND");
    insert.execute();
   
    Command select = das.createCommand("select * from CUSTOMER where ID = ?");
      select.setParameter("ID", new Integer(6));
      DataObject root = select.executeQuery();
      List customers = root.getList("CUSTOMER");
View Full Code Here

      Command insertAdhoc = das.createCommand("insert into CUSTOMER values (?, ?, ?)");
      insertAdhoc.setParameter("ID", new Integer(6));
      insertAdhoc.setParameter("LASTNAME", "MyLastName");
      insertAdhoc.setParameter("ADDRESS", "MyLastAddress");
      assertEquals("MyLastAddress", insertAdhoc.getParameter("ADDRESS"));
      insertAdhoc.execute();
     
      Command select = das.createCommand("select * from CUSTOMER where ID = ?");
      select.setParameter("ID", new Integer(6));
      DataObject root = select.executeQuery();
      List customers = root.getList("CUSTOMER");
View Full Code Here

     
      //insert same image
      Command insert = das.createCommand("INSERT INTO DOCUMENTS_IMAGES (ID, PIC) VALUES (?,?)");
      insert.setParameter(1, new Integer(101));
      insert.setParameter(2, imgArray);
      insert.execute();
     
      //Select again
      Command readNew = das.createCommand("SELECT PIC FROM DOCUMENTS_IMAGES WHERE id = 101");
      root = readNew.executeQuery();
      result = root.getList("DOCUMENTS_IMAGES");
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, new Integer(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

        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command insert = das.createCommand(sql);
        insert.setParameter(1, new Integer(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, new Integer(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, new Integer(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, new Integer(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, new Integer(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.