createField method
Implementation
TField createField(TComponent? aOwner) {
final theField = fieldClass;
if (theField == null) {
databaseErrorFmt(SUnknownFieldType, [name]);
}
final result = theField(aOwner);
try {
result._fieldDef = this;
result.size = _size;
result.required = _required;
result._fieldName = name;
result._displayLabel = displayName;
result._fieldNo = fieldNo;
result.setFieldType(dataType);
result._readOnly = _attributes.contains(TFieldAttribute.faReadonly);
result.dataSet = (collection as TFieldDefs).dataset;
if (result is TStringField) {
result._codePage = _codePage;
} else if (result is TMemoField) {
result._codePage = _codePage;
} else if (result is TFloatField) {
result.precision = _precision;
} else if (result is TBCDField) {
result.precision = _precision;
} else if (result is TFMTBCDField) {
result.precision = _precision;
}
return result;
} catch (_) {
result.free();
rethrow;
}
}