@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(); }
public static Column[] getColumnsByType(Column[] columns, final ColumnType columnType) { return CollectionUtils.filter(columns, column -> { return column.getType() == columnType; }).toArray(new Column[0]); }
@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(); }
@SuppressWarnings("unchecked") public <E> InputColumn<E> narrow(final Class<E> e) { final Class<?> javaEquivalentClass = _column.getType().getJavaEquivalentClass(); if (ReflectionUtils.is(javaEquivalentClass, e)) { return (InputColumn<E>) this; } throw new IllegalArgumentException("Can only narrow this column to supertypes of: " + javaEquivalentClass); }
public static Column[] getColumnsBySuperType(Column[] columns, final SuperColumnType superColumnType) { return CollectionUtils.filter(columns, column -> { return column.getType().getSuperType() == superColumnType; }).toArray(new Column[0]); }
public static Column[] getColumnsBySuperType(Column[] columns, final SuperColumnType superColumnType) { return CollectionUtils.filter(columns, column -> { return column.getType().getSuperType() == superColumnType; }).toArray(new Column[0]); }
@SuppressWarnings("unchecked") public <E> InputColumn<E> narrow(Class<E> e) { Class<?> javaEquivalentClass = _column.getType().getJavaEquivalentClass(); if (ReflectionUtils.is(javaEquivalentClass, e)) { return (InputColumn<E>) this; } throw new IllegalArgumentException("Can only narrow this column to supertypes of: " + javaEquivalentClass); }
public static String getValueAsSql(Column column, Object value, IQueryRewriter queryRewriter) { if (value == null) { return "NULL"; } final ColumnType columnType = column.getType(); if (columnType.isLiteral() && value instanceof String) { value = queryRewriter.escapeQuotes((String) value); } final String formatSqlValue = FormatHelper.formatSqlValue(columnType, value); return formatSqlValue; }
public static String getValueAsSql(Column column, Object value, IQueryRewriter queryRewriter) { if (value == null) { return "NULL"; } final ColumnType columnType = column.getType(); if (columnType.isLiteral() && value instanceof String) { value = queryRewriter.escapeQuotes((String) value); } final String formatSqlValue = FormatHelper.formatSqlValue(columnType, value); return formatSqlValue; }
@Override public OutputDataStreamBuilder likeTable(final Table table) { final List<Column> existingColumns = _table.getColumns(); for (final Column column : existingColumns) { _table.removeColumn(column); } final List<Column> newColumns = table.getColumns(); for (final Column column : newColumns) { withColumn(column.getName(), column.getType()); } return this; }
@Override public Query optimizeQuery(final Query q, final ValidationCategory category) { assert category == ValidationCategory.VALID; if (_lastModifiedThresholdMillis != -1L) { final Column column = lastModifiedColumn.getPhysicalColumn(); if (column.getType().isTimeBased()) { q.where(column, OperatorType.GREATER_THAN, createQueryOperand()); } else { q.where(column, OperatorType.GREATER_THAN, _lastModifiedThresholdMillis); } } return q; }
private SimpleTableDef createTableDef(final Table table) { final int columnCount = table.getColumnCount(); final String[] names = new String[columnCount]; final ColumnType[] types = new ColumnType[columnCount]; for (int i = 0; i < columnCount; i++) { names[i] = table.getColumn(i).getName(); types[i] = table.getColumn(i).getType(); } return new SimpleTableDef(table.getName(), names, types); }
protected ImmutableColumn(Column column, ImmutableTable table) { this(column.getName(), column.getType(), table, column.getColumnNumber(), column.getColumnSize(), column .getNativeType(), column.isNullable(), column.getRemarks(), column.isIndexed(), column.getQuote(), column.isPrimaryKey()); }
protected ImmutableColumn(Column column, ImmutableTable table) { this(column.getName(), column.getType(), table, column.getColumnNumber(), column.getColumnSize(), column .getNativeType(), column.isNullable(), column.getRemarks(), column.isIndexed(), column.getQuote(), column.isPrimaryKey()); }
@Override public final T like(Column column) { _column.setColumnSize(column.getColumnSize()); _column.setNativeType(column.getNativeType()); _column.setType(column.getType()); _column.setNullable(column.isNullable()); _column.setPrimaryKey(column.isPrimaryKey()); return getReturnObject(); }
@Override public final T like(Column column) { _column.setColumnSize(column.getColumnSize()); _column.setNativeType(column.getNativeType()); _column.setType(column.getType()); _column.setNullable(column.isNullable()); _column.setPrimaryKey(column.isPrimaryKey()); return getReturnObject(); }