Package org.teiid.query.sql.lang

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


        Select select = new Select();
        ElementSymbol c1 = new ElementSymbol("c1", false); //$NON-NLS-1$
        select.addSymbol(c1);
        select.addSymbol(new ElementSymbol("c2", false));   //$NON-NLS-1$
       
        Into into = new Into(new GroupSymbol("#temp")); //$NON-NLS-1$
        Query q = new Query();
        q.setSelect(select);
        q.setFrom(from);
        q.setInto(into);
        helpTest("SELECT c1, c2 INTO #temp FROM m.g"//$NON-NLS-1$
View Full Code Here


        GroupSymbol srcGroup = QueryUtil.createResolvedGroup(srcGroupName, planEnv.getGlobalMetadata());
       
        String intoGroupName =  "#"+stageGroupName.replace('.', '_'); //$NON-NLS-1$
        GroupSymbol intoGroupSymbol = new GroupSymbol(intoGroupName);
               
        query.setInto(new Into(intoGroupSymbol));
       
        QueryResolver.resolveCommand(query, planEnv.getGlobalMetadata());
       
        Command cmd = QueryUtil.rewriteQuery(query, planEnv.getGlobalMetadata(), planEnv.context);
               
View Full Code Here

    /**
     * Validate query entitlements
     */
    protected void validateEntitlements(Query obj) {
        // If query contains SELECT INTO, validate INTO portion
        Into intoObj = obj.getInto();
        if ( intoObj != null ) {
            GroupSymbol intoGroup = intoObj.getGroup();
            List<ElementSymbol> intoElements = null;
            try {
                intoElements = ResolverUtil.resolveElementsInGroup(intoGroup, getMetadata());
            } catch (QueryMetadataException err) {
                handleException(err, intoGroup);
View Full Code Here

        query.setHaving(null);
        OrderBy orderBy = query.getOrderBy();
        query.setOrderBy(null);
        Limit limit = query.getLimit();
        query.setLimit(null);
        Into into = query.getInto();
        query.setInto(null);
        Set<Expression> newSelectColumns = new HashSet<Expression>();
        for (final Iterator iterator = groupBy.getSymbols().iterator(); iterator.hasNext();) {
            newSelectColumns.add(SymbolMap.getExpression((SingleElementSymbol)iterator.next()));
        }
View Full Code Here

    }
        makeSelectUnique(select, false);
       
        Query query = queryCommand.getProjectedQuery();
       
        Into into = query.getInto();
        query.setInto(null);
        Limit limit = query.getLimit();
        query.setLimit(null);
        query.setOrderBy(null);
       
View Full Code Here

    
     * @param query
     * @throws QueryValidatorException
     */
    private Insert rewriteSelectInto(Query query) throws TeiidProcessingException{
        Into into = query.getInto();
        try {
            List<ElementSymbol> allIntoElements = Util.deepClone(ResolverUtil.resolveElementsInGroup(into.getGroup(), metadata), ElementSymbol.class);
            Insert insert = new Insert(into.getGroup(), allIntoElements, Collections.emptyList());
            query.setInto(null);
            insert.setQueryExpression(query);
            return rewriteInsert(correctDatatypes(insert));
        } catch (QueryMetadataException err) {
            throw new QueryValidatorException(err, err.getMessage());
View Full Code Here

                type != Command.TYPE_UPDATE &&
                type != Command.TYPE_DELETE &&
                type != Command.TYPE_QUERY) { // SELECT INTO command
                handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_batch_command"),command); //$NON-NLS-1$
            } else if (type == Command.TYPE_QUERY) {
                Into into = ((Query)command).getInto();
                if (into == null) {
                    handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_batch_command"),command); //$NON-NLS-1$
                }
            }
        }
View Full Code Here

        assertEquals(projectedSymbols, qclone.getProjectedSymbols());
   
   
    public void testClone3() {
      Query q = sample2();
        q.setInto(new Into(new GroupSymbol("#foo"))); //$NON-NLS-1$
        Query qclone = (Query)q.clone();
        assertNotNull(qclone.getInto());
    }
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.lang.Into

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.