Package org.apache.tuscany.das.rdb

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


 
  public void testReadTableInfo() throws Exception {
   
    Command select = Command.FACTORY.createCommand("SELECT * from SYSIBM.SYSTABLES WHERE TYPE = 'T'")
    select.setConnection(getConnection());
    DataObject root = select.executeQuery();
   
    DataObject table = (DataObject)root.get("SYSTABLES[1]");
   
    assertEquals('T', table.getChar("TYPE"));
     
View Full Code Here


    public void test_1() throws Exception {

        // Read a book instance
        Command select = Command.FACTORY.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1");
        select.setConnection(getConnection());
        DataObject root = select.executeQuery();
        DataObject book = root.getDataObject("BOOK[1]");
        // Change a field to mark the instance 'dirty'
        book.setInt("QUANTITY", 2);

        // Flush the change
View Full Code Here

    public void test_2() throws Exception {

        // Read a book instance
        Command select = Command.FACTORY.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1");
        select.setConnection(getConnection());
        DataObject root = select.executeQuery();
        DataObject book = root.getDataObject("BOOK[1]");
        // Change a field to mark the instance 'dirty'
        book.setInt("QUANTITY", 2);

        // Flush the change
View Full Code Here

        apply.setConnection(getConnection());

        apply.execute(root);

        // Verify
        root = select.executeQuery();
        book = root.getDataObject("BOOK[1]");
        assertEquals(2, book.getInt("QUANTITY"));
    }
   
   
View Full Code Here

        helper.addRelationship("CUSTOMER.ID", "ANORDER.CUSTOMER_ID");
       
        Command select = Command.FACTORY.createCommand(statement, helper.getConfig());
        select.setConnection(getConnection());

        DataObject root = select.executeQuery();
        DataObject customer = root.getDataObject("CUSTOMER[1]");

        assertEquals(2, customer.getList("ANORDER").size());

    }
View Full Code Here

       
        Command select = Command.FACTORY.createCommand(statement, helper.getConfig());
        select.setConnection(getConnection());
        select.setParameterValue("ID", new Integer(1));

        DataObject root = select.executeQuery();
       
        DataObject newBook = root.createDataObject("Book");
        newBook.setString("NAME", "Ant Colonies of the Old World");
        newBook.setInt("BOOK_ID", 1001);
        root.getList("Book").add(newBook);
View Full Code Here

        apply.setConnection(getConnection());
        apply.execute(root);
       
        //Verify
        select.setParameterValue("ID", new Integer(1001));
        root = select.executeQuery();
        assertEquals("Ant Colonies of the Old World", root.getString("Book[1]/NAME"));
       
    }
}
View Full Code Here

            select.setParameterValue("loginID", logonID);
            TypeHelper helper = TypeHelper.INSTANCE;

            select.setDataObjectModel(helper.getType(DataGraphRoot.class));

            DataGraphRoot root = (DataGraphRoot) select.executeQuery();
            conn.close();

            Collection customers = root.getCustomerProfileData();
            CustomerProfileData customerProfileData = (CustomerProfileData) customers.iterator().next();
           
View Full Code Here

        select.setParameterValue("loginID", logonID);
        TypeHelper helper = TypeHelper.INSTANCE;

        select.setDataObjectModel(helper.getType(DataGraphRoot.class));

        DataGraphRoot root = (DataGraphRoot) select.executeQuery();
        conn.close();

        Collection customers = root.getCustomerProfileData();
        CustomerProfileData customerProfileData = (CustomerProfileData) customers.iterator().next();
        return customerProfileData;
View Full Code Here

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

            // select.setDataObjectModel();
            TypeHelper helper = TypeHelper.INSTANCE;
            read.setDataObjectModel(helper.getType(DataGraphRoot.class));
            DataObject root = read.executeQuery();

            // Create a new stockPurchase
            DataObject customer = root.createDataObject("customerProfileData");

            // THIS SEEMS TO BE THE ONLY WAY TO DO THIS .. NO WAY TO JUST ADD AN EXISTING CUSTOMER.
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.