org.teiid.query.sql.lang.Query.getSelect()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(393)

本文整理了Java中org.teiid.query.sql.lang.Query.getSelect方法的一些代码示例,展示了Query.getSelect的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getSelect方法的具体详情如下:
包路径:org.teiid.query.sql.lang.Query
类名称:Query
方法名:getSelect

Query.getSelect介绍

[英]Get the select clause for the query.
[中]获取查询的select子句。

代码示例

代码示例来源:origin: org.teiid/teiid-engine

  1. public void setShouldEvaluateExpressions(boolean shouldEvaluate) {
  2. if (shouldEvaluate && projection != null) {
  3. //restore the original as we'll minimize each time
  4. ((Query)this.command).getSelect().setSymbols(this.originalSelect);
  5. this.projection = null;
  6. }
  7. this.shouldEvaluate = shouldEvaluate;
  8. }

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. private void correctProjectedTypes(List actualSymbolTypes, Query query) {
  2. List symbols = query.getSelect().getProjectedSymbols();
  3. List newSymbols = SetQuery.getTypedProjectedSymbols(symbols, actualSymbolTypes, this.metadata);
  4. query.getSelect().setSymbols(newSymbols);
  5. }

代码示例来源:origin: teiid/teiid

  1. private void correctProjectedTypes(List actualSymbolTypes, Query query) {
  2. List symbols = query.getSelect().getProjectedSymbols();
  3. List newSymbols = SetQuery.getTypedProjectedSymbols(symbols, actualSymbolTypes, this.metadata);
  4. query.getSelect().setSymbols(newSymbols);
  5. }

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. public boolean hasAggregates() {
  2. return getGroupBy() != null
  3. || getHaving() != null
  4. || !AggregateSymbolCollectorVisitor.getAggregates(getSelect(), false).isEmpty();
  5. }

代码示例来源:origin: org.teiid/teiid-engine

  1. public boolean hasAggregates() {
  2. return getGroupBy() != null
  3. || getHaving() != null
  4. || !AggregateSymbolCollectorVisitor.getAggregates(getSelect(), false).isEmpty();
  5. }

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. /**
  2. * Validates SELECT INTO queries.
  3. * @param query
  4. * @since 4.2
  5. */
  6. protected void validateSelectInto(Query query) {
  7. List<Expression> symbols = query.getSelect().getProjectedSymbols();
  8. GroupSymbol intoGroup = query.getInto().getGroup();
  9. validateInto(query, symbols, intoGroup);
  10. }

代码示例来源:origin: org.teiid/teiid-engine

  1. /**
  2. * Validates SELECT INTO queries.
  3. * @param query
  4. * @since 4.2
  5. */
  6. protected void validateSelectInto(Query query) {
  7. List<Expression> symbols = query.getSelect().getProjectedSymbols();
  8. GroupSymbol intoGroup = query.getInto().getGroup();
  9. validateInto(query, symbols, intoGroup);
  10. }

