Package org.apache.jena.jdbc.results.metadata.columns

Examples of org.apache.jena.jdbc.results.metadata.columns.ColumnInfo


     * 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());
    }
View Full Code Here


     * 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());
    }
View Full Code Here

     * 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());
    }
View Full Code Here

     * Expect xsd:double to be typed as double
     * @throws SQLException
     */
    @Test
    public void test_column_type_detection_double() throws SQLException {
        ColumnInfo info = testColumnTypeDetection("x", NodeFactory.createLiteral("12.3e4", XSDDatatype.XSDdouble), true, Types.DOUBLE, Double.class.getCanonicalName());
        Assert.assertEquals(16, info.getScale());
        Assert.assertEquals(16, info.getPrecision());
        Assert.assertTrue(info.isSigned());
    }
View Full Code Here

     * Expect xsd:float to be typed as float
     * @throws SQLException
     */
    @Test
    public void test_column_type_detection_float() throws SQLException {
        ColumnInfo info = testColumnTypeDetection("x", NodeFactory.createLiteral("12.3e4", XSDDatatype.XSDfloat), true, Types.FLOAT, Float.class.getCanonicalName());
        Assert.assertEquals(7, info.getScale());
        Assert.assertEquals(15, info.getPrecision());
        Assert.assertTrue(info.isSigned());
    }
View Full Code Here

     * Expect xsd:float to be typed as float
     * @throws SQLException
     */
    @Test
    public void test_column_type_detection_float() throws SQLException {
        ColumnInfo info = testColumnTypeDetection("x", NodeFactory.createLiteral("12.3e4", XSDDatatype.XSDfloat), true, Types.FLOAT, Float.class.getCanonicalName());
        Assert.assertEquals(7, info.getScale());
        Assert.assertEquals(15, info.getPrecision());
        Assert.assertTrue(info.isSigned());
    }
View Full Code Here

     * @param className Expected detected class name
     * @return Column Information
     * @throws SQLException
     */
    private ColumnInfo testColumnTypeDetection(String var, Node value, boolean allowNulls, int jdbcType, String className) throws SQLException {
        ColumnInfo info = JdbcCompatibility.detectColumnType(var, value, allowNulls);
        Assert.assertEquals(var, info.getLabel());
        if (allowNulls) {
            Assert.assertEquals(ResultSetMetaData.columnNullable, info.getNullability());
        } else {
            Assert.assertEquals(ResultSetMetaData.columnNoNulls, info.getNullability());
        }
        Assert.assertEquals(jdbcType, info.getType());
        Assert.assertEquals(className, info.getClassName());
        Assert.assertEquals(Node.class.getCanonicalName(), info.getTypeName());
        return info;
    }
View Full Code Here

     * Expect xsd:integer to be typed as integers
     * @throws SQLException
     */
    @Test
    public void test_column_type_detection_integer_01() throws SQLException {
        ColumnInfo info = testColumnTypeDetection("x", NodeFactoryExtra.intToNode(1234), true, Types.BIGINT, Long.class.getCanonicalName());
        Assert.assertEquals(0, info.getScale());
        Assert.assertTrue(info.isSigned());
    }
View Full Code Here

     * 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());
    }
View Full Code Here

     * 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());
    }
View Full Code Here

TOP

Related Classes of org.apache.jena.jdbc.results.metadata.columns.ColumnInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.