use of org.apache.jena.jdbc.metadata.results.MetaResultSet in project jena by apache.
the class TestMetaResultSet method meta_result_set_double_02.
/**
* Test retrieving meta column values
*
* @throws SQLException
*/
@Test
public void meta_result_set_double_02() throws SQLException {
MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new ByteColumn("Test", ResultSetMetaData.columnNullable, true) }, new Object[][] { { null } });
Assert.assertTrue(results.next());
double value = results.getDouble(1);
Assert.assertEquals(0d, value, 0d);
Assert.assertTrue(results.wasNull());
Assert.assertFalse(results.next());
results.close();
Assert.assertTrue(results.isClosed());
}
use of org.apache.jena.jdbc.metadata.results.MetaResultSet in project jena by apache.
the class TestMetaResultSet method meta_result_set_long_integer_01.
/**
* Test retrieving meta column values
*
* @throws SQLException
*/
@Test
public void meta_result_set_long_integer_01() throws SQLException {
MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new LongIntegerColumn("Test", ResultSetMetaData.columnNullable, true) }, new Object[][] { { 1234l } });
Assert.assertTrue(results.next());
long value = results.getLong(1);
Assert.assertEquals(1234, value);
Assert.assertFalse(results.wasNull());
Assert.assertFalse(results.next());
results.close();
Assert.assertTrue(results.isClosed());
}
use of org.apache.jena.jdbc.metadata.results.MetaResultSet in project jena by apache.
the class TestMetaResultSet method empty_meta_result_set_01.
/**
* Check empty meta result set
*
* @throws SQLException
*/
@Test
public void empty_meta_result_set_01() throws SQLException {
MetaResultSet results = new MetaResultSet(new ColumnInfo[0]);
// Check results metadata
ResultSetMetaData metadata = results.getMetaData();
Assert.assertEquals(0, metadata.getColumnCount());
// Check results
Assert.assertTrue(results.isBeforeFirst());
Assert.assertFalse(results.next());
Assert.assertTrue(results.isAfterLast());
results.close();
Assert.assertTrue(results.isClosed());
}
use of org.apache.jena.jdbc.metadata.results.MetaResultSet in project jena by apache.
the class TestMetaResultSet method meta_result_set_movement_04.
/**
* Test movement within meta results
*
* @throws SQLException
*/
@Test
public void meta_result_set_movement_04() throws SQLException {
MetaResultSet results = createMetaResultSet(1);
Assert.assertTrue(results.isBeforeFirst());
// Move to absolute row
Assert.assertTrue(results.absolute(1));
Assert.assertTrue(results.isFirst());
Assert.assertFalse(results.isBeforeFirst());
Assert.assertTrue(results.isLast());
Assert.assertFalse(results.isAfterLast());
// Move to end
Assert.assertFalse(results.next());
Assert.assertTrue(results.isAfterLast());
results.close();
Assert.assertTrue(results.isClosed());
}
use of org.apache.jena.jdbc.metadata.results.MetaResultSet in project jena by apache.
the class TestMetaResultSet method meta_result_set_time_01.
/**
* Test retrieving meta column values
*
* @throws SQLException
*/
@Test
public void meta_result_set_time_01() throws SQLException {
MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new TimeColumn("Test", ResultSetMetaData.columnNullable) }, new Object[][] { { new Time(0) } });
Assert.assertTrue(results.next());
Time value = results.getTime(1);
Assert.assertEquals(new Time(0), value);
Assert.assertFalse(results.wasNull());
Assert.assertFalse(results.next());
results.close();
Assert.assertTrue(results.isClosed());
}
Aggregations