📄 memtabledataeh.pas
字号:
FVisible := Value;
end;
function TMTDataFieldEh.GetParentComponent: TComponent;
begin
Result := DataStruct;
end;
procedure TMTDataFieldEh.SetParentComponent(AParent: TComponent);
begin
if not (csLoading in ComponentState) then
FDataStruct := AParent as TMTDataStructEh;
end;
function TMTDataFieldEh.HasParent: Boolean;
begin
Result := True;
end;
procedure TMTDataFieldEh.ReadState(Reader: TReader);
begin
inherited ReadState(Reader);
DataStruct := TMTDataStructEh(Reader.Parent);
end;
procedure TMTDataFieldEh.Assign(Source: TPersistent);
begin
if Source is TMTDataFieldEh then
begin
FieldName := TMTDataFieldEh(Source).FieldName;
if CanDinaSize then
Size := TMTDataFieldEh(Source).Size;
Alignment := TMTDataFieldEh(Source).Alignment;
DefaultExpression := TMTDataFieldEh(Source).DefaultExpression;
DisplayLabel := TMTDataFieldEh(Source).DisplayLabel;
DisplayWidth := TMTDataFieldEh(Source).DisplayWidth;
EditMask := TMTDataFieldEh(Source).EditMask;
Required := TMTDataFieldEh(Source).Required;
Visible := TMTDataFieldEh(Source).Visible;
end else
inherited Assign(Source);
end;
procedure TMTDataFieldEh.CheckInactive;
begin
if (DataStruct <> nil) and (DataStruct.MemTableData <> nil) then
DataStruct.MemTableData.CheckInactive;
end;
function TMTDataFieldEh.CanDinaSize: Boolean;
begin
Result := False;
end;
procedure TMTDataFieldEh.AssignProps(Field: TField);
begin
Alignment := Field.Alignment;
DefaultExpression := Field.DefaultExpression;
DisplayLabel := Field.DisplayLabel;
DisplayWidth := Field.DisplayWidth;
EditMask := Field.EditMask;
Required := Field.Required;
if CanDinaSize then
Size := Field.Size;
Visible := Field.Visible;
end;
function TMTDataFieldEh.GetVarDataType: TVarType;
begin
case DataType of
ftUnknown: Result := varError;
ftString: Result := varString;
ftSmallint: Result := varSmallint;
ftInteger: Result := varInteger;
ftWord: Result := varInteger;
ftBoolean: Result := varBoolean;
ftFloat: Result := varDouble;
ftCurrency: Result := varCurrency;
ftBCD: Result := varCurrency;
ftDate: Result := varDate;
ftTime: Result := varDate;
ftDateTime: Result := varDate;
ftBytes: Result := varString;
ftVarBytes: Result := varString;
ftAutoInc: Result := varInteger;
ftBlob: Result := varString;
ftMemo: Result := varString;
ftGraphic: Result := varString;
ftFmtMemo: Result := varString;
ftParadoxOle: Result := varString;
ftDBaseOle: Result := varString;
ftTypedBinary: Result := varString;
ftCursor: Result := varError;
ftFixedChar: Result := varString;
ftWideString: Result := varOleStr;
{$IFDEF EH_LIB_6}
ftLargeint: Result := varInt64;
{$ELSE}
ftLargeint: Result := varError;
{$ENDIF}
ftADT: Result := varError;
ftArray: Result := varError;
ftReference: Result := varError;
ftDataSet: Result := varError;
ftOraBlob: Result := varString;
ftOraClob: Result := varString;
ftVariant: Result := varVariant;
ftInterface: Result := varUnknown;
ftIDispatch: Result := varDispatch;
ftGuid: Result := varString;
{$IFDEF EH_LIB_6}
ftTimeStamp: Result := varSQLTimeStamp;
ftFMTBcd: Result := varFMTBcd;
{$ENDIF}
else
Result := varEmpty;
end;
end;
procedure TMTDataFieldEh.AssignDataType(FieldType: TFieldType);
begin
raise Exception.Create('Can not assign DataType from Field');
end;
function TMTDataFieldEh.GetIndex: Integer;
begin
Result := DataStruct.FList.IndexOf(Self);
end;
{ TMTBooleanDataFieldEh }
procedure TMTBooleanDataFieldEh.Assign(Source: TPersistent);
begin
inherited Assign(Source);
if Source is TMTBooleanDataFieldEh then
begin
DisplayValues := TMTBooleanDataFieldEh(Source).DisplayValues;
end;
end;
procedure TMTBooleanDataFieldEh.AssignDataType(FieldType: TFieldType);
begin
if DataType <> ftBoolean then
raise Exception.Create('Can not assign DataType from Field');
end;
procedure TMTBooleanDataFieldEh.AssignProps(Field: TField);
begin
inherited AssignProps(Field);
if (Field is TBooleanField) then
DisplayValues := TBooleanField(Field).DisplayValues;
end;
function TMTBooleanDataFieldEh.GetDataType: TFieldType;
begin
Result := ftBoolean;
end;
procedure TMTBooleanDataFieldEh.SetDisplayValues(const Value: string);
begin
FDisplayValues := Value;
end;
{ TMTStringDataFieldEh }
procedure TMTStringDataFieldEh.AssignDataType(FieldType: TFieldType);
begin
case FieldType of
ftString: FStringDataType := fdtStringEh;
ftFixedChar: FStringDataType := fdtFixedCharEh;
ftWideString: FStringDataType := fdtWideStringEh;
else
raise Exception.Create('Can not assign DataType from Field');
end;
end;
procedure TMTStringDataFieldEh.Assign(Source: TPersistent);
begin
inherited Assign(Source);
if Source is TMTStringDataFieldEh then
begin
StringDataType := TMTStringDataFieldEh(Source).StringDataType;
FixedChar := TMTStringDataFieldEh(Source).FixedChar;
Transliterate := TMTStringDataFieldEh(Source).Transliterate;
end;
end;
procedure TMTStringDataFieldEh.AssignProps(Field: TField);
begin
inherited AssignProps(Field);
if (Field is TStringField) then
begin
FixedChar := TStringField(Field).FixedChar;
Transliterate := TStringField(Field).Transliterate;
end
end;
function TMTStringDataFieldEh.CanDinaSize: Boolean;
begin
Result := True;
end;
function TMTStringDataFieldEh.DefaultSize: Integer;
begin
Result := 20;
end;
function TMTStringDataFieldEh.GetDataType: TFieldType;
begin
Result := StringDataFieldsToFields[FStringDataType];
end;
{ TMTNumericDataFieldEh }
procedure TMTNumericDataFieldEh.Assign(Source: TPersistent);
begin
inherited Assign(Source);
if Source is TMTNumericDataFieldEh then
begin
NumericDataType := TMTNumericDataFieldEh(Source).NumericDataType;
DisplayFormat := TMTNumericDataFieldEh(Source).DisplayFormat;
EditFormat := TMTNumericDataFieldEh(Source).EditFormat;
currency := TMTNumericDataFieldEh(Source).currency;
MaxValue := TMTNumericDataFieldEh(Source).MaxValue;
MinValue := TMTNumericDataFieldEh(Source).MinValue;
Precision := TMTNumericDataFieldEh(Source).Precision;
end;
end;
procedure TMTNumericDataFieldEh.AssignDataType(FieldType: TFieldType);
begin
case FieldType of
ftSmallint: FNumericDataType := fdtSmallintEh;
ftInteger: FNumericDataType := fdtIntegerEh;
ftWord: FNumericDataType := fdtWordEh;
ftFloat: FNumericDataType := fdtFloatEh;
ftCurrency: FNumericDataType := fdtCurrencyEh;
ftBCD: FNumericDataType := fdtBCDEh;
ftAutoInc: FNumericDataType := fdtAutoIncEh;
{$IFDEF EH_LIB_6}
ftLargeint: FNumericDataType := fdtLargeintEh;
ftFMTBcd: FNumericDataType := fdtFMTBcdEh;
{$ENDIF}
else
raise Exception.Create('Can not assign DataType from Field');
end;
end;
procedure TMTNumericDataFieldEh.AssignProps(Field: TField);
begin
inherited AssignProps(Field);
if (Field is TNumericField) then
begin
DisplayFormat := TNumericField(Field).DisplayFormat;
EditFormat := TNumericField(Field).EditFormat;
if (Field is TIntegerField) then
begin
MaxValue := TIntegerField(Field).MaxValue;
MinValue := TIntegerField(Field).MinValue;
end;
if (Field is TLargeintField) then
begin
MaxValue := TLargeintField(Field).MaxValue;
MinValue := TLargeintField(Field).MinValue;
end;
if (Field is TFloatField) then
begin
currency := TFloatField(Field).currency;
MaxValue := TFloatField(Field).MaxValue;
MinValue := TFloatField(Field).MinValue;
Precision := TFloatField(Field).Precision;
end;
if (Field is TBCDField) then
begin
currency := TBCDField(Field).currency;
MaxValue := TBCDField(Field).MaxValue;
MinValue := TBCDField(Field).MinValue;
Precision := TBCDField(Field).Precision;
end;
{$IFDEF EH_LIB_6}
if (Field is TFMTBCDField) then
begin
currency := TFMTBCDField(Field).currency;
// MaxValue := TFMTBCDField(Field).MaxValue;
// MinValue := TFMTBCDField(Field).MinValue;
Precision := TFMTBCDField(Field).Precision;
end;
{$ENDIF}
end
end;
function TMTNumericDataFieldEh.GetDataType: TFieldType;
begin
Result := NumericDataFieldsToFields[FNumericDataType];
end;
{ TMTDateTimeDataFieldEh }
procedure TMTDateTimeDataFieldEh.AssignDataType(FieldType: TFieldType);
begin
case FieldType of
ftDate: FDateTimeDataType := fdtDateEh;
ftTime: FDateTimeDataType := fdtTimeEh;
ftDateTime: FDateTimeDataType := fdtDateTimeEh;
{$IFDEF EH_LIB_6}
ftTimeStamp: FDateTimeDataType := fdtTimeStampEh;
{$ENDIF}
else
raise Exception.Create('Can not assign DataType from Field');
end;
end;
procedure TMTDateTimeDataFieldEh.Assign(Source: TPersistent);
begin
inherited Assign(Source);
if Source is TMTDateTimeDataFieldEh then
begin
DateTimeDataType := TMTDateTimeDataFieldEh(Source).DateTimeDataType;
DisplayFormat := TMTDateTimeDataFieldEh(Source).DisplayFormat;
end;
end;
procedure TMTDateTimeDataFieldEh.AssignProps(Field: TField);
begin
inherited AssignProps(Field);
if (Field is TDateTimeField) then
DisplayFormat := TDateTimeField(Field).DisplayFormat;
end;
function TMTDateTimeDataFieldEh.GetDataType: TFieldType;
begin
Result := DateTimeDataFieldsToFields[FDateTimeDataType];
end;
{ TMTBlobDataFieldEh }
procedure TMTBlobDataFieldEh.AssignDataType(FieldType: TFieldType);
begin
// if not (Field is TBlobField) then
// raise Exception.Create('Can not assign DataType from Field');
end;
procedure TMTBlobDataFieldEh.Assign(Source: TPersistent);
begin
inherited Assign(Source);
if Source is TMTBlobDataFieldEh then
begin
BlobType := TMTBlobDataFieldEh(Source).BlobType;
GraphicHeader := TMTBlobDataFieldEh(Source).GraphicHeader;
Transliterate := TMTBlobDataFieldEh(Source).Transliterate;
end;
end;
procedure TMTBlobDataFieldEh.AssignProps(Field: TField);
begin
inherited AssignProps(Field);
if (Field is TBlobField) then
begin
BlobType := TBlobField(Field).BlobType;
{$IFDEF EH_LIB_6}
GraphicHeader := TBlobField(Field).GraphicHeader;
{$ENDIF}
Transliterate := TBlobField(Field).Transliterate;
end;
end;
function TMTBlobDataFieldEh.GetDataType: TFieldType;
begin
Result := BlobType;
end;
{ TMemoryRecordsEh }
procedure TMemoryRecordsEh.DefineProperties(Filer: TFiler);
begin
Filer.DefineProperty('Data', ReadData, WriteData, not IsEmpty);
end;
function TMemoryRecordsEh.IsEmpty: Boolean;
begin
Result := True;
end;
procedure TMemoryRecordsEh.ReadData(Reader: TReader);
begin
end;
procedure TMemoryRecordsEh.WriteData(Writer: TWriter);
var
i: Integer;
begin
with Writer do
begin
WriteListBegin;
for i := 0 to 0 do
begin
end;
WriteListEnd;
end;
end;
{ TMemoryRecordEh }
constructor TMemoryRecordEh.Create;
begin
inherited Create;
New(FData);
FUpdateStatus := usUnmodified;
FUpdateIndex := -1;
end;
destructor TMemoryRecordEh.Destroy;
begin
MergeChanges;
Dispose(FData);
inherited Destroy;
end;
function TMemoryRecordEh.GetAttached: Boolean;
begin
Result := (Index <> -1);
end;
procedure TMemoryRecordEh.BeginEdit;
begin
if FChangeCount = 0 then
begin
if FTmpOldRecValue = nil then
New(FTmpOldRecValue);
FTmpOldRecValue^ := FData^;
end;
Inc(FChangeCount);
end;
procedure TMemoryRecordEh.EndEdit(Changed: Boolean);
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -