当前位置: 首页>>代码示例>>Java>>正文


Java ColumnType.BLOB属性代码示例

本文整理汇总了Java中org.apache.metamodel.schema.ColumnType.BLOB属性的典型用法代码示例。如果您正苦于以下问题:Java ColumnType.BLOB属性的具体用法?Java ColumnType.BLOB怎么用?Java ColumnType.BLOB使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.metamodel.schema.ColumnType的用法示例。


在下文中一共展示了ColumnType.BLOB属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rewriteColumnType

@Override
public String rewriteColumnType(ColumnType columnType, Integer columnSize) {
    if (columnType == ColumnType.BLOB) {
        return "bytea";
    }
    if (columnType == ColumnType.BIT) {
        return "BOOLEAN";
    }
    if (columnType == ColumnType.DOUBLE) {
        return "double precision";
    }
    if (columnType == ColumnType.MAP) {
        return "jsonb";
    }
    return super.rewriteColumnType(columnType, columnSize);
}
 
开发者ID:apache,项目名称:metamodel,代码行数:16,代码来源:PostgresqlQueryRewriter.java

示例2: getDataType

@SuppressWarnings("unchecked")
@Override
public Class<? extends Object> getDataType() {
    final ColumnType type = _column.getType();
    if (type == null) {
        return null;
    } else if (type == ColumnType.CLOB) {
        return String.class;
    } else if (type == ColumnType.BLOB) {
        return byte[].class;
    }
    return (Class<Object>) type.getJavaEquivalentClass();
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:13,代码来源:MetaModelInputColumn.java

示例3: getDataType

@SuppressWarnings("unchecked")
@Override
public Class<? extends Object> getDataType() {
    ColumnType type = _column.getType();
    if (type == null) {
        return null;
    } else if (type == ColumnType.CLOB) {
        return String.class;
    } else if (type == ColumnType.BLOB) {
        return byte[].class;
    }
    return (Class<Object>) type.getJavaEquivalentClass();
}
 
开发者ID:datacleaner,项目名称:AnalyzerBeans,代码行数:13,代码来源:MetaModelInputColumn.java

示例4: rewriteColumnType

@Override
public String rewriteColumnType(ColumnType columnType, Integer columnSize) {
    if (columnType == ColumnType.BIT) {
        return "BOOLEAN";
    }
    if (columnType == ColumnType.BLOB) {
        return "LONGVARBINARY";
    }
    return super.rewriteColumnType(columnType, columnSize);
}
 
开发者ID:apache,项目名称:metamodel,代码行数:10,代码来源:HsqldbQueryRewriter.java

示例5: loadColumns

private void loadColumns(JdbcTable table, DatabaseMetaData metaData) {
    final boolean convertLobs = isLobConversionEnabled();
    final Schema schema = table.getSchema();

    try (ResultSet rs = metaData.getColumns(getCatalogName(schema), getJdbcSchemaName(schema), table.getName(),
            null)) {
        if (logger.isDebugEnabled()) {
            logger.debug("Querying for columns in table: " + table.getName());
        }
        int columnNumber = -1;

        while (rs.next()) {
            columnNumber++;
            final String columnName = rs.getString(4);
            if (_identifierQuoteString == null && new StringTokenizer(columnName).countTokens() > 1) {
                logger.warn("column name contains whitespace: \"" + columnName + "\".");
            }

            final int jdbcType = rs.getInt(5);
            final String nativeType = rs.getString(6);
            final Integer columnSize = rs.getInt(7);

            if (logger.isDebugEnabled()) {
                logger.debug("Found column: table=" + table.getName() + ",columnName=" + columnName + ",nativeType="
                        + nativeType + ",columnSize=" + columnSize);
            }

            ColumnType columnType = _dataContext.getQueryRewriter().getColumnType(jdbcType, nativeType, columnSize);
            if (convertLobs) {
                if (columnType == ColumnType.CLOB || columnType == ColumnType.NCLOB) {
                    columnType = JdbcDataContext.COLUMN_TYPE_CLOB_AS_STRING;
                } else if (columnType == ColumnType.BLOB) {
                    columnType = JdbcDataContext.COLUMN_TYPE_BLOB_AS_BYTES;
                }
            }

            final int jdbcNullable = rs.getInt(11);
            final Boolean nullable;
            if (jdbcNullable == DatabaseMetaData.columnNullable) {
                nullable = true;
            } else if (jdbcNullable == DatabaseMetaData.columnNoNulls) {
                nullable = false;
            } else {
                nullable = null;
            }

            final String remarks = rs.getString(12);

            final JdbcColumn column = new JdbcColumn(columnName, columnType, table, columnNumber, nullable);
            column.setRemarks(remarks);
            column.setNativeType(nativeType);
            column.setColumnSize(columnSize);
            column.setQuote(_identifierQuoteString);
            table.addColumn(column);
        }

        final int columnsReturned = columnNumber + 1;
        if (columnsReturned == 0) {
            logger.info("No column metadata records returned for table '{}' in schema '{}'", table.getName(), schema
                    .getName());
        } else {
            logger.debug("Returned {} column metadata records for table '{}' in schema '{}'", columnsReturned, table
                    .getName(), schema.getName());
        }
    } catch (SQLException e) {
        throw JdbcUtils.wrapException(e, "retrieve table metadata for " + table.getName(), JdbcActionType.METADATA);
    }
}
 
开发者ID:apache,项目名称:metamodel,代码行数:68,代码来源:JdbcMetadataLoader.java

示例6: getColumnTypeFromMetaDataField

private static ColumnType getColumnTypeFromMetaDataField(DataType.Name metaDataName) {
    switch (metaDataName) {
    case BIGINT:
    case COUNTER:
        return ColumnType.BIGINT;
    case BLOB:
        return ColumnType.BLOB;
    case BOOLEAN:
        return ColumnType.BOOLEAN;
    case DECIMAL:
        return ColumnType.DECIMAL;
    case DOUBLE:
        return ColumnType.DOUBLE;
    case FLOAT:
        return ColumnType.FLOAT;
    case INT:
        return ColumnType.INTEGER;
    case TEXT:
        return ColumnType.STRING;
    case TIMESTAMP:
        return ColumnType.TIMESTAMP;
    case UUID:
        return ColumnType.UUID;
    case VARCHAR:
        return ColumnType.VARCHAR;
    case VARINT:
        return ColumnType.BIGINT;
    case LIST:
        return ColumnType.LIST;
    case MAP:
        return ColumnType.MAP;
    case CUSTOM:
        return ColumnType.OTHER;
    case INET:
        return ColumnType.INET;
    case SET:
        return ColumnType.SET;
    default:
        return ColumnType.STRING;
    }
}
 
开发者ID:apache,项目名称:metamodel,代码行数:41,代码来源:CassandraDataContext.java


注:本文中的org.apache.metamodel.schema.ColumnType.BLOB属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。