Package org.apache.tuscany.das.rdb.config

Examples of org.apache.tuscany.das.rdb.config.ResultDescriptor


        // Read a customer
        Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1");
       
        List resultDescriptorList = new ArrayList();
       
        ResultDescriptor desc3 = factory.createResultDescriptor();
        desc3.setColumnIndex(1);//two times index is 1
        desc3.setColumnName("ADDRESS");
        desc3.setColumnType("commonj.sdo.String");
        desc3.setTableName("CUSTOMER");

        ResultDescriptor desc1 = factory.createResultDescriptor();
        desc1.setColumnIndex(1);
        desc1.setColumnName("ID");
        desc1.setColumnType("commonj.sdo.Int");
        desc1.setTableName("CUSTOMER");
       
        ResultDescriptor desc2 = factory.createResultDescriptor();
        desc2.setColumnIndex(2);
        desc2.setColumnName("LASTNAME");
        desc2.setColumnType("commonj.sdo.String");
        desc2.setTableName("CUSTOMER");
               
        resultDescriptorList.add(desc3);
        resultDescriptorList.add(desc1);
        resultDescriptorList.add(desc2);
View Full Code Here


    }   
   
    public void testAddRemoveResultDescriptor() throws Exception {
      ConfigFactory factory = ConfigFactory.INSTANCE;

      ResultDescriptor desc3 = factory.createResultDescriptor();
        desc3.setColumnIndex(3);//two times index is 1
        desc3.setColumnName("ADDRESS");
        desc3.setColumnType("commonj.sdo.String");
        desc3.setTableName("CUSTOMER");

      ResultDescriptor desc1 = factory.createResultDescriptor();
        desc1.setColumnIndex(1);
        desc1.setColumnName("ID");
        desc1.setColumnType("commonj.sdo.Int");
        desc1.setTableName("CUSTOMER");
       
        ResultDescriptor desc2 = factory.createResultDescriptor();
        desc2.setColumnIndex(2);
        desc2.setColumnName("LASTNAME");
        desc2.setColumnType("commonj.sdo.String");
        desc2.setTableName("CUSTOMER");

      DAS das = DAS.FACTORY.createDAS(getConnection());
        // Read a customer
        Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1");
        select.addResultDescriptor(desc3);
View Full Code Here

        // Read a customer
        Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1");
       
        List resultDescriptorList = new ArrayList();
        //as long as columnIndex is correct, order in ArrayList does not matter
        ResultDescriptor desc3 = factory.createResultDescriptor();
        desc3.setColumnIndex(3);
        desc3.setColumnName("ADDRESS");
        desc3.setColumnType("commonj.sdo.String");
        desc3.setTableName("CUSTOMER");

        ResultDescriptor desc1 = factory.createResultDescriptor();
        desc1.setColumnIndex(1);
        desc1.setColumnName("ID");
        desc1.setColumnType("commonj.sdo.Int");
        desc1.setTableName("CUSTOMER");
       
        ResultDescriptor desc2 = factory.createResultDescriptor();
        desc2.setColumnIndex(2);
        desc2.setColumnName("LASTNAME");
        desc2.setColumnType("commonj.sdo.String");
        desc2.setTableName("CUSTOMER");
               
        resultDescriptorList.add(desc3);
        resultDescriptorList.add(desc1);
        resultDescriptorList.add(desc2);
       
View Full Code Here

        tables = new String[size];
        types = new Type[size];
        schema = new String[size];

        for (int i = 0; i < size; i++) {
            ResultDescriptor desc = (ResultDescriptor) resultDescriptor.get(i);
            if(model.isDatabaseSchemaNameSupported()){
              if(desc.getSchemaName() != null && !desc.getSchemaName().equals("")){
                tables[i] = desc.getTableName();
                schema[i] = desc.getSchemaName();
              }else{
                tables[i] = desc.getTableName();
                schema[i] = "";
              }
               
            }else{
               tables[i] = desc.getTableName();
               schema[i] = "";
            }
            columns[i] = desc.getColumnName();

            int idx = desc.getColumnType().lastIndexOf('.');
            String uri = desc.getColumnType().substring(0, idx);
            String typeName = desc.getColumnType().substring(idx + 1);

            types[i] = helper.getType(uri, typeName);
            if (types[i] == null) {
                throw new RuntimeException("Could not find type " + desc.getColumnType()
                        + " for column " + desc.getColumnName());
            }
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.das.rdb.config.ResultDescriptor

Copyright © 2018 www.massapicom. 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.