Search in sources :

Example 1 with BooleanColumn

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

the class TestMetaResultSet method meta_result_set_boolean_01.

/**
     * Test retrieving meta column values
     * 
     * @throws SQLException
     */
@Test
public void meta_result_set_boolean_01() throws SQLException {
    MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new BooleanColumn("Test", ResultSetMetaData.columnNullable) }, new Object[][] { { true } });
    Assert.assertTrue(results.next());
    Assert.assertTrue(results.getBoolean(1));
    Assert.assertFalse(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 2 with BooleanColumn

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

the class MetadataSchema method init.

/**
     * Synchronized static initializer is called by the class static
     * initializer, this is done to avoid multi-threaded race conditions and
     * ensure once only initialization
     */
private static synchronized void init() {
    if (init)
        return;
    try {
        // Define all the columns we are going to use since some of these
        // appear in multiple schema
        ColumnInfo empty = new StringColumn("", columnNullable);
        ColumnInfo typeCat = new StringColumn("TYPE_CATA", columnNullable);
        ColumnInfo typeSchema = new StringColumn("TYPE_SCHEM", columnNullable);
        ColumnInfo typeName = new StringColumn("TYPE_NAME", columnNoNulls);
        ColumnInfo attrName = new StringColumn("ATTR_NAME", columnNoNulls);
        ColumnInfo dataType = new IntegerColumn("DATA_TYPE", columnNoNulls, true);
        ColumnInfo attrTypeName = new StringColumn("ATTR_TYPE_NAME", columnNoNulls);
        ColumnInfo attrSize = new IntegerColumn("ATTR_SIZE", columnNoNulls, true);
        ColumnInfo decimalDigits = new IntegerColumn("DECIMAL_DIGITS", columnNoNulls, true);
        ColumnInfo numPrecRadix = new IntegerColumn("NUM_PREC_RADIX", columnNoNulls, true);
        ColumnInfo nullable = new IntegerColumn("NULLABLE", columnNoNulls, true);
        ColumnInfo shortNullable = new ShortIntegerColumn("NULLABLE", columnNoNulls, true);
        ColumnInfo remarks = new StringColumn("REMARKS", columnNullable);
        ColumnInfo attrDef = new StringColumn("ATTR_DEF", columnNullable);
        ColumnInfo sqlDataType = new IntegerColumn("SQL_DATA_TYPE", columnNoNulls, true);
        ColumnInfo sqlDateTimeSub = new IntegerColumn("SQL_DATETIME_SUB", columnNoNulls, true);
        ColumnInfo charOctetLength = new IntegerColumn("CHAR_OCTET_LENGTH", columnNoNulls, true);
        ColumnInfo ordinalPosition = new IntegerColumn("ORDINAL_POSITION", columnNoNulls, true);
        ColumnInfo isNullable = new StringColumn("IS_NULLABLE", columnNoNulls);
        ColumnInfo scope = new ShortIntegerColumn("SCOPE", columnNoNulls, true);
        ColumnInfo scopeCatalog = new StringColumn("SCOPE_CATALOG", columnNullable);
        ColumnInfo scopeSchema = new StringColumn("SCOPE_SCHEMA", columnNullable);
        ColumnInfo scopeTable = new StringColumn("SCOPE_TABLE", columnNullable);
        ColumnInfo sourceDataType = new ShortIntegerColumn("SOURCE_DATA_TYPE", columnNullable, true);
        ColumnInfo columnName = new StringColumn("COLUMN_NAME", columnNoNulls);
        ColumnInfo columnSize = new IntegerColumn("COLUMN_SIZE", columnNoNulls, true);
        ColumnInfo columnDef = new StringColumn("COLUMN_DEF", columnNullable);
        ColumnInfo bufferLength = new IntegerColumn("BUFFER_LENGTH", columnNoNulls, true);
        ColumnInfo psuedoColumn = new ShortIntegerColumn("PSUEDO_COLUMN", columnNoNulls, true);
        ColumnInfo tableCat = new StringColumn("TABLE_CAT", columnNullable);
        ColumnInfo tableCatalog = new StringColumn("TABLE_CATALOG", columnNullable);
        ColumnInfo tableSchema = new StringColumn("TABLE_SCHEM", columnNullable);
        ColumnInfo tableName = new StringColumn("TABLE_NAME", columnNoNulls);
        ColumnInfo name = new StringColumn("NAME", columnNoNulls);
        ColumnInfo maxLen = new IntegerColumn("MAX_LEN", columnNoNulls, true);
        ColumnInfo defaultValue = new StringColumn("DEFAULT_VALUE", columnNullable);
        ColumnInfo description = new StringColumn("DESCRIPTION", columnNullable);
        ColumnInfo isAutoIncrement = new StringColumn("IS_AUTOINCREMENT", columnNoNulls);
        ColumnInfo className = new StringColumn("CLASS_NAME", columnNoNulls);
        ColumnInfo baseType = new ShortIntegerColumn("BASE_TYPE", columnNullable, true);
        ColumnInfo grantor = new StringColumn("GRANTOR", columnNullable);
        ColumnInfo grantee = new StringColumn("GRANTEE", columnNullable);
        ColumnInfo privilege = new StringColumn("PRIVILEGE", columnNoNulls);
        ColumnInfo isGrantable = new StringColumn("IS_GRANTABLE", columnNoNulls);
        ColumnInfo pkTableCat = new StringColumn("PKTABLE_CAT", columnNullable);
        ColumnInfo pkTableSchema = new StringColumn("PKTABLE_SCHEM", columnNullable);
        ColumnInfo pkTableName = new StringColumn("PKTABLE_NAME", columnNoNulls);
        ColumnInfo pkColumnName = new StringColumn("PKCOLUMN_NAME", columnNoNulls);
        ColumnInfo fkTableCat = new StringColumn("FKTABLE_CAT", columnNullable);
        ColumnInfo fkTableSchema = new StringColumn("FKTABLE_SCHEM", columnNullable);
        ColumnInfo fkTableName = new StringColumn("FKTABLE_NAME", columnNoNulls);
        ColumnInfo fkColumnName = new StringColumn("FKCOLUMN_NAME", columnNoNulls);
        ColumnInfo keySeq = new ShortIntegerColumn("KEY_SEQ", columnNoNulls, true);
        ColumnInfo updateRule = new ShortIntegerColumn("UPDATE_RULE", columnNoNulls, true);
        ColumnInfo deleteRule = new ShortIntegerColumn("DELETE_RULE", columnNoNulls, true);
        ColumnInfo fkName = new StringColumn("FK_NAME", columnNullable);
        ColumnInfo pkName = new StringColumn("PK_NAME", columnNullable);
        ColumnInfo deferrability = new ShortIntegerColumn("DEFERRABILITY", columnNoNulls, true);
        ColumnInfo functionCat = new StringColumn("FUNCTION_CAT", columnNullable);
        ColumnInfo functionSchema = new StringColumn("FUNCTION_SCHEM", columnNullable);
        ColumnInfo functionName = new StringColumn("FUNCTION_NAME", columnNoNulls);
        ColumnInfo columnType = new ShortIntegerColumn("COLUMN_TYPE", columnNoNulls, true);
        ColumnInfo precision = new IntegerColumn("PRECISION", columnNoNulls, true);
        ColumnInfo length = new IntegerColumn("LENGTH", columnNoNulls, true);
        ColumnInfo scale = new ShortIntegerColumn("SCALE", columnNoNulls, true);
        ColumnInfo radix = new ShortIntegerColumn("RADIX", columnNoNulls, true);
        ColumnInfo specificName = new StringColumn("SPECIFIC_NAME", columnNoNulls);
        ColumnInfo functionType = new ShortIntegerColumn("FUNCTION_TYPE", columnNoNulls, true);
        ColumnInfo nonUnique = new BooleanColumn("NON_UNIQUE", columnNoNulls);
        ColumnInfo indexQualifier = new StringColumn("INDEX_QUALIFIER", columnNullable);
        ColumnInfo indexName = new StringColumn("INDEX_NAME", columnNullable);
        ColumnInfo type = new ShortIntegerColumn("TYPE", columnNoNulls, true);
        ColumnInfo ascOrDesc = new StringColumn("ASC_OR_DESC", columnNullable);
        ColumnInfo cardinality = new IntegerColumn("CARDINALITY", columnNoNulls, true);
        ColumnInfo pages = new IntegerColumn("PAGES", columnNoNulls, true);
        ColumnInfo filterCondition = new StringColumn("FILTER_CONDITION", columnNullable);
        ColumnInfo procedureCat = new StringColumn("PROCEDURE_CAT", columnNullable);
        ColumnInfo procedureSchema = new StringColumn("PROCEDURE_SCHEM", columnNullable);
        ColumnInfo procedureName = new StringColumn("PROCEDURE_NAME", columnNoNulls);
        ColumnInfo procedureType = new ShortIntegerColumn("PROCEDURE_TYPE", columnNoNulls, true);
        ColumnInfo superTableName = new StringColumn("SUPERTABLE_NAME", columnNoNulls);
        ColumnInfo superTypeCat = new StringColumn("SUPERTYPE_CAT", columnNullable);
        ColumnInfo superTypeSchema = new StringColumn("SUPERTYPE_SCHEM", columnNullable);
        ColumnInfo superTypeName = new StringColumn("SUPERTYPE_NAME", columnNoNulls);
        ColumnInfo litPrefix = new StringColumn("LITERAL_PREFIX", columnNullable);
        ColumnInfo litSuffix = new StringColumn("LITERAL_SUFFIX", columnNullable);
        ColumnInfo createParams = new StringColumn("CREATE_PARAMS", columnNullable);
        ColumnInfo caseSensitive = new BooleanColumn("CASE_SENSITIVE", columnNoNulls);
        ColumnInfo searchable = new ShortIntegerColumn("SEARCHABLE", columnNoNulls, true);
        ColumnInfo unsignedAttr = new BooleanColumn("UNSIGNED_ATTRIBUTE", columnNoNulls);
        ColumnInfo fixedPrecScale = new BooleanColumn("FIXED_PREC_SCALE", columnNoNulls);
        ColumnInfo autoIncrement = new BooleanColumn("AUTO_INCREMENT", columnNoNulls);
        ColumnInfo localTypeName = new StringColumn("LOCAL_TYPE_NAME", columnNullable);
        ColumnInfo minScale = new ShortIntegerColumn("MINIMUM_SCALE", columnNoNulls, true);
        ColumnInfo maxScale = new ShortIntegerColumn("MAXIMUM_SCALE", columnNullable, true);
        ColumnInfo tableType = new StringColumn("TABLE_TYPE", columnNoNulls);
        ColumnInfo selfRefColName = new StringColumn("SELF_REFERENCING_COL_NAME", columnNullable);
        ColumnInfo refGeneration = new StringColumn("REF_GENERATION", columnNullable);
        ColumnInfo columnUsage = new StringColumn("COLUMN_USAGE", columnNoNulls);
        ATTRIBUTE_COLUMNS = new ColumnInfo[] { // TYPE_CAT String => type catalog (may be null)
        typeCat, // TYPE_SCHEM String => type schema (may be null)
        typeSchema, // TYPE_NAME String => type name
        typeName, // ATTR_NAME String => attribute name
        attrName, // java.sql.Types
        dataType, // target type of the reference type.
        attrTypeName, // decimal types this is precision.
        attrSize, // not applicable.
        decimalDigits, // NUM_PREC_RADIX int => Radix (typically either 10 or 2)
        numPrecRadix, // attributeNullableUnknown - nullability unknown
        nullable, // REMARKS String => comment describing column (may be null)
        remarks, // ATTR_DEF String => default value (may be null)
        attrDef, // SQL_DATA_TYPE int => unused
        sqlDataType, // SQL_DATETIME_SUB int => unused
        sqlDateTimeSub, // number of bytes in the column
        charOctetLength, // (starting at 1)
        ordinalPosition, // unknown
        isNullable, // reference attribute (null if DATA_TYPE isn't REF)
        scopeCatalog, // of a reference attribute (null if DATA_TYPE isn't REF)
        scopeSchema, // referenceattribute (null if the DATA_TYPE isn't REF)
        scopeTable, // (null if DATA_TYPE isn't DISTINCT or user-generated REF)
        sourceDataType };
        BEST_ROW_IDENTIFIER_COLUMNS = new ColumnInfo[] { // bestRowSession - valid for remainder of current session
        scope, // COLUMN_NAME String => column name
        columnName, // DATA_TYPE int => SQL data type from java.sql.Types
        dataType, // a UDT the type name is fully qualified
        typeName, // COLUMN_SIZE int => precision
        columnSize, // BUFFER_LENGTH int => not used
        bufferLength, // types where DECIMAL_DIGITS is not applicable.
        decimalDigits, // bestRowPseudo - is a pseudo column
        psuedoColumn };
        CATALOG_COLUMNS = new ColumnInfo[] { // TABLE_CAT String => catalog name
        tableCat };
        CLIENT_INFO_PROPERTY_COLUMNS = new ColumnInfo[] { // NAME String=> The name of the client info property
        name, // property
        maxLen, // DEFAULT_VALUE String=> The default value of the property
        defaultValue, // property is stored in the database.
        description };
        COLUMN_COLUMNS = new ColumnInfo[] { // TABLE_CAT String => table catalog (may be null)
        tableCat, // TABLE_SCHEM String => table schema (may be null)
        tableSchema, // TABLE_NAME String => table name
        tableName, // COLUMN_NAME String => column name
        columnName, // DATA_TYPE int => SQL type from java.sql.Types
        dataType, // the type name is fully qualified
        typeName, // COLUMN_SIZE int => column size.
        columnSize, // BUFFER_LENGTH is not used.
        bufferLength, // applicable.
        decimalDigits, // NUM_PREC_RADIX int => Radix (typically either 10 or 2)
        numPrecRadix, // columnNullableUnknown - nullability unknown
        nullable, // null),
        remarks, // quotes (may be null)
        columnDef, // SQL_DATA_TYPE int => unused
        sqlDataType, // SQL_DATETIME_SUB int => unused
        sqlDateTimeSub, // bytes in the column
        charOctetLength, // (starting at 1)
        ordinalPosition, // unknown
        isNullable, // reference attribute (null if DATA_TYPE isn't REF)
        scopeCatalog, // reference attribute (null if the DATA_TYPE isn't REF)
        scopeSchema, // reference attribure (null if the DATA_TYPE isn't REF)
        scopeTable, // DATA_TYPE isn't DISTINCT or user-generated REF)
        sourceDataType, // auto incremented parameter is unknown
        isAutoIncrement };
        COLUMN_PRIVILEGE_COLUMNS = new ColumnInfo[] { // TABLE_CAT String => table catalog (may be null)
        tableCat, // TABLE_SCHEM String => table schema (may be null)
        tableSchema, // TABLE_NAME String => table name
        tableName, // COLUMN_NAME String => column name
        columnName, // GRANTOR String => grantor of access (may be null)
        grantor, // GRANTEE String => grantee of access
        grantee, // UPDATE, REFRENCES, ...)
        privilege, // grant to others; "NO" if not; null if unknown
        isGrantable };
        CROSS_REFERENCE_COLUMNS = new ColumnInfo[] { // null)
        pkTableCat, // null)
        pkTableSchema, // PKTABLE_NAME String => parent key table name
        pkTableName, // PKCOLUMN_NAME String => parent key column name
        pkColumnName, // being exported (may be null)
        fkTableCat, // null) being exported (may be null)
        fkTableSchema, // exported
        fkTableName, // exported
        fkColumnName, // within the foreign key).
        keySeq, // ODBC 2.x compatibility)
        updateRule, // its parent key has been deleted
        deleteRule, // FK_NAME String => foreign key name (may be null)
        fkName, // PK_NAME String => parent key name (may be null)
        pkName, // importedKeyNotDeferrable - see SQL92 for definition
        deferrability };
        EXPORTED_KEY_COLUMNS = new ColumnInfo[] { // null)
        pkTableCat, // null)
        pkTableSchema, // PKTABLE_NAME String => primary key table name
        pkTableName, // PKCOLUMN_NAME String => primary key column name
        pkColumnName, // null) being exported (may be null)
        fkTableCat, // null) being exported (may be null)
        fkTableSchema, // exported
        fkTableName, // exported
        fkColumnName, // within the foreign key).
        keySeq, // ODBC 2.x compatibility)
        updateRule, // its primary key has been deleted
        deleteRule, // FK_NAME String => foreign key name (may be null)
        fkName, // PK_NAME String => primary key name (may be null)
        pkName, // importedKeyNotDeferrable - see SQL92 for definition
        deferrability };
        FUNCTION_COLUMN_COLUMNS = new ColumnInfo[] { // FUNCTION_CAT String => function catalog (may be null)
        functionCat, // FUNCTION_SCHEM String => function schema (may be null)
        functionSchema, // used to invoke the function
        functionName, // COLUMN_NAME String => column/parameter name
        columnName, // column is a column in the ResultSet
        columnType, // DATA_TYPE int => SQL type from java.sql.Types
        dataType, // type name is fully qualified
        typeName, // PRECISION int => precision
        precision, // LENGTH int => length in bytes of data
        length, // where SCALE is not applicable.
        scale, // RADIX short => radix
        radix, // functionNullableUnknown - nullability unknown
        shortNullable, // REMARKS String => comment describing column/parameter
        remarks, // datatype the returned value is a NULL
        charOctetLength, // of the column in the result set starting from 1.
        ordinalPosition, // column is unknown
        isNullable, // overload functions
        specificName };
        FUNCTION_COLUMNS = new ColumnInfo[] { // FUNCTION_CAT String => function catalog (may be null)
        functionCat, // FUNCTION_SCHEM String => function schema (may be null)
        functionSchema, // used to invoke the function
        functionName, // REMARKS String => explanatory comment on the function
        remarks, // functionReturnsTable - Returns a table
        functionType, // overload functions
        specificName };
        IMPORTED_KEY_COLUMNS = new ColumnInfo[] { // imported (may be null)
        pkTableCat, // imported (may be null)
        pkTableSchema, // imported
        pkTableName, // imported
        pkColumnName, // null)
        fkTableCat, // null)
        fkTableSchema, // FKTABLE_NAME String => foreign key table name
        fkTableName, // FKCOLUMN_NAME String => foreign key column name
        fkColumnName, // within the foreign key).
        keySeq, // ODBC 2.x compatibility)
        updateRule, // its primary key has been deleted
        deleteRule, // FK_NAME String => foreign key name (may be null)
        fkName, // PK_NAME String => primary key name (may be null)
        pkName, // importedKeyNotDeferrable - see SQL92 for definition
        deferrability };
        INDEX_INFO_COLUMNS = new ColumnInfo[] { // TABLE_CAT String => table catalog (may be null)
        tableCat, // TABLE_SCHEM String => table schema (may be null)
        tableSchema, // TABLE_NAME String => table name
        tableName, // false when TYPE is tableIndexStatistic
        nonUnique, // null when TYPE is tableIndexStatistic
        indexQualifier, // tableIndexStatistic
        indexName, // tableIndexOther - this is some other style of index
        type, // index; zero when TYPE is tableIndexStatistic
        ordinalPosition, // tableIndexStatistic
        columnName, // tableIndexStatistic
        ascOrDesc, // the number of unique values in the index.
        cardinality, // the number of pages used for the current index.
        pages, // be null)
        filterCondition };
        PRIMARY_KEY_COLUMNS = new ColumnInfo[] { // TABLE_CAT String => table catalog (may be null)
        tableCat, // TABLE_SCHEM String => table schema (may be null)
        tableSchema, // TABLE_NAME String => table name
        tableName, // COLUMN_NAME String => column name
        columnName, // within the primary key).
        keySeq, // PK_NAME String => primary key name (may be null)
        pkName };
        PROCEDURE_COLUMN_COLUMNS = new ColumnInfo[] { // PROCEDURE_CAT String => procedure catalog (may be null)
        procedureCat, // PROCEDURE_SCHEM String => procedure schema (may be null)
        procedureSchema, // PROCEDURE_NAME String => procedure name
        procedureName, // COLUMN_NAME String => column/parameter name
        columnName, // procedureColumnResult - result column in ResultSet
        columnType, // DATA_TYPE int => SQL type from java.sql.Types
        dataType, // type name is fully qualified
        typeName, // PRECISION int => precision
        precision, // LENGTH int => length in bytes of data
        length, // where SCALE is not applicable.
        scale, // RADIX short => radix
        radix, // procedureNullableUnknown - nullability unknown
        shortNullable, // REMARKS String => comment describing parameter/column
        remarks, // NULL - if a default value was not specified
        columnDef, // SQL_DATA_TYPE int => reserved for future use
        sqlDataType, // SQL_DATETIME_SUB int => reserved for future use
        sqlDateTimeSub, // returned value is a NULL
        charOctetLength, // column ordinal positions are implementation defined.
        ordinalPosition, // unknown
        isNullable, // identifies this procedure within its schema.
        specificName };
        PROCEDURE_COLUMNS = new ColumnInfo[] { // PROCEDURE_CAT String => procedure catalog (may be null)
        procedureCat, // PROCEDURE_SCHEM String => procedure schema (may be null)
        procedureSchema, // PROCEDURE_NAME String => procedure name
        procedureName, // reserved for future use
        empty, // reserved for future use
        empty, // reserved for future use
        empty, // REMARKS String => explanatory comment on the procedure
        remarks, // procedureReturnsResult - Returns a return value
        procedureType, // identifies this procedure within its schema.
        specificName };
        PSUEDO_COLUMN_COLUMNS = new ColumnInfo[] { // TABLE_CAT String => table catalog (may be null)
        tableCat, // TABLE_SCHEM String => table schema (may be null)
        tableSchema, // TABLE_NAME String => table name
        tableName, // COLUMN_NAME String => column name
        columnName, // DATA_TYPE int => SQL type from java.sql.Types
        dataType, // COLUMN_SIZE int => column size.
        columnSize, // not applicable.
        decimalDigits, // NUM_PREC_RADIX int => Radix (typically either 10 or 2)
        numPrecRadix, // returned by PseudoColumnUsage.name()
        columnUsage, // REMARKS String => comment describing column (may be null)
        remarks, // number of bytes in the column
        charOctetLength, // unknown
        isNullable };
        // NB - For some reason JDBC suddenly uses TABLE_CATALOG instead of
        // TABLE_CAT here?
        SCHEMA_COLUMNS = new ColumnInfo[] { // TABLE_SCHEM String => schema name
        tableSchema, // TABLE_CATALOG String => catalog name (may be null)
        tableCatalog };
        SUPER_TABLE_COLUMNS = new ColumnInfo[] { // TABLE_CAT String => the type's catalog (may be null)
        tableCat, // TABLE_SCHEM String => type's schema (may be null)
        tableSchema, // TABLE_NAME String => type name
        tableName, // SUPERTABLE_NAME String => the direct super type's name
        superTableName };
        SUPER_TYPE_COLUMNS = new ColumnInfo[] { // TYPE_CAT String => the UDT's catalog (may be null)
        typeCat, // TYPE_SCHEM String => UDT's schema (may be null)
        typeSchema, // TYPE_NAME String => type name of the UDT
        typeName, // (may be null)
        superTypeCat, // (may be null)
        superTypeSchema, // SUPERTYPE_NAME String => the direct super type's name
        superTypeName };
        TABLE_PRIVILEGE_COLUMNS = new ColumnInfo[] { // TABLE_CAT String => table catalog (may be null)
        tableCat, // TABLE_SCHEM String => table schema (may be null)
        tableSchema, // TABLE_NAME String => table name
        tableName, // GRANTOR String => grantor of access (may be null)
        grantor, // GRANTEE String => grantee of access
        grantee, // UPDATE, REFRENCES, ...)
        privilege, // grant to others; "NO" if not; null if unknown
        isGrantable };
        TABLE_TYPE_COLUMNS = new ColumnInfo[] { // "ALIAS", "SYNONYM".
        tableType };
        TABLE_COLUMNS = new ColumnInfo[] { // TABLE_CAT String => table catalog (may be null)
        tableCat, // TABLE_SCHEM String => table schema (may be null)
        tableSchema, // TABLE_NAME String => table name
        tableName, // "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
        tableType, // REMARKS String => explanatory comment on the table
        remarks, // TYPE_CAT String => the types catalog (may be null)
        typeCat, // TYPE_SCHEM String => the types schema (may be null)
        typeSchema, // TYPE_NAME String => type name (may be null)
        typeName, // null)
        selfRefColName, // "SYSTEM", "USER", "DERIVED". (may be null)
        refGeneration };
        TYPE_INFO_COLUMNS = new ColumnInfo[] { // TYPE_NAME String => Type name
        typeName, // DATA_TYPE int => SQL data type from java.sql.Types
        dataType, // PRECISION int => maximum precision
        precision, // (may be null)
        litPrefix, // (may be null)
        litSuffix, // type (may be null)
        createParams, // typeNullableUnknown - nullability unknown
        shortNullable, // CASE_SENSITIVE boolean=> is it case sensitive.
        caseSensitive, // typeSearchable - Supported for all WHERE ..
        searchable, // UNSIGNED_ATTRIBUTE boolean => is it unsigned.
        unsignedAttr, // FIXED_PREC_SCALE boolean => can it be a money value.
        fixedPrecScale, // auto-increment value.
        autoIncrement, // (may be null)
        localTypeName, // MINIMUM_SCALE short => minimum scale supported
        minScale, // MAXIMUM_SCALE short => maximum scale supported
        maxScale, // SQL_DATA_TYPE int => unused
        sqlDataType, // SQL_DATETIME_SUB int => unused
        sqlDateTimeSub, // NUM_PREC_RADIX int => usually 2 or 10
        numPrecRadix };
        UDT_COLUMNS = new ColumnInfo[] { // TYPE_CAT String => the type's catalog (may be null)
        typeCat, // TYPE_SCHEM String => type's schema (may be null)
        typeSchema, // TYPE_NAME String => type name
        typeName, // CLASS_NAME String => Java class name
        className, // One of JAVA_OBJECT, STRUCT, or DISTINCT
        dataType, // REMARKS String => explanatory comment on the type
        remarks, // not STRUCT with REFERENCE_GENERATION = USER_DEFINED)
        baseType };
        VERSION_COLUMNS = new ColumnInfo[] { // SCOPE short => is not used
        scope, // COLUMN_NAME String => column name
        columnName, // DATA_TYPE int => SQL data type from java.sql.Types
        dataType, // TYPE_NAME String => Data source-dependent type name
        typeName, // COLUMN_SIZE int => precision
        columnSize, // BUFFER_LENGTH int => length of column value in bytes
        bufferLength, // types where DECIMAL_DIGITS is not applicable.
        decimalDigits, // versionColumnPseudo - is a pseudo column
        psuedoColumn };
    } catch (SQLException e) {
        throw new Error("Fatal error initializing JDBC metadata schema information");
    }
    init = true;
}
Also used : ShortIntegerColumn(org.apache.jena.jdbc.results.metadata.columns.ShortIntegerColumn) StringColumn(org.apache.jena.jdbc.results.metadata.columns.StringColumn) ShortIntegerColumn(org.apache.jena.jdbc.results.metadata.columns.ShortIntegerColumn) IntegerColumn(org.apache.jena.jdbc.results.metadata.columns.IntegerColumn) SQLException(java.sql.SQLException) BooleanColumn(org.apache.jena.jdbc.results.metadata.columns.BooleanColumn) ColumnInfo(org.apache.jena.jdbc.results.metadata.columns.ColumnInfo)

Example 3 with BooleanColumn

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

Aggregations

BooleanColumn (org.apache.jena.jdbc.results.metadata.columns.BooleanColumn)3 MetaResultSet (org.apache.jena.jdbc.metadata.results.MetaResultSet)2 Test (org.junit.Test)2 SQLException (java.sql.SQLException)1 ColumnInfo (org.apache.jena.jdbc.results.metadata.columns.ColumnInfo)1 IntegerColumn (org.apache.jena.jdbc.results.metadata.columns.IntegerColumn)1 ShortIntegerColumn (org.apache.jena.jdbc.results.metadata.columns.ShortIntegerColumn)1 StringColumn (org.apache.jena.jdbc.results.metadata.columns.StringColumn)1