Package org.apache.metamodel.data

Examples of org.apache.metamodel.data.DataSet.toObjectArrays()


        data = dc.executeQuery(q);
        assertEquals(48, data.toObjectArrays().size());

        q.setFirstRow(3);
        data = dc.executeQuery(q);
        assertEquals(46, data.toObjectArrays().size());
    }

    public void testSimpleWhere() throws Exception {
        DataContext dc = getDataContext();
        Query q = new Query();
View Full Code Here


        q = dc.query().from(table).as("t").select(ageColumn).selectCount().where(ageColumn).greaterThan(50).groupBy(ageColumn)
                .toQuery();
        assertEquals("SELECT t.\"AGE\", COUNT(*) FROM PUBLIC.\"TEST_TABLE\" t WHERE t.\"AGE\" > 50 GROUP BY t.\"AGE\"", q.toSql());

        ds = dc.executeQuery(q);
        List<Object[]> objectArrays = ds.toObjectArrays();
        assertTrue(objectArrays.size() <= 50);
        assertTrue(objectArrays.size() > 40);

        for (Object[] objects : objectArrays) {
            Integer age = (Integer) objects[0];
View Full Code Here

    public void doTicketFileTests(DataContext dc) {
        Table table = dc.getDefaultSchema().getTables()[0];
        Query q = dc.query().from(table).select(table.getColumns()).toQuery();

        DataSet dataSet = dc.executeQuery(q);
        List<Object[]> objectArrays = dataSet.toObjectArrays();
        assertEquals(13, objectArrays.get(0).length);
        assertEquals(36, objectArrays.size());
        assertEquals("2", objectArrays.get(0)[0].toString());

        Object description = objectArrays.get(0)[11];
View Full Code Here

            ds = dataContext.query().from("my_collection").select("id").and("name").where("foo").isEquals("bar").execute();
            assertEquals(MongoDbDataSet.class, ds.getClass());
            assertFalse(((MongoDbDataSet) ds).isQueryPostProcessed());

            try {
                List<Object[]> objectArrays = ds.toObjectArrays();
                assertEquals(200, objectArrays.size());
                assertEquals("[0, record no. 0]", Arrays.toString(objectArrays.get(0)));
            } finally {
                ds.close();
            }
View Full Code Here

        try {
            assertEquals(1, compiledQuery.getParameters().size());
            assertSame(param1, compiledQuery.getParameters().get(0));

            DataSet ds = dc.executeQuery(compiledQuery, "denmark");
            List<Object[]> objectArrays = ds.toObjectArrays();
            assertEquals(3, objectArrays.size());

        } finally {
            compiledQuery.close();
        }
View Full Code Here

        assertEquals("[string, number, date]", Arrays.toString(table.getColumnNames()));

        Query q = dc.query().from(table).select(table.getColumns()).orderBy(table.getColumnByName("number")).toQuery();
        DataSet ds = dc.executeQuery(q);
        List<Object[]> objectArrays = ds.toObjectArrays();
        assertEquals(4, objectArrays.size());
        assertEquals("[hello, 1, 2010-01-01 00:00:00]", Arrays.toString(objectArrays.get(0)));
        assertEquals("[world, 2, 2010-01-02 00:00:00]", Arrays.toString(objectArrays.get(1)));
        assertEquals("[foo, 3, 2010-01-03 00:00:00]", Arrays.toString(objectArrays.get(2)));
        assertEquals("[bar, 4, 2010-01-04 00:00:00]", Arrays.toString(objectArrays.get(3)));
View Full Code Here

        q.from(table1);
        q.from(table2);
        q.select(table1.getColumns());
        q.select(table2.getColumns());
        data = dc.executeQuery(q);
        assertEquals(48, data.toObjectArrays().size());
       
        q.setFirstRow(3);
        data = dc.executeQuery(q);
        assertEquals(46, data.toObjectArrays().size());
    }
View Full Code Here

        data = dc.executeQuery(q);
        assertEquals(48, data.toObjectArrays().size());
       
        q.setFirstRow(3);
        data = dc.executeQuery(q);
        assertEquals(46, data.toObjectArrays().size());
    }

    public void testSimpleWhere() throws Exception {
        DataContext dc = getDataContext();
        Query q = new Query();
View Full Code Here

    public void doTicketFileTests(DataContext dc) {
        Table table = dc.getDefaultSchema().getTables()[0];
        Query q = dc.query().from(table).select(table.getColumns()).toQuery();

        DataSet dataSet = dc.executeQuery(q);
        List<Object[]> objectArrays = dataSet.toObjectArrays();
        assertEquals(13, objectArrays.get(0).length);
        assertEquals(36, objectArrays.size());
        assertEquals("2", objectArrays.get(0)[0].toString());

        Object description = objectArrays.get(0)[11];
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.