Search in sources :

Example 1 with DecimalColumn

use of org.apache.jena.jdbc.results.metadata.columns.DecimalColumn in project jena by apache.

the class TestMetaResultSet method meta_result_set_decimal_01.

/**
     * Test retrieving meta column values
     * 
     * @throws SQLException
     */
@Test
public void meta_result_set_decimal_01() throws SQLException {
    MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new DecimalColumn("Test", ResultSetMetaData.columnNullable) }, new Object[][] { { new BigDecimal("123.4") } });
    Assert.assertTrue(results.next());
    BigDecimal value = results.getBigDecimal(1);
    Assert.assertEquals(new BigDecimal("123.4"), value);
    Assert.assertFalse(results.wasNull());
    Assert.assertFalse(results.next());
    results.close();
    Assert.assertTrue(results.isClosed());
}
Also used : MetaResultSet(org.apache.jena.jdbc.metadata.results.MetaResultSet) DecimalColumn(org.apache.jena.jdbc.results.metadata.columns.DecimalColumn) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 2 with DecimalColumn

use of org.apache.jena.jdbc.results.metadata.columns.DecimalColumn in project jena by apache.

the class TestMetaResultSet method meta_result_set_decimal_02.

/**
     * Test retrieving meta column values
     * 
     * @throws SQLException
     */
@Test
public void meta_result_set_decimal_02() throws SQLException {
    MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new DecimalColumn("Test", ResultSetMetaData.columnNullable) }, new Object[][] { { null } });
    Assert.assertTrue(results.next());
    BigDecimal value = results.getBigDecimal(1);
    Assert.assertEquals(null, value);
    Assert.assertTrue(results.wasNull());
    Assert.assertFalse(results.next());
    results.close();
    Assert.assertTrue(results.isClosed());
}
Also used : MetaResultSet(org.apache.jena.jdbc.metadata.results.MetaResultSet) DecimalColumn(org.apache.jena.jdbc.results.metadata.columns.DecimalColumn) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Aggregations

BigDecimal (java.math.BigDecimal)2 MetaResultSet (org.apache.jena.jdbc.metadata.results.MetaResultSet)2 DecimalColumn (org.apache.jena.jdbc.results.metadata.columns.DecimalColumn)2 Test (org.junit.Test)2