private Object toJson(RelDataType node) { if (node.isStruct()) { final List<Object> list = jsonBuilder.list(); for (RelDataTypeField field : node.getFieldList()) { list.add(toJson(field)); } return list; } else { final Map<String, Object> map = jsonBuilder.map(); map.put("type", node.getSqlTypeName().name()); map.put("nullable", node.isNullable()); if (node.getSqlTypeName().allowsPrec()) { map.put("precision", node.getPrecision()); } if (node.getSqlTypeName().allowsScale()) { map.put("scale", node.getScale()); } return map; } }
public RelDataType createSqlType( SqlTypeName typeName, int precision) { if (typeName.allowsScale()) { return createSqlType(typeName, precision, typeName.getDefaultScale()); } assertBasic(typeName); assert (precision >= 0) || (precision == RelDataType.PRECISION_NOT_SPECIFIED); RelDataType newType = new BasicSqlType(typeName, precision); newType = SqlTypeUtil.addCharsetAndCollation(newType, this); return canonize(newType); }
int scale = typeName.allowsScale() ? this.getScale() : -1; return typeName.getLimit( sign,
boolean beyond) { int precision = typeName.allowsPrec() ? this.getPrecision() : -1; int scale = typeName.allowsScale() ? this.getScale() : -1; return typeName.getLimit( sign,
writer.startList(SqlWriter.FrameTypeEnum.FUN_CALL, "(", ")"); writer.print(precision); if (sqlTypeName.allowsScale() && (scale >= 0)) { writer.sep(",", true); writer.print(scale);
writer.startList(SqlWriter.FrameTypeEnum.FunCall, "(", ")"); writer.print(precision); if (sqlTypeName.allowsScale() && (scale >= 0)) { writer.sep(",", true); writer.print(scale);
if (typeName.allowsScale()) { return new SqlDataTypeSpec( typeIdentifier,
if (typeName.allowsScale()) { return new SqlDataTypeSpec( typeIdentifier,
public MetaColumn apply(RelDataTypeField a0) { final int precision = a0.getType().getSqlTypeName().allowsPrec() && !(a0.getType() instanceof RelDataTypeFactoryImpl.JavaType) ? a0.getType().getPrecision() : -1; return new MetaColumn( table.tableCat, table.tableSchem, table.tableName, a0.getName(), a0.getType().getSqlTypeName().getJdbcOrdinal(), a0.getType().getFullTypeString(), precision, a0.getType().getSqlTypeName().allowsScale() ? a0.getType().getScale() : null, 10, a0.getType().isNullable() ? DatabaseMetaData.columnNullable : DatabaseMetaData.columnNoNulls, precision, a0.getIndex() + 1, a0.getType().isNullable() ? "YES" : "NO"); } }