Search in sources :

Example 21 with MetaResultSet

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

the class TestMetaResultSet method meta_result_set_boolean_02.

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

Example 22 with MetaResultSet

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

the class TestMetaResultSet method meta_result_set_integer_01.

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

Example 23 with MetaResultSet

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

the class TestMetaResultSet method meta_result_set_double_01.

/**
     * Test retrieving meta column values
     * 
     * @throws SQLException
     */
@Test
public void meta_result_set_double_01() throws SQLException {
    MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new DoubleColumn("Test", ResultSetMetaData.columnNullable) }, new Object[][] { { 0.123d } });
    Assert.assertTrue(results.next());
    double value = results.getDouble(1);
    Assert.assertEquals(0.123d, value, 0d);
    Assert.assertFalse(results.wasNull());
    Assert.assertFalse(results.next());
    results.close();
    Assert.assertTrue(results.isClosed());
}
Also used : MetaResultSet(org.apache.jena.jdbc.metadata.results.MetaResultSet) DoubleColumn(org.apache.jena.jdbc.results.metadata.columns.DoubleColumn) Test(org.junit.Test)

Example 24 with MetaResultSet

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

the class TestMetaResultSet method meta_result_set_float_02.

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

Example 25 with MetaResultSet

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

the class TestMetaResultSet method meta_result_set_integer_02.

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