代码示例来源:origin: teiid/teiid

  1. /**
  2. * Validates SELECT INTO queries.
  3. * @param query
  4. * @since 4.2
  5. */
  6. protected void validateSelectInto(Query query) {
  7. List<Expression> symbols = query.getSelect().getProjectedSymbols();
  8. GroupSymbol intoGroup = query.getInto().getGroup();
  9. validateInto(query, symbols, intoGroup);
  10. }

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. public static Query rowConstructor(List<Expression> select) {
  2. Query query = new Query();
  3. query.setSelect(new Select());
  4. query.getSelect().addSymbols(select);
  5. query.setRowConstructor(true);
  6. return query;
  7. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testAliasedElementWithVDB() {
  2. Query resolvedQuery = (Query) helpResolve("SELECT example1.pm1.g1.e1 AS x FROM pm1.g1"); //$NON-NLS-1$
  3. helpCheckSelect(resolvedQuery, new String[] { "x" }); //$NON-NLS-1$
  4. helpCheckElements(resolvedQuery.getSelect(),
  5. new String[] { "pm1.g1.e1" }, //$NON-NLS-1$
  6. new String[] { "pm1.g1.e1" } ); //$NON-NLS-1$
  7. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testSelectStarFromAliasedGroup() {
  2. Query resolvedQuery = (Query) helpResolve("SELECT * FROM pm1.g1 as x"); //$NON-NLS-1$
  3. helpCheckFrom(resolvedQuery, new String[] { "pm1.g1" }); //$NON-NLS-1$
  4. helpCheckElements(resolvedQuery.getSelect(),
  5. new String[] { "x.e1", "x.e2", "x.e3", "x.e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
  6. new String[] { "pm1.g1.e1", "pm1.g1.e2", "pm1.g1.e3", "pm1.g1.e4" } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
  7. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testSelectStarWhereSomeElementsAreNotSelectable() {
  2. Query resolvedQuery = (Query) helpResolve("SELECT * FROM pm1.g4"); //$NON-NLS-1$
  3. helpCheckFrom(resolvedQuery, new String[] { "pm1.g4" }); //$NON-NLS-1$
  4. helpCheckElements(resolvedQuery.getSelect(),
  5. new String[] { "pm1.g4.e1", "pm1.g4.e3" }, //$NON-NLS-1$ //$NON-NLS-2$
  6. new String[] { "pm1.g4.e1", "pm1.g4.e3" } ); //$NON-NLS-1$ //$NON-NLS-2$
  7. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testMultipleIdenticalElements() {
  2. Query resolvedQuery = (Query) helpResolve("SELECT e1, e1 FROM pm1.g1"); //$NON-NLS-1$
  3. helpCheckFrom(resolvedQuery, new String[] { "pm1.g1" }); //$NON-NLS-1$
  4. helpCheckSelect(resolvedQuery, new String[] { "pm1.g1.e1", "pm1.g1.e1" }); //$NON-NLS-1$ //$NON-NLS-2$
  5. helpCheckElements(resolvedQuery.getSelect(),
  6. new String[] { "pm1.g1.e1", "pm1.g1.e1" }, //$NON-NLS-1$ //$NON-NLS-2$
  7. new String[] { "pm1.g1.e1", "pm1.g1.e1" }); //$NON-NLS-1$ //$NON-NLS-2$
  8. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testMultipleIdenticalElements2() {
  2. Query resolvedQuery = (Query) helpResolve("SELECT e1, pm1.g1.e1 FROM pm1.g1"); //$NON-NLS-1$
  3. helpCheckFrom(resolvedQuery, new String[] { "pm1.g1" }); //$NON-NLS-1$
  4. helpCheckSelect(resolvedQuery, new String[] { "pm1.g1.e1", "pm1.g1.e1" }); //$NON-NLS-1$ //$NON-NLS-2$
  5. helpCheckElements(resolvedQuery.getSelect(),
  6. new String[] { "pm1.g1.e1", "pm1.g1.e1" }, //$NON-NLS-1$ //$NON-NLS-2$
  7. new String[] { "pm1.g1.e1", "pm1.g1.e1" }); //$NON-NLS-1$ //$NON-NLS-2$
  8. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testDifferentElementsSameName() {
  2. Query resolvedQuery = (Query) helpResolve("SELECT e1 as x, e2 as x FROM pm1.g2"); //$NON-NLS-1$
  3. helpCheckFrom(resolvedQuery, new String[] { "pm1.g2" }); //$NON-NLS-1$
  4. helpCheckSelect(resolvedQuery, new String[] { "x", "x" }); //$NON-NLS-1$ //$NON-NLS-2$
  5. helpCheckElements(resolvedQuery.getSelect(),
  6. new String[] { "pm1.g2.e1", "pm1.g2.e2" }, //$NON-NLS-1$ //$NON-NLS-2$
  7. new String[] { "pm1.g2.e1", "pm1.g2.e2" }); //$NON-NLS-1$ //$NON-NLS-2$
  8. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testElementWithVDB() {
  2. String sql = "SELECT example1.pm1.g1.e1 FROM pm1.g1"; //$NON-NLS-1$
  3. Query resolvedQuery = (Query) helpResolve(sql);
  4. helpCheckSelect(resolvedQuery, new String[] { "pm1.g1.e1" }); //$NON-NLS-1$
  5. helpCheckElements(resolvedQuery.getSelect(),
  6. new String[] { "pm1.g1.e1" }, //$NON-NLS-1$
  7. new String[] { "pm1.g1.e1" } ); //$NON-NLS-1$
  8. assertEquals("Resolved string form was incorrect ", sql, resolvedQuery.toString()); //$NON-NLS-1$
  9. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testNullConstantInSelect() throws Exception {
  2. String userSql = "SELECT null as x"; //$NON-NLS-1$
  3. Query query = (Query)helpParse(userSql);
  4. QueryResolver.resolveCommand(query, RealMetadataFactory.exampleBQTCached());
  5. // Check type of resolved null constant
  6. Expression symbol = query.getSelect().getSymbols().get(0);
  7. assertNotNull(symbol.getType());
  8. assertEquals(DataTypeManager.DefaultDataClasses.STRING, symbol.getType());
  9. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testElementSymbolForms() {
  2. String sql = "SELECT pm1.g1.e1, e2, pm1.g1.e3 AS a, e4 AS b FROM pm1.g1"; //$NON-NLS-1$
  3. Query resolvedQuery = (Query) helpResolve(sql);
  4. helpCheckFrom(resolvedQuery, new String[] { "pm1.g1" }); //$NON-NLS-1$
  5. helpCheckSelect(resolvedQuery, new String[] { "pm1.g1.e1", "pm1.g1.e2", "a", "b" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
  6. helpCheckElements(resolvedQuery.getSelect(),
  7. new String[] { "pm1.g1.e1", "pm1.g1.e2", "pm1.g1.e3", "pm1.g1.e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
  8. new String[] { "pm1.g1.e1", "pm1.g1.e2", "pm1.g1.e3", "pm1.g1.e4" } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
  9. assertEquals("Resolved string form was incorrect ", sql, resolvedQuery.toString()); //$NON-NLS-1$
  10. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testElementSymbolFormsWithAliasedGroup() {
  2. String sql = "SELECT x.e1, e2, x.e3 AS a, e4 AS b FROM pm1.g1 AS x"; //$NON-NLS-1$
  3. Query resolvedQuery = (Query) helpResolve(sql);
  4. helpCheckFrom(resolvedQuery, new String[] { "pm1.g1" }); //$NON-NLS-1$
  5. helpCheckSelect(resolvedQuery, new String[] { "x.e1", "x.e2", "a", "b" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
  6. helpCheckElements(resolvedQuery.getSelect(),
  7. new String[] { "x.e1", "x.e2", "x.e3", "x.e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
  8. new String[] { "pm1.g1.e1", "pm1.g1.e2", "pm1.g1.e3", "pm1.g1.e4" } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
  9. assertEquals("Resolved string form was incorrect ", sql, resolvedQuery.toString()); //$NON-NLS-1$
  10. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testNationCharString() throws Exception {
  2. Query query = (Query) QueryParser.getQueryParser().parseCommand("SELECT N'blah' FROM m.g"); //$NON-NLS-1$
  3. Select select = query.getSelect();
  4. Constant c = (Constant) SymbolMap.getExpression(select.getSymbol(0));
  5. assertEquals(c, new Constant("blah")); //$NON-NLS-1$
  6. }

相关文章