Package org.sql2o.data

Examples of org.sql2o.data.Table.rows()


            .addParameter("val", "hello").addToBatch()
            .executeBatch();
       
        Table table = sql2o.createQuery("select * from issue4table").executeAndFetchTable();

        Row row0 = table.rows().get(0);
        String row0Val = row0.getString("vAl");
       
        assertEquals("something", row0Val);
       
        Row row1 = table.rows().get(1);
View Full Code Here


        Row row0 = table.rows().get(0);
        String row0Val = row0.getString("vAl");
       
        assertEquals("something", row0Val);
       
        Row row1 = table.rows().get(1);
        boolean failed = false;
       
        try{
            String row1Value = row1.getString("ahsHashah"); // Should fail with an sql2o exception
        }
View Full Code Here


        assertEquals(11, p.id);
        assertEquals("something else", p.name);

        assertEquals(11, (int)t.rows().get(0).getInteger("id"));
        assertEquals("something else", t.rows().get(0).getString("name"));
    }

    /**
     * Reproduce issue #142 (https://github.com/aaberg/sql2o/issues/142)
View Full Code Here

        assertEquals(11, p.id);
        assertEquals("something else", p.name);

        assertEquals(11, (int)t.rows().get(0).getInteger("id"));
        assertEquals("something else", t.rows().get(0).getString("name"));
    }

    /**
     * Reproduce issue #142 (https://github.com/aaberg/sql2o/issues/142)
     */
 
View Full Code Here

        assertEquals(3, table.columns().size());
        assertEquals("ID", table.columns().get(0).getName());
        assertEquals("VALUE", table.columns().get(1).getName());
        assertEquals("VALUE2", table.columns().get(2).getName());

        assertEquals(2, table.rows().size());

        Row row0 = table.rows().get(0);
        Row row1 = table.rows().get(1);

        assertTrue(0 <= row0.getInteger("ID"));
View Full Code Here

        assertEquals("VALUE", table.columns().get(1).getName());
        assertEquals("VALUE2", table.columns().get(2).getName());

        assertEquals(2, table.rows().size());

        Row row0 = table.rows().get(0);
        Row row1 = table.rows().get(1);

        assertTrue(0 <= row0.getInteger("ID"));
        assertEquals("something", row0.getString(1));
        assertEquals(new BigDecimal("3.4"), row0.getBigDecimal("VALUE2"));
View Full Code Here

        assertEquals("VALUE2", table.columns().get(2).getName());

        assertEquals(2, table.rows().size());

        Row row0 = table.rows().get(0);
        Row row1 = table.rows().get(1);

        assertTrue(0 <= row0.getInteger("ID"));
        assertEquals("something", row0.getString(1));
        assertEquals(new BigDecimal("3.4"), row0.getBigDecimal("VALUE2"));
View Full Code Here

    @Test
    public void testRowGetObjectWithConverters() {
        String sql = "select 1 col1, '23' col2 from (values(0))";
        Table t = sql2o.createQuery(sql).executeAndFetchTable();
        Row r = t.rows().get(0);

        String col1AsString = r.getObject("col1", String.class);
        Integer col1AsInteger = r.getObject("col1", Integer.class);
        Long col1AsLong = r.getObject("col1", Long.class);
View Full Code Here

            assertTrue(key > 0);

            String selectSql = "select id, val from test_table";
            Table resultTable = sql2o.createQuery(selectSql).executeAndFetchTable();

            assertThat(resultTable.rows().size(), is(1));
            Row resultRow = resultTable.rows().get(0);
            assertThat(resultRow.getLong("id"), equalTo(key));
            assertThat(resultRow.getString("val"), is("something"));

        } finally {
View Full Code Here

            String selectSql = "select id, val from test_table";
            Table resultTable = sql2o.createQuery(selectSql).executeAndFetchTable();

            assertThat(resultTable.rows().size(), is(1));
            Row resultRow = resultTable.rows().get(0);
            assertThat(resultRow.getLong("id"), equalTo(key));
            assertThat(resultRow.getString("val"), is("something"));

        } finally {
            String dropTableSql = "drop table if exists test_table";
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.