<author email="javajedi@users.sf.net">Tim McCune</author>
</properties>
<body>
+ <release version="2.0.9" date="TBD">
+ <action dev="jahlborn" type="fix" system="SourceForge2" issue="116">
+ Make ColumnBuilder.setMaxLength do the right thing regardless of
+ column type.
+ </action>
+ </release>
<release version="2.0.8" date="2014-12-26">
<action dev="jahlborn" type="fix" system="SourceForge2" issue="113">
Add newer sql type to access type mappings if the jvm supports them.
return ((_precision != null) ? _precision : (byte)_type.getDefaultPrecision());
}
+ /**
+ * Sets the precision for the new column to the max length for the type.
+ * Does nothing for types which do not have a precision.
+ */
+ public ColumnBuilder setMaxPrecision() {
+ if(_type.getHasScalePrecision()) {
+ setPrecision(_type.getMaxPrecision());
+ }
+ return this;
+ }
+
/**
* Sets the scale for the new column.
*/
return ((_scale != null) ? _scale : (byte)_type.getDefaultScale());
}
+ /**
+ * Sets the scale for the new column to the max length for the type. Does
+ * nothing for types which do not have a scale.
+ */
+ public ColumnBuilder setMaxScale() {
+ if(_type.getHasScalePrecision()) {
+ setScale(_type.getMaxScale());
+ }
+ return this;
+ }
+
/**
* Sets the length (in bytes) for the new column.
*/
}
/**
- * Sets the length for the new column to the max length for the type.
+ * Sets the length for the new column to the max length for the type. Does
+ * nothing for types which are not variable length.
*/
public ColumnBuilder setMaxLength() {
- return setLength(_type.getMaxSize());
+ // length setting only makes sense for variable length columns
+ if(_type.isVariableLength()) {
+ setLength(_type.getMaxSize());
+ }
+ return this;
}
/**
* null}. Equivalent to SQL {@link Types#VARCHAR}, {@link Types#CHAR}.
*/
TEXT((byte) 0x0A, Types.VARCHAR, null, true, false, 0,
- 50 * JetFormat.TEXT_FIELD_UNIT_SIZE,
- JetFormat.TEXT_FIELD_MAX_LENGTH, JetFormat.TEXT_FIELD_UNIT_SIZE),
+ JetFormat.TEXT_FIELD_MAX_LENGTH, JetFormat.TEXT_FIELD_MAX_LENGTH,
+ JetFormat.TEXT_FIELD_UNIT_SIZE),
/**
* Corresponds to a java {@code byte[]} of max length 16777215 bytes.
* Accepts a {@code byte[]}, or {@code null}. Equivalent to SQL