Search in sources :

Example 11 with MetaResultSet

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

the class TestMetaResultSet method meta_result_set_movement_01.

/**
     * Test movement within meta results
     * 
     * @throws SQLException
     */
@Test
public void meta_result_set_movement_01() throws SQLException {
    MetaResultSet results = createMetaResultSet(0);
    Assert.assertTrue(results.isBeforeFirst());
    Assert.assertFalse(results.next());
    Assert.assertTrue(results.isAfterLast());
    results.close();
    Assert.assertTrue(results.isClosed());
}
Also used : MetaResultSet(org.apache.jena.jdbc.metadata.results.MetaResultSet) Test(org.junit.Test)

Example 12 with MetaResultSet

use of org.apache.jena.jdbc.metadata.results.MetaResultSet 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 13 with MetaResultSet

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

the class TestMetaResultSet method meta_result_set_long_integer_02.

/**
     * Test retrieving meta column values
     * 
     * @throws SQLException
     */
@Test
public void meta_result_set_long_integer_02() throws SQLException {
    MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new LongIntegerColumn("Test", ResultSetMetaData.columnNullable, true) }, new Object[][] { { null } });
    Assert.assertTrue(results.next());
    long value = results.getLong(1);
    Assert.assertEquals(0, 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) LongIntegerColumn(org.apache.jena.jdbc.results.metadata.columns.LongIntegerColumn) Test(org.junit.Test)

Example 14 with MetaResultSet

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

the class TestMetaResultSet method meta_result_set_byte_02.

/**
     * Test retrieving meta column values
     * 
     * @throws SQLException
     */
@Test
public void meta_result_set_byte_02() throws SQLException {
    MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new ByteColumn("Test", ResultSetMetaData.columnNullable, true) }, new Object[][] { { null } });
    Assert.assertTrue(results.next());
    byte value = results.getByte(1);
    Assert.assertEquals(0x0, 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) ByteColumn(org.apache.jena.jdbc.results.metadata.columns.ByteColumn) Test(org.junit.Test)

Example 15 with MetaResultSet

use of org.apache.jena.jdbc.metadata.results.MetaResultSet 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

MetaResultSet (org.apache.jena.jdbc.metadata.results.MetaResultSet)28 Test (org.junit.Test)28 LongIntegerColumn (org.apache.jena.jdbc.results.metadata.columns.LongIntegerColumn)4 ShortIntegerColumn (org.apache.jena.jdbc.results.metadata.columns.ShortIntegerColumn)4 ByteColumn (org.apache.jena.jdbc.results.metadata.columns.ByteColumn)3 StringColumn (org.apache.jena.jdbc.results.metadata.columns.StringColumn)3 BigDecimal (java.math.BigDecimal)2 Date (java.sql.Date)2 ResultSetMetaData (java.sql.ResultSetMetaData)2 Time (java.sql.Time)2 BooleanColumn (org.apache.jena.jdbc.results.metadata.columns.BooleanColumn)2 DateColumn (org.apache.jena.jdbc.results.metadata.columns.DateColumn)2 DecimalColumn (org.apache.jena.jdbc.results.metadata.columns.DecimalColumn)2 FloatColumn (org.apache.jena.jdbc.results.metadata.columns.FloatColumn)2 IntegerColumn (org.apache.jena.jdbc.results.metadata.columns.IntegerColumn)2 TimeColumn (org.apache.jena.jdbc.results.metadata.columns.TimeColumn)2 DoubleColumn (org.apache.jena.jdbc.results.metadata.columns.DoubleColumn)1