Search in sources :

Example 6 with MetaResultSet

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

the class TestMetaResultSet method meta_result_set_time_02.

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

Example 7 with MetaResultSet

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

the class TestMetaResultSet method meta_result_set_short_integer_01.

/**
     * Test retrieving meta column values
     * 
     * @throws SQLException
     */
@Test
public void meta_result_set_short_integer_01() throws SQLException {
    MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new ShortIntegerColumn("Test", ResultSetMetaData.columnNullable, true) }, new Object[][] { { (short) 1234 } });
    Assert.assertTrue(results.next());
    short value = results.getShort(1);
    Assert.assertEquals((short) 1234, value);
    Assert.assertFalse(results.wasNull());
    Assert.assertFalse(results.next());
    results.close();
    Assert.assertTrue(results.isClosed());
}
Also used : ShortIntegerColumn(org.apache.jena.jdbc.results.metadata.columns.ShortIntegerColumn) MetaResultSet(org.apache.jena.jdbc.metadata.results.MetaResultSet) Test(org.junit.Test)

Example 8 with MetaResultSet

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

the class TestMetaResultSet method empty_meta_result_set_02.

/**
     * Check empty meta result set with a single column
     * 
     * @throws SQLException
     */
@Test
public void empty_meta_result_set_02() throws SQLException {
    MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new StringColumn("Test", ResultSetMetaData.columnNullable) });
    // Check results metadata
    ResultSetMetaData metadata = results.getMetaData();
    Assert.assertEquals(1, metadata.getColumnCount());
    // Check results
    Assert.assertTrue(results.isBeforeFirst());
    Assert.assertFalse(results.next());
    Assert.assertTrue(results.isAfterLast());
    results.close();
    Assert.assertTrue(results.isClosed());
}
Also used : ResultSetMetaData(java.sql.ResultSetMetaData) MetaResultSet(org.apache.jena.jdbc.metadata.results.MetaResultSet) StringColumn(org.apache.jena.jdbc.results.metadata.columns.StringColumn) Test(org.junit.Test)

Example 9 with MetaResultSet

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

the class TestMetaResultSet method meta_result_set_byte_01.

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

Example 10 with MetaResultSet

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

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