Examples of Select


Examples of org.tarantool.core.cmd.Select

    Tuple args = Tuple.create(ByteBuffer.wrap(call.getBody()).order(ByteOrder.LITTLE_ENDIAN), ByteOrder.LITTLE_ENDIAN);
    return packResult(request, callStub.call(this, call.getProcName(), call.getFlags(), args), Call.OP_CODE);
  }

  private Response executeSelect(Request request) {
    Select select = ((Select) request);
    List<Tuple> result = new ArrayList<Tuple>();
    for (int i = 0; i < select.getBody().length; i++) {
      Tuple key = Tuple.create(ByteBuffer.wrap(select.getBody()[i]).order(ByteOrder.LITTLE_ENDIAN), ByteOrder.LITTLE_ENDIAN);
      result.addAll(get(select.getSpace(), select.getIndex(), key));
    }
    shiftAndLimit(select.getOffset(), select.getLimit(), result);
    return packResult(request, result, Select.OP_CODE);
  }
View Full Code Here

Examples of org.teiid.language.Select

    }   

  private static TranslationUtility translationUtility = new TranslationUtility(exampleSalesforce());

  @Test public void testOr() throws Exception {
    Select command = (Select)translationUtility.parseCommand("select * from Account where Name = 'foo' or Stuff = 'bar'"); //$NON-NLS-1$
    SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
    visitor.visit(command);
    assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff, Account.Industry FROM Account WHERE (Account.AccountName = 'foo') OR (Account.Stuff = 'bar')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
  }
View Full Code Here

Examples of org.teiid.language.Select

    visitor.visit(command);
    assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff, Account.Industry FROM Account WHERE (Account.AccountName = 'foo') OR (Account.Stuff = 'bar')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
  }
 
  @Test public void testNot() throws Exception {
    Select command = (Select)translationUtility.parseCommand("select * from Account where not (Name = 'foo' and Stuff = 'bar')"); //$NON-NLS-1$
    SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
    visitor.visit(command);
    assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff, Account.Industry FROM Account WHERE (Account.AccountName != 'foo') OR (Account.Stuff != 'bar')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
  }
View Full Code Here

Examples of org.teiid.query.sql.lang.Select

     
      view.addAsParent(groupClone);
     
      PlanNode projectPlanNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
     
      Select allSymbols = new Select(groupingExpressions);
      allSymbols.addSymbols(aggregates);
      if (first) {
        first = false;
        QueryRewriter.makeSelectUnique(allSymbols, false);
        symbols = allSymbols.getSymbols();
      }
      projectPlanNode.setProperty(NodeConstants.Info.PROJECT_COLS, allSymbols.getSymbols());
        projectPlanNode.addGroups(view.getGroups());
       
        groupClone.addAsParent(projectPlanNode);
       
        if (planNode.getType() == NodeConstants.Types.ACCESS) {
View Full Code Here

Examples of org.teiid.query.sql.lang.Select

   
    @Test public void testOptionalFromClause9() {
        String sql = "SELECT b FROM (t1 LEFT OUTER JOIN /*+ optional */t2 on t1.a = t2.a) LEFT OUTER JOIN /*+ optional */t3 on t1.a = t3.a"; //$NON-NLS-1$
       
        Query query = new Query();
        Select select = new Select();
        select.addSymbol(new ElementSymbol("b"));//$NON-NLS-1$
        query.setSelect(select);
        From from = new From();
       
        UnaryFromClause ufc = new UnaryFromClause();
        ufc.setGroup(new GroupSymbol("t1")); //$NON-NLS-1$
View Full Code Here

Examples of org.teiid.query.sql.lang.Select

        Statement declStmt = new DeclareStatement(var1, shortType);
       
        //ifblock
        List symbols = new ArrayList();
        symbols.add(new ElementSymbol("a1"))//$NON-NLS-1$
        Select select = new Select(symbols);      
       
        From from = new From();
        from.addGroup(new GroupSymbol("g")); //$NON-NLS-1$
       
        Criteria criteria = new CompareCriteria(new ElementSymbol("a2"), CompareCriteria.EQ,  //$NON-NLS-1$
            new Constant(new Integer(5)));
       
        Query query = new Query();
        query.setSelect(select);
        query.setFrom(from);
        query.setCriteria(criteria);
       
        AssignmentStatement queryStmt = new AssignmentStatement(var1, query);
             
        Block ifBlock = new Block();     
        ifBlock.addStatement(queryStmt);
       
        //else block
        ElementSymbol var2 = new ElementSymbol("var2"); //$NON-NLS-1$
        Statement elseDeclStmt = new DeclareStatement(var2, shortType);    
       
        List elseSymbols = new ArrayList();
        elseSymbols.add(new ElementSymbol("b1"))//$NON-NLS-1$
        Select elseSelect = new Select(elseSymbols);
   
        Query elseQuery = new Query();
        elseQuery.setSelect(elseSelect);
        From elseFrom = (From)from.clone();
        UnaryFromClause ufc = new UnaryFromClause();
View Full Code Here

Examples of org.teiid.query.sql.lang.Select

    @Test public void testOptionMakeDependent1(){
        GroupSymbol g = new GroupSymbol("db.g"); //$NON-NLS-1$
        From from = new From();
        from.addGroup(g);

        Select select = new Select();
        ElementSymbol a = new ElementSymbol("a")//$NON-NLS-1$
        select.addSymbol(a);

        Option option = new Option();
        option.addDependentGroup("a.b.c"); //$NON-NLS-1$

        Query query = new Query();
View Full Code Here

Examples of org.teiid.query.sql.lang.Select

    @Test public void testOptionMakeDependent2(){
        GroupSymbol g = new GroupSymbol("db.g"); //$NON-NLS-1$
        From from = new From();
        from.addGroup(g);

        Select select = new Select();
        ElementSymbol a = new ElementSymbol("a")//$NON-NLS-1$
        select.addSymbol(a);

        Option option = new Option();
        option.addDependentGroup("a.b.c"); //$NON-NLS-1$
        option.addDependentGroup("d.e.f"); //$NON-NLS-1$
View Full Code Here

Examples of org.teiid.query.sql.lang.Select

    @Test public void testOptionMakeDependent3(){
        GroupSymbol g = new GroupSymbol("db.g"); //$NON-NLS-1$
        From from = new From();
        from.addGroup(g);

        Select select = new Select();
        ElementSymbol a = new ElementSymbol("a")//$NON-NLS-1$
        select.addSymbol(a);

        Option option = new Option();
        option.addDependentGroup("a.b.c"); //$NON-NLS-1$
        option.addDependentGroup("d.e.f"); //$NON-NLS-1$
        option.addDependentGroup("x.y.z"); //$NON-NLS-1$
View Full Code Here

Examples of org.teiid.query.sql.lang.Select

    @Test public void testOptionMakeNotDependent1(){
        GroupSymbol g = new GroupSymbol("db.g"); //$NON-NLS-1$
        From from = new From();
        from.addGroup(g);

        Select select = new Select();
        ElementSymbol a = new ElementSymbol("a")//$NON-NLS-1$
        select.addSymbol(a);

        Option option = new Option();
        option.addNotDependentGroup("a.b.c"); //$NON-NLS-1$

        Query query = new Query();
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.