Search in sources :

Example 1 with ColumnInfo

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

the class TestCompatibility method test_column_type_detection_integer_03.

/**
     * Expect xsd:long to be typed as integers
     * @throws SQLException 
     */
@Test
public void test_column_type_detection_integer_03() throws SQLException {
    ColumnInfo info = testColumnTypeDetection("x", NodeFactory.createLiteral("1234", XSDDatatype.XSDlong), true, Types.BIGINT, Long.class.getCanonicalName());
    Assert.assertEquals(0, info.getScale());
    Assert.assertTrue(info.isSigned());
}
Also used : ColumnInfo(org.apache.jena.jdbc.results.metadata.columns.ColumnInfo) Test(org.junit.Test)

Example 2 with ColumnInfo

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

the class TestCompatibility method test_column_type_detection_decimal.

/**
     * Expect xsd:decimal to be typed as decimal
     * @throws SQLException 
     */
@Test
public void test_column_type_detection_decimal() throws SQLException {
    ColumnInfo info = testColumnTypeDetection("x", NodeFactory.createLiteral("123.4", XSDDatatype.XSDdecimal), true, Types.DECIMAL, BigDecimal.class.getCanonicalName());
    Assert.assertEquals(16, info.getScale());
    Assert.assertEquals(16, info.getPrecision());
    Assert.assertTrue(info.isSigned());
}
Also used : ColumnInfo(org.apache.jena.jdbc.results.metadata.columns.ColumnInfo) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 3 with ColumnInfo

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

the class TestCompatibility method test_column_type_detection_byte_01.

/**
     * Expect xsd:byte to be typed as bytes
     * @throws SQLException 
     */
@Test
public void test_column_type_detection_byte_01() throws SQLException {
    ColumnInfo info = testColumnTypeDetection("x", NodeFactory.createLiteral("123", XSDDatatype.XSDbyte), true, Types.TINYINT, Byte.class.getCanonicalName());
    Assert.assertEquals(0, info.getScale());
    Assert.assertTrue(info.isSigned());
}
Also used : ColumnInfo(org.apache.jena.jdbc.results.metadata.columns.ColumnInfo) Test(org.junit.Test)

Example 4 with ColumnInfo

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

the class TestCompatibility method test_column_type_detection_integer_02.

/**
     * Expect xsd:int to be typed as integers
     * @throws SQLException 
     */
@Test
public void test_column_type_detection_integer_02() throws SQLException {
    ColumnInfo info = testColumnTypeDetection("x", NodeFactory.createLiteral("1234", XSDDatatype.XSDint), true, Types.BIGINT, Long.class.getCanonicalName());
    Assert.assertEquals(0, info.getScale());
    Assert.assertTrue(info.isSigned());
}
Also used : ColumnInfo(org.apache.jena.jdbc.results.metadata.columns.ColumnInfo) Test(org.junit.Test)

Example 5 with ColumnInfo

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

the class TestCompatibility method test_column_type_detection_byte_02.

/**
     * Expect xsd:unsignedByte to be typed as bytes
     * @throws SQLException 
     */
@Test
public void test_column_type_detection_byte_02() throws SQLException {
    ColumnInfo info = testColumnTypeDetection("x", NodeFactory.createLiteral("123", XSDDatatype.XSDunsignedByte), true, Types.TINYINT, Byte.class.getCanonicalName());
    Assert.assertEquals(0, info.getScale());
    Assert.assertFalse(info.isSigned());
}
Also used : ColumnInfo(org.apache.jena.jdbc.results.metadata.columns.ColumnInfo) Test(org.junit.Test)

Aggregations

ColumnInfo (org.apache.jena.jdbc.results.metadata.columns.ColumnInfo)17 Test (org.junit.Test)12 StringColumn (org.apache.jena.jdbc.results.metadata.columns.StringColumn)3 SQLException (java.sql.SQLException)2 SQLFeatureNotSupportedException (java.sql.SQLFeatureNotSupportedException)2 Node (org.apache.jena.graph.Node)2 SparqlColumnInfo (org.apache.jena.jdbc.results.metadata.columns.SparqlColumnInfo)2 BigDecimal (java.math.BigDecimal)1 Triple (org.apache.jena.graph.Triple)1 BooleanColumn (org.apache.jena.jdbc.results.metadata.columns.BooleanColumn)1 IntegerColumn (org.apache.jena.jdbc.results.metadata.columns.IntegerColumn)1 ShortIntegerColumn (org.apache.jena.jdbc.results.metadata.columns.ShortIntegerColumn)1 Binding (org.apache.jena.sparql.engine.binding.Binding)1