Examples of QueryParser


Examples of org.teiid.query.parser.QueryParser

        super(name);
    }

    public static Call example() throws Exception {
        String sql = "EXEC pm1.sq3('x', 1)"; //$NON-NLS-1$
        Command command = new QueryParser().parseCommand(sql);
        QueryResolver.resolveCommand(command, TstLanguageBridgeFactory.metadata);               
        return TstLanguageBridgeFactory.factory.translate((StoredProcedure)command);
    }
View Full Code Here

Examples of org.teiid.query.parser.QueryParser

      svc.addPermission(addResource(DataPolicy.PermissionType.ALTER, "VQT.SmallA_2589")); //$NON-NLS-1$
        return svc;
    }

    private void helpTest(DataPolicyMetadata policy, String sql, QueryMetadataInterface metadata, String[] expectedInaccesible, VDBMetaData vdb) throws QueryParserException, QueryResolverException, TeiidComponentException {
        QueryParser parser = QueryParser.getQueryParser();
        Command command = parser.parseCommand(sql);
        QueryResolver.resolveCommand(command, metadata);
       
        vdb.addAttchment(QueryMetadataInterface.class, metadata);
       
        HashMap<String, DataPolicy> policies = new HashMap<String, DataPolicy>();
View Full Code Here

Examples of org.teiid.query.parser.QueryParser

       
        if (plan == null) {
            return null;
        }
       
        QueryParser parser = QueryParser.getQueryParser();
        try {
            subCommand = parser.parseUpdateProcedure(plan);
        } catch(QueryParserException e) {
            throw new QueryResolverException(e, "ERR.015.008.0045", QueryPlugin.Util.getString("ERR.015.008.0045", group, procCommand.getClass().getSimpleName())); //$NON-NLS-1$ //$NON-NLS-2$
        }
       
        return subCommand;
View Full Code Here

Examples of org.teiid.query.parser.QueryParser

    }

    //defect 9822
    @Test public void testStoredProcedure_9822() throws Exception {

        QueryParser parser = new QueryParser();
        Command command = parser.parseCommand("exec pm1.sp4(5)");             //$NON-NLS-1$
       
        // resolve
        QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
        QueryResolver.resolveCommand(command, metadata);
       
View Full Code Here

Examples of org.teiid.query.parser.QueryParser

        return new FakeMetadataFacade(store);
    }
   
    private Command helpGetCommand(String sql, FakeMetadataFacade metadata) throws TeiidComponentException, TeiidProcessingException {
        // parse
        QueryParser parser = new QueryParser();
        Command command = parser.parseCommand(sql);
       
        QueryResolver.resolveCommand(command, metadata);
        command = QueryRewriter.rewrite(command, metadata, null);
       
        return command;       
View Full Code Here

Examples of org.teiid.query.parser.QueryParser

       
        return command;       
    }

    private Criteria helpGetCriteria(String sql, FakeMetadataFacade metadata) throws QueryParserException, QueryResolverException, TeiidComponentException {
        QueryParser parser = new QueryParser();
        Criteria crit = parser.parseCriteria(sql);
  
        ResolverVisitor.resolveLanguageObject(crit, null, metadata);

        return crit;       
    }
View Full Code Here

Examples of org.teiid.query.parser.QueryParser

    }

    public void helpTestVisitor(String sql, String[] expectedGroups) {
        LanguageObject obj = null;
        try {
            QueryParser parser = new QueryParser();
            obj = parser.parseCommand(sql);
        } catch(TeiidException e) {
            fail("Unexpected exception while parsing: " + e.getFullMessage()); //$NON-NLS-1$
        }
       
        Collection actualGroups = GroupCollectorVisitor.getGroupsIgnoreInlineViews(obj, false);
View Full Code Here

Examples of org.teiid.query.parser.QueryParser

  }
 
  // ################################## TEST HELPERS ################################ 

  public static final CommandStatement sample1() {
    QueryParser parser = new QueryParser();   
    try {
      Query query = (Query) parser.parseCommand("Select x from y"); //$NON-NLS-1$
      return new CommandStatement(query);
    } catch(Exception e) { return null;}
  }
View Full Code Here

Examples of org.teiid.query.parser.QueryParser

      return new CommandStatement(query);
    } catch(Exception e) { return null;}
  }

  public static final CommandStatement sample2() {
    QueryParser parser = new QueryParser();   
    try {
      Update update = (Update) parser.parseCommand("UPDATE x SET x = 'y'"); //$NON-NLS-1$
      return new CommandStatement(update);
    } catch(Exception e) { return null;}
  }
View Full Code Here

Examples of org.teiid.query.parser.QueryParser

    @Test public void testValidateAssignmentWithFunctionOnParameter_InServer() throws Exception{
        String sql = "EXEC pm1.vsp36(5)"//$NON-NLS-1$
        QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
       
        Command command = new QueryParser().parseCommand(sql);
        QueryResolver.resolveCommand(command, metadata);
       
        // Validate
        ValidatorReport report = Validator.validate(command, metadata);
        assertEquals(0, report.getItems().size());                     
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.