public static ColumnValueConverter getConverter(int snappyTypeValue, String targetType, boolean forSet, int columnPosition) throws SQLException { ColumnValueConverter converter = snappyTypeValue > 0 ? typeConverters[snappyTypeValue] : NULL_TYPE; if (converter != null) { return converter; } else { SnappyType type = SnappyType.findByValue(snappyTypeValue); String typeString = type != null ? type.toString() : Integer.toString(snappyTypeValue); if (forSet) { throw newTypeSetConversionException( typeString, targetType, Integer.toString(columnPosition), null); } else { throw newTypeConversionException( typeString, targetType, Integer.toString(columnPosition), null); } } }
/** * Get JDBC {@link Types} type for given {@link SnappyType}. */ public static int getJdbcType(SnappyType type) { return type != null ? jdbcTypes[type.getValue()] : Types.NULL; }
public int toInteger(OptimizedElementArray row, int columnPosition) throws SQLException { throw Converters.newTypeConversionException( getType().toString(), "int", columnPosition); }
sb.append("TYPE=").append(SnappyType.findByValue(Math.abs(snappyType))) .append(" VALUE=");
public boolean equals(OutputParameter that) { if (that == null) return false; boolean this_present_type = true && this.isSetType(); boolean that_present_type = true && that.isSetType(); if (this_present_type || that_present_type) { if (!(this_present_type && that_present_type)) return false; if (!this.type.equals(that.type)) return false; } boolean this_present_scale = true && this.isSetScale(); boolean that_present_scale = true && that.isSetScale(); if (this_present_scale || that_present_scale) { if (!(this_present_scale && that_present_scale)) return false; if (this.scale != that.scale) return false; } boolean this_present_typeName = true && this.isSetTypeName(); boolean that_present_typeName = true && that.isSetTypeName(); if (this_present_typeName || that_present_typeName) { if (!(this_present_typeName && that_present_typeName)) return false; if (!this.typeName.equals(that.typeName)) return false; } return true; }
public Time toTime(OptimizedElementArray row, int columnPosition, Calendar cal) throws SQLException { throw Converters.newTypeConversionException( getType().toString(), "Time", columnPosition); }
case 1: // TYPE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.type = io.snappydata.thrift.SnappyType.findByValue(iprot.readI32()); struct.setTypeIsSet(true); } else {
if (!(this_present_typeId && that_present_typeId)) return false; if (!this.typeId.equals(that.typeId)) return false;
public BigDecimal toBigDecimal(OptimizedElementArray row, int columnPosition) throws SQLException { throw Converters.newTypeConversionException( getType().toString(), "BigDecimal", columnPosition); }
public final void setObject(int index, Object value, SnappyType type) { if (value != null) { this.nonPrimitives[(int)this.primitives[headerSize + index]] = value; // we force change the type below for non-primitives which will work // fine since conversions will be changed on server if (getType(index) != type.getValue()) { setType(index, type.getValue()); } } else { setNull(index, type.getValue()); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, OutputParameter struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.type = io.snappydata.thrift.SnappyType.findByValue(iprot.readI32()); struct.setTypeIsSet(true); BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { struct.scale = iprot.readI32(); struct.setScaleIsSet(true); } if (incoming.get(1)) { struct.typeName = iprot.readString(); struct.setTypeNameIsSet(true); } } }
} else { pstmt.setNull(paramPosition, Converters.getJdbcType( SnappyType.findByValue(paramType))); } else { pstmt.setNull(paramPosition, Converters.getJdbcType( SnappyType.findByValue(paramType))); SnappyType type = SnappyType.findByValue(paramType); throw Util.generateCsSQLException(SQLState.DATA_TYPE_NOT_SUPPORTED, type != null ? type.toString() : Integer.toString(paramType));
if (!(this_present_type && that_present_type)) return false; if (!this.type.equals(that.type)) return false;
public Blob toBlob(OptimizedElementArray row, int columnPosition, LobService lobService) throws SQLException { throw Converters.newTypeConversionException( getType().toString(), "Blob", columnPosition); }
final int getSnappyType(int columnIndex, Row currentRow) { final int index = columnIndex - 1; int type = currentRow.getType(index); if (type > 0) { return type; } // update the row with the actual type from meta-data if required int expectedType = -this.rowSet.metadata.get(index).type.getValue(); if (type != expectedType) { currentRow.setType(index, expectedType); } return expectedType; }
case 14: // TYPE_ID if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.typeId = io.snappydata.thrift.SnappyType.findByValue(iprot.readI32()); struct.setTypeIdIsSet(true); } else {
public void setByte(OptimizedElementArray row, int columnPosition, byte x) throws SQLException { throw Converters.newTypeSetConversionException( getType().toString(), "byte", columnPosition); }
@Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_type = true && (isSetType()); list.add(present_type); if (present_type) list.add(type.getValue()); boolean present_scale = true && (isSetScale()); list.add(present_scale); if (present_scale) list.add(scale); boolean present_typeName = true && (isSetTypeName()); list.add(present_typeName); if (present_typeName) list.add(typeName); return list.hashCode(); }
case 1: // TYPE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.type = io.snappydata.thrift.SnappyType.findByValue(iprot.readI32()); struct.setTypeIsSet(true); } else { for (int _i190 = 0; _i190 < _list188.size; ++_i190) _elem189 = io.snappydata.thrift.SnappyType.findByValue(iprot.readI32()); struct.elementTypes.add(_elem189);
public void setDouble(OptimizedElementArray row, int columnPosition, double x) throws SQLException { throw Converters.newTypeSetConversionException( getType().toString(), "double", columnPosition); }