Package org.apache.tuscany.das.rdb

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


            DataObject root = select.executeQuery();
            accountLog.getAccountLogEntries().addAll(root.getList("AccountLogEntry"));

            select = das.createCommand("SELECT logSeqNo, Symbol, quantity, actionType, purchaseLotNumber  FROM stockLog where id = ?");
            select.setParameter(1, customerID);
            root = select.executeQuery();
            accountLog.getStockLogEntries().addAll(root.getList("StockLogEntry"));

            conn.close();

            return accountLog;
View Full Code Here


        CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustomersOrdersConfig.xml"));
        commandGroup.setConnection(getConnection());

        Command read = commandGroup.getCommand("all customers");
        DataObject root = read.executeQuery();

        assertEquals(5, root.getList("CUSTOMER").size());

    }
View Full Code Here

        CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustOrdersConnectionProps.xml"));

        Command read = commandGroup.getCommand("order by id with ?");
        read.setParameterValue(1, new Integer(1));
        DataObject root = read.executeQuery();

        assertEquals("recombobulator", root.getString("ANORDER[1]/PRODUCT"));

    }  
   
View Full Code Here

    public void testReadWithConnectionProperties() throws Exception {

        CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustOrdersConnectionProps.xml"));

        Command read = commandGroup.getCommand("all customers");
        DataObject root = read.executeQuery();

        assertEquals(5, root.getList("CUSTOMER").size());

    }
View Full Code Here

    public void testUpdate() throws Exception {

        CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustOrdersConnectionProps.xml"));

        Command read = commandGroup.getCommand("all customers");
        DataObject root = read.executeQuery();
        // Verify precondition
        assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick"));
        int id = root.getInt("CUSTOMER[1]/ID");

        Command update = commandGroup.getCommand("update customer");
View Full Code Here

        CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustomersOrdersConfig.xml"));
        commandGroup.setConnection(getConnection());

        // Read all customers and remember the first one
        Command read = commandGroup.getCommand("all customers");
        DataObject root = read.executeQuery();
        Integer id = (Integer) root.get("CUSTOMER[1]/ID");

        // Read the specific Customer from above and its related orders
        Command custOrders = commandGroup.getCommand("customer and orders");
        custOrders.setParameterValue("ID", id);
View Full Code Here

        Integer id = (Integer) root.get("CUSTOMER[1]/ID");

        // Read the specific Customer from above and its related orders
        Command custOrders = commandGroup.getCommand("customer and orders");
        custOrders.setParameterValue("ID", id);
        root = custOrders.executeQuery();

        // Modify the first order and flush this change back to the database
        root.setString("CUSTOMER[1]/orders[1]/PRODUCT", "Defibrillator");
        Integer orderId = (Integer) root.get("CUSTOMER[1]/orders[1]/ID");
        ApplyChangesCommand flush = commandGroup.getApplyChangesCommand();
View Full Code Here

        readCustomers.setResultSetShape(shape);

        readCustomers.setConnection(getConnection());

        // Read
        DataObject root = readCustomers.executeQuery();

        // Verify
        assertEquals(5, root.getList("CUSTOMER").size());
        assertEquals(99, root.getInt("CUSTOMER[1]/ID"));
        assertEquals("Roosevelt", root.getString("CUSTOMER[1]/LASTNAME"));
View Full Code Here

        // Create and initialize command to read customers
        Command readCustomers = Command.FACTORY.createCommand(sqlString);
        readCustomers.setConnection(getConnection());

        // Read
        DataObject root = readCustomers.executeQuery();

        // Verify
        try {
            assertEquals(5, root.getList("CUSTOMER").size());
            fail("Should fail since there will be no feature named CUSTOMER");
View Full Code Here

  public void testRead() throws Exception {

    //Read customer 1
    Command select = Command.FACTORY.createCommand("Select * from TYPETEST where ID = 1")
    select.setConnection(getConnection());
    DataObject root = select.executeQuery();
   
    DataObject types = (DataObject)root.get("TYPETEST[1]");
   
    java.sql.Timestamp ts = (java.sql.Timestamp)types.get("ATIMESTAMP");
    assertEquals(ts, TypesData.getTimestamp());
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.