@Override public int getScale() { return DataType.getDataType(dataType).defaultScale; }
/** * Convert a value type to a SQL type. * * @param type the value type * @return the SQL type */ public static int convertTypeToSQLType(int type) { return getDataType(type).sqlType; }
DataType getDataType() { return DataType.getDataType(type); }
public Column(String name, int type, long precision, int scale, int displaySize, String[] enumerators) { this.name = name; this.type = type; if (precision == -1 && scale == -1 && displaySize == -1 && type != Value.UNKNOWN) { DataType dt = DataType.getDataType(type); precision = dt.defaultPrecision; scale = dt.defaultScale; displaySize = dt.defaultDisplaySize; } this.precision = precision; this.scale = scale; this.displaySize = displaySize; this.enumerators = enumerators; }
/** * Get the memory used by this object. * * @return the memory used in bytes */ public int getMemory() { return DataType.getDataType(getType()).memory; }
@Override public int getScale() { return DataType.getDataType(getType()).defaultScale; }
@Override public int getMemory() { if (value == null) { return DataType.getDataType(getType()).memory; } int mem = super.getMemory(); if (javaObject != null) { mem *= 2; } return mem; }
/** * Throw the exception that the feature is not support for the given data * type. * * @param op the operation * @return never returns normally * @throws DbException the exception */ protected DbException throwUnsupportedExceptionForType(String op) { throw DbException.getUnsupportedException( DataType.getDataType(getType()).name + " " + op); }
/** * Adds a column to the result set. * All columns must be added before adding rows. * This method uses the default SQL type names. * * @param name null is replaced with C1, C2,... * @param sqlType the value returned in getColumnType(..) * @param precision the precision * @param scale the scale */ public void addColumn(String name, int sqlType, int precision, int scale) { int valueType = DataType.convertSQLTypeToValueType(sqlType); addColumn(name, sqlType, DataType.getDataType(valueType).name, precision, scale); }
buff.append(originalSQL); } else { buff.append(DataType.getDataType(type).name); switch (type) { case Value.DECIMAL:
/** * Returns the data type name of a column. * * @param column the column index (1,2,...) * @return the data type name * @throws SQLException if the result set is closed or invalid */ @Override public String getColumnTypeName(int column) throws SQLException { try { debugCodeCall("getColumnTypeName", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.getDataType(type).name; } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the parameter type. * java.sql.Types.VARCHAR is returned if the data type is not known. * * @param param the column index (1,2,...) * @return the data type */ @Override public int getParameterType(int param) throws SQLException { try { debugCodeCall("getParameterType", param); ParameterInterface p = getParameter(param); int type = p.getType(); if (type == Value.UNKNOWN) { type = Value.STRING; } return DataType.getDataType(type).sqlType; } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the parameter type name. * "VARCHAR" is returned if the type is not known. * * @param param the column index (1,2,...) * @return the type name */ @Override public String getParameterTypeName(int param) throws SQLException { try { debugCodeCall("getParameterTypeName", param); ParameterInterface p = getParameter(param); int type = p.getType(); if (type == Value.UNKNOWN) { type = Value.STRING; } return DataType.getDataType(type).name; } catch (Exception e) { throw logAndConvert(e); } }
type = Value.STRING; DataType dt = DataType.getDataType(type); prec = dt.defaultPrecision; scale = dt.defaultScale;
long precision = expr.getPrecision(); int displaySize = expr.getDisplaySize(); DataType dt = DataType.getDataType(type); if (precision > 0 && (dt.defaultPrecision == 0 || (dt.defaultPrecision > precision && dt.defaultPrecision < Byte.MAX_VALUE))) {
break; default: DataType type = DataType.getDataType(dataType); precision = type.defaultPrecision; displaySize = type.defaultDisplaySize;
DataType colType = DataType.getDataType(col.getType()); DataType dfltType = DataType.getDataType(col.getDefaultExpression().getType());
DataType dt = DataType.getDataType(type);
DataType dt = DataType.getDataType(type); if (dt.decimal) { value = ValueInt.get(0).convertTo(type);
DataType.getDataType(l).name + " " + getOperationToken() + " " + DataType.getDataType(r).name); } else { dataType = Value.getHigherOrder(l, r);