mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-28 14:59:20 +02:00
+ implemented TDataset.Translate and TStringField.Transliterate
git-svn-id: trunk@3928 -
This commit is contained in:
parent
55053a586b
commit
b1a0c5318a
@ -1870,7 +1870,7 @@ end;
|
||||
Function TDataset.Translate(Src, Dest: PChar; ToOem: Boolean): Integer;
|
||||
|
||||
begin
|
||||
//!! To be implemented
|
||||
strcopy(dest,src);
|
||||
end;
|
||||
|
||||
Function Tdataset.TryDoing (P : TDataOperation; Ev : TDatasetErrorEvent) : Boolean;
|
||||
|
@ -387,7 +387,8 @@ type
|
||||
|
||||
TStringField = class(TField)
|
||||
private
|
||||
FFixedChar : boolean;
|
||||
FFixedChar : boolean;
|
||||
FTransliterate : Boolean;
|
||||
protected
|
||||
class procedure CheckTypeSize(AValue: Longint); override;
|
||||
function GetAsBoolean: Boolean; override;
|
||||
@ -409,6 +410,7 @@ type
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
property FixedChar : Boolean read FFixedChar write FFixedChar;
|
||||
property Transliterate: Boolean read FTransliterate write FTransliterate;
|
||||
published
|
||||
property Size default 20;
|
||||
end;
|
||||
|
@ -961,6 +961,7 @@ begin
|
||||
Inherited Create(AOwner);
|
||||
SetDataType(ftString);
|
||||
FFixedChar := False;
|
||||
FTransliterate := False;
|
||||
Size:=20;
|
||||
end;
|
||||
|
||||
@ -1037,12 +1038,20 @@ end;
|
||||
|
||||
function TStringField.GetValue(var AValue: string): Boolean;
|
||||
|
||||
Var Buf : TStringFieldBuffer;
|
||||
Var Buf, TBuf : TStringFieldBuffer;
|
||||
|
||||
begin
|
||||
Result:=GetData(@Buf);
|
||||
If Result then
|
||||
AValue:=Buf;
|
||||
begin
|
||||
if transliterate then
|
||||
begin
|
||||
DataSet.Translate(Buf,TBuf,False);
|
||||
AValue:=TBuf;
|
||||
end
|
||||
else
|
||||
AValue:=Buf
|
||||
end
|
||||
end;
|
||||
|
||||
procedure TStringField.SetAsBoolean(AValue: Boolean);
|
||||
@ -1076,9 +1085,16 @@ procedure TStringField.SetAsString(const AValue: string);
|
||||
|
||||
Const NullByte : char = #0;
|
||||
|
||||
var Buf : TStringFieldBuffer;
|
||||
|
||||
begin
|
||||
IF Length(AValue)=0 then
|
||||
SetData(@NullByte)
|
||||
else if FTransliterate then
|
||||
begin
|
||||
DataSet.Translate(@AValue[1],Buf,True);
|
||||
SetData(@buf);
|
||||
end
|
||||
else
|
||||
SetData(@AValue[1]);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user