Examples of query()


Examples of org.apache.metamodel.AbstractDataContext.query()

    Column colA = new MutableColumn("colA", null, tableAB, 0, true);
    Column colB = new MutableColumn("colB", null, tableAB, 1, true);
    Column colC = new MutableColumn("colC", null, tableC, 0, true);

    Query q = dc.query().from(tableAB).leftJoin(tableC).on(colB, colC)
        .select(colA).as("a").select(colB).as("b").select(colC).as("c")
        .toQuery();

    assertEquals(
        "SELECT tableAB.colA AS a, tableAB.colB AS b, tableC.colC AS c FROM tableAB LEFT JOIN tableC ON tableAB.colB = tableC.colC",
View Full Code Here

Examples of org.apache.metamodel.DataContext.query()

    DataContext converted = Converters.addTypeConverter(source, fooColumn,
        new StringToIntegerConverter());

    // only select "bar" which is not converted
    Table table = converted.getDefaultSchema().getTableByName("table");
    Query query = converted.query().from(table).select("bar").toQuery();
    assertEquals("SELECT table.bar FROM schema.table", query.toSql());

    DataSet ds = converted.executeQuery(query);
    assertEquals(InMemoryDataSet.class, ds.getClass());
View Full Code Here

Examples of org.apache.metamodel.MockUpdateableDataContext.query()

        final Table table = dc.getDefaultSchema().getTables()[0];
        Map<Column, TypeConverter<?, ?>> converters = Converters.autoDetectConverters(dc, table, 1000);
        assertEquals(1, converters.size());
        dc = Converters.addTypeConverters(dc, converters);

        final Query q = dc.query().from(table).select("foo").toQuery();
        assertEquals("SELECT table.foo FROM schema.table", q.toSql());
        DataSet ds = dc.executeQuery(q);
        assertTrue(ds.next());
        assertEquals(1, ds.getRow().getValue(0));
        assertTrue(ds.next());
View Full Code Here

Examples of org.apache.metamodel.QueryPostprocessDataContext.query()

        assertEquals("2", columns[0].getName());
        assertEquals("michael", columns[1].getName());
        assertEquals("male", columns[2].getName());
        assertEquals("19", columns[3].getName());

        Query query = dc.query().from(table).select(table.getColumnByName("michael")).toQuery();

        DataSet dataSet = dc.executeQuery(query);
        assertTrue(dataSet.next());
        assertEquals("peter", dataSet.getRow().getValue(0));
        assertTrue(dataSet.next());
View Full Code Here

Examples of org.apache.metamodel.UpdateableDataContext.query()

                converters.keySet().toString());
        assertEquals(StringToIntegerConverter.class, converters.values().iterator().next().getClass());

        final UpdateableDataContext dc = Converters.addTypeConverters(decoratedDataContext, converters);

        DataSet ds = dc.query().from(table).select(table.getColumns()).execute();
        assertEquals(ConvertedDataSet.class, ds.getClass());
        assertTrue(ds.next());
        assertEquals("Row[values=[1, hello]]", ds.getRow().toString());
        assertEquals(Integer.class, ds.getRow().getValue(0).getClass());
        assertEquals(1, ds.getRow().getValue(0));
View Full Code Here

Examples of org.apache.metamodel.fixedwidth.FixedWidthDataContext.query()

        assertEquals("[greeting, greeter]", Arrays.toString(table.getColumnNames()));
        assertEquals(10, table.getColumnByName("greeting").getColumnSize().intValue());
        assertEquals(10, table.getColumnByName("greeter").getColumnSize().intValue());

        Query q = dc.query().from(table).select(table.getColumns()).toQuery();
        DataSet ds = dc.executeQuery(q);

        assertTrue(ds.next());
        assertEquals("[hello, world]", Arrays.toString(ds.getRow().getValues()));
        assertTrue(ds.next());
View Full Code Here

Examples of org.apache.metamodel.jdbc.JdbcDataContext.query()

      if (!isConfigured()) {
            return;
        }
       
    DataContext dc = new JdbcDataContext(getConnection(), TableType.DEFAULT_TABLE_TYPES, "sakila");
    Query q = dc.query().from("category").selectCount().where("name").eq("kasper's horror movies").toQuery();
    DataSet ds = dc.executeQuery(q);
    assertTrue(ds.next());
    assertEquals(0, ((Number) ds.getRow().getValue(0)).intValue());
    assertFalse(ds.next());
  }
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.core.access.data.JPAPage.JPAPageBuilder.query()

  @Test
  public void testBuildDefault() {
    JPAPageBuilder pageBuilder = new JPAPageBuilder();
    Query query = mockQuery(false);

    JPAPage page = pageBuilder.query(query)
        .pageSize(PAGE_SIZE)
        .skipToken("10")
        .build();

    assertEquals(0, page.getNextPage());
View Full Code Here

Examples of org.apache.oodt.cas.catalog.struct.QueryService.query()

  public List<CatalogReceipt> query(QueryExpression queryExpression) throws CatalogException {
    try {
      if (this.isQueriable()) {
        QueryService queryService = (QueryService) this.index;
        List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
        for (IngestReceipt ingestReceipt : queryService.query(queryExpression))
          catalogReceipts.add(new CatalogReceipt(ingestReceipt, this.getId()));
        return Collections.unmodifiableList(catalogReceipts);
      }else {
        LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable");
        return Collections.emptyList();
View Full Code Here

Examples of org.apache.oodt.cas.catalog.system.Catalog.query()

          List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
          for (String catalogId : catalogToSizeOfMap.keySet()) {
            Catalog catalog = this.getCatalog(catalogId);
            QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, queryExpression);
            if (qe != null)
              catalogReceipts.addAll(catalog.query(qe));
          }
          List<TransactionReceipt> transactionReceipts = this.getPossiblyUnindexedTransactionReceipts(catalogReceipts);
          LOG.log(Level.INFO, "Sorting Query Results . . . ");
          Collections.sort(transactionReceipts, new Comparator<TransactionReceipt>() {
            public int compare(TransactionReceipt o1,
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.