Search in sources :

Example 1 with DateColumn

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

the class TestMetaResultSet method meta_result_set_date_02.

/**
     * Test retrieving meta column values
     * 
     * @throws SQLException
     */
@Test
public void meta_result_set_date_02() throws SQLException {
    MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new DateColumn("Test", ResultSetMetaData.columnNullable) }, new Object[][] { { null } });
    Assert.assertTrue(results.next());
    Date value = results.getDate(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) DateColumn(org.apache.jena.jdbc.results.metadata.columns.DateColumn) Date(java.sql.Date) Test(org.junit.Test)

Example 2 with DateColumn

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

the class TestMetaResultSet method meta_result_set_date_01.

/**
     * Test retrieving meta column values
     * 
     * @throws SQLException
     */
@SuppressWarnings("deprecation")
@Test
public void meta_result_set_date_01() throws SQLException {
    MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new DateColumn("Test", ResultSetMetaData.columnNullable) }, new Object[][] { { new Date(2013, 4, 24) } });
    Assert.assertTrue(results.next());
    Date value = results.getDate(1);
    Assert.assertEquals(new Date(2013, 4, 24), 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) DateColumn(org.apache.jena.jdbc.results.metadata.columns.DateColumn) Date(java.sql.Date) Test(org.junit.Test)

Aggregations

Date (java.sql.Date)2 MetaResultSet (org.apache.jena.jdbc.metadata.results.MetaResultSet)2 DateColumn (org.apache.jena.jdbc.results.metadata.columns.DateColumn)2 Test (org.junit.Test)2