fcl-db: formatting (unification char-case)

git-svn-id: trunk@24388 -
This commit is contained in:
lacak 2013-04-30 09:59:31 +00:00
parent e280a8d97e
commit 9168f1cbd3
2 changed files with 75 additions and 75 deletions

View File

@ -360,7 +360,7 @@ type
procedure SetAsLargeint(AValue: Largeint); virtual; procedure SetAsLargeint(AValue: Largeint); virtual;
procedure SetAsVariant(const AValue: variant); virtual; procedure SetAsVariant(const AValue: variant); virtual;
procedure SetAsString(const AValue: string); virtual; procedure SetAsString(const AValue: string); virtual;
procedure SetAsWideString(const aValue: WideString); virtual; procedure SetAsWideString(const AValue: WideString); virtual;
procedure SetDataset(AValue : TDataset); virtual; procedure SetDataset(AValue : TDataset); virtual;
procedure SetDataType(AValue: TFieldType); procedure SetDataType(AValue: TFieldType);
procedure SetNewValue(const AValue: Variant); procedure SetNewValue(const AValue: Variant);
@ -486,18 +486,18 @@ type
TWideStringField = class(TStringField) TWideStringField = class(TStringField)
protected protected
class procedure CheckTypeSize(aValue: Integer); override; class procedure CheckTypeSize(AValue: Integer); override;
function GetValue(var aValue: WideString): Boolean; function GetValue(var AValue: WideString): Boolean;
function GetAsString: string; override; function GetAsString: string; override;
procedure SetAsString(const aValue: string); override; procedure SetAsString(const AValue: string); override;
function GetAsVariant: Variant; override; function GetAsVariant: Variant; override;
procedure SetVarValue(const aValue: Variant); override; procedure SetVarValue(const AValue: Variant); override;
function GetAsWideString: WideString; override; function GetAsWideString: WideString; override;
procedure SetAsWideString(const aValue: WideString); override; procedure SetAsWideString(const AValue: WideString); override;
function GetDataSize: Integer; override; function GetDataSize: Integer; override;
public public
@ -568,7 +568,7 @@ type
FMinValue, FMinValue,
FMaxValue, FMaxValue,
FMinRange, FMinRange,
FMAxRange : Largeint; FMaxRange : Largeint;
Procedure SetMinValue (AValue : Largeint); Procedure SetMinValue (AValue : Largeint);
Procedure SetMaxValue (AValue : Largeint); Procedure SetMaxValue (AValue : Largeint);
protected protected
@ -873,7 +873,7 @@ type
procedure SetText(const AValue: string); override; procedure SetText(const AValue: string); override;
procedure SetVarValue(const AValue: Variant); override; procedure SetVarValue(const AValue: Variant); override;
function GetAsWideString: WideString; override; function GetAsWideString: WideString; override;
procedure SetAsWideString(const aValue: WideString); override; procedure SetAsWideString(const AValue: WideString); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
procedure Clear; override; procedure Clear; override;
@ -897,7 +897,7 @@ type
TMemoField = class(TBlobField) TMemoField = class(TBlobField)
protected protected
function GetAsWideString: WideString; override; function GetAsWideString: WideString; override;
procedure SetAsWideString(const aValue: WideString); override; procedure SetAsWideString(const AValue: WideString); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
published published
@ -912,7 +912,7 @@ type
procedure SetVarValue(const AValue: Variant); override; procedure SetVarValue(const AValue: Variant); override;
function GetAsString: string; override; function GetAsString: string; override;
procedure SetAsString(const aValue: string); override; procedure SetAsString(const AValue: string); override;
public public
constructor Create(aOwner: TComponent); override; constructor Create(aOwner: TComponent); override;
property Value: WideString read GetAsWideString write SetAsWideString; property Value: WideString read GetAsWideString write SetAsWideString;
@ -967,7 +967,7 @@ type
function GetDefaultWidth: Longint; override; function GetDefaultWidth: Longint; override;
function GetAsGuid: TGUID; function GetAsGuid: TGUID;
procedure SetAsGuid(const aValue: TGUID); procedure SetAsGuid(const AValue: TGUID);
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
property AsGuid: TGUID read GetAsGuid write SetAsGuid; property AsGuid: TGUID read GetAsGuid write SetAsGuid;
@ -1166,7 +1166,7 @@ type
Procedure SetDataType(AValue: TFieldType); Procedure SetDataType(AValue: TFieldType);
Procedure SetText(const AValue: string); Procedure SetText(const AValue: string);
function GetAsWideString: WideString; function GetAsWideString: WideString;
procedure SetAsWideString(const aValue: WideString); procedure SetAsWideString(const AValue: WideString);
public public
constructor Create(ACollection: TCollection); overload; override; constructor Create(ACollection: TCollection); overload; override;
constructor Create(AParams: TParams; AParamType: TParamType); reintroduce; overload; constructor Create(AParams: TParams; AParamType: TParamType); reintroduce; overload;

View File

@ -648,7 +648,7 @@ procedure TField.SetAlignment(const AValue: TAlignMent);
begin begin
if FAlignment <> AValue then if FAlignment <> AValue then
begin begin
FAlignment := Avalue; FAlignment := AValue;
PropertyChanged(false); PropertyChanged(false);
end; end;
end; end;
@ -817,9 +817,9 @@ begin
Raise AccessError(SString); Raise AccessError(SString);
end; end;
procedure TField.SetAsWideString(const aValue: WideString); procedure TField.SetAsWideString(const AValue: WideString);
begin begin
SetAsString(aValue); SetAsString(AValue);
end; end;
@ -953,9 +953,9 @@ end;
procedure TField.SetDisplayLabel(const AValue: string); procedure TField.SetDisplayLabel(const AValue: string);
begin begin
if FDisplayLabel<>Avalue then if FDisplayLabel<>AValue then
begin begin
FDisplayLabel:=Avalue; FDisplayLabel:=AValue;
PropertyChanged(true); PropertyChanged(true);
end; end;
end; end;
@ -986,7 +986,7 @@ end;
procedure TField.SetReadOnly(const AValue: Boolean); procedure TField.SetReadOnly(const AValue: Boolean);
begin begin
if (FReadOnly<>Avalue) then if (FReadOnly<>AValue) then
begin begin
FReadOnly:=AValue; FReadOnly:=AValue;
PropertyChanged(True); PropertyChanged(True);
@ -995,7 +995,7 @@ end;
procedure TField.SetVisible(const AValue: Boolean); procedure TField.SetVisible(const AValue: Boolean);
begin begin
if FVisible<>Avalue then if FVisible<>AValue then
begin begin
FVisible:=AValue; FVisible:=AValue;
PropertyChanged(True); PropertyChanged(True);
@ -1208,7 +1208,7 @@ end;
TWideStringField TWideStringField
---------------------------------------------------------------------} ---------------------------------------------------------------------}
class procedure TWideStringField.CheckTypeSize(aValue: Integer); class procedure TWideStringField.CheckTypeSize(AValue: Integer);
begin begin
// A size of 0 is allowed, since for example Firebird allows // A size of 0 is allowed, since for example Firebird allows
// a query like: 'select '' as fieldname from table' which // a query like: 'select '' as fieldname from table' which
@ -1229,7 +1229,7 @@ begin
SetDataType(AValue); SetDataType(AValue);
end; end;
function TWideStringField.GetValue(var aValue: WideString): Boolean; function TWideStringField.GetValue(var AValue: WideString): Boolean;
var var
FixBuffer : array[0..dsMaxStringSize div 2] of WideChar; FixBuffer : array[0..dsMaxStringSize div 2] of WideChar;
DynBuffer : array of WideChar; DynBuffer : array of WideChar;
@ -1238,14 +1238,14 @@ begin
if DataSize <= dsMaxStringSize then begin if DataSize <= dsMaxStringSize then begin
Result := GetData(@FixBuffer, False); Result := GetData(@FixBuffer, False);
FixBuffer[Size]:=#0; //limit string to Size FixBuffer[Size]:=#0; //limit string to Size
aValue := FixBuffer; AValue := FixBuffer;
end else begin end else begin
SetLength(DynBuffer, Succ(Size)); SetLength(DynBuffer, Succ(Size));
Buffer := PWideChar(DynBuffer); Buffer := PWideChar(DynBuffer);
Result := GetData(Buffer, False); Result := GetData(Buffer, False);
Buffer[Size]:=#0; //limit string to Size Buffer[Size]:=#0; //limit string to Size
if Result then if Result then
aValue := Buffer; AValue := Buffer;
end; end;
end; end;
@ -1254,9 +1254,9 @@ begin
Result := GetAsWideString; Result := GetAsWideString;
end; end;
procedure TWideStringField.SetAsString(const aValue: string); procedure TWideStringField.SetAsString(const AValue: string);
begin begin
SetAsWideString(aValue); SetAsWideString(AValue);
end; end;
function TWideStringField.GetAsVariant: Variant; function TWideStringField.GetAsVariant: Variant;
@ -1269,9 +1269,9 @@ begin
Result := Null; Result := Null;
end; end;
procedure TWideStringField.SetVarValue(const aValue: Variant); procedure TWideStringField.SetVarValue(const AValue: Variant);
begin begin
SetAsWideString(aValue); SetAsWideString(AValue);
end; end;
function TWideStringField.GetAsWideString: WideString; function TWideStringField.GetAsWideString: WideString;
@ -1280,14 +1280,14 @@ begin
Result := ''; Result := '';
end; end;
procedure TWideStringField.SetAsWideString(const aValue: WideString); procedure TWideStringField.SetAsWideString(const AValue: WideString);
const const
NullWideChar : WideChar = #0; NullWideChar : WideChar = #0;
var var
Buffer : PWideChar; Buffer : PWideChar;
begin begin
if Length(aValue)>0 then if Length(AValue)>0 then
Buffer := PWideChar(@aValue[1]) Buffer := PWideChar(@AValue[1])
else else
Buffer := @NullWideChar; Buffer := @NullWideChar;
SetData(Buffer, False); SetData(Buffer, False);
@ -1340,9 +1340,9 @@ end;
procedure TNumericField.SetEditFormat(const AValue: string); procedure TNumericField.SetEditFormat(const AValue: string);
begin begin
If FEDitFormat<>AValue then If FEditFormat<>AValue then
begin begin
FEDitFormat:=AVAlue; FEditFormat:=AValue;
PropertyChanged(True); PropertyChanged(True);
end; end;
end; end;
@ -1446,9 +1446,9 @@ begin
Result:=GetData(P); Result:=GetData(P);
If Result then If Result then
Case Datatype of Case Datatype of
ftInteger,ftautoinc : AValue:=Plongint(P)^; ftInteger,ftAutoinc : AValue:=Plongint(P)^;
ftword : Avalue:=Pword(P)^; ftWord : AValue:=Pword(P)^;
ftsmallint : AValue:=PSmallint(P)^; ftSmallint : AValue:=PSmallint(P)^;
end; end;
end; end;
@ -1463,7 +1463,7 @@ end;
procedure TLongintField.SetAsFloat(AValue: Double); procedure TLongintField.SetAsFloat(AValue: Double);
begin begin
SetAsLongint(Round(Avalue)); SetAsLongint(Round(AValue));
end; end;
procedure TLongintField.SetAsLongint(AValue: Longint); procedure TLongintField.SetAsLongint(AValue: Longint);
@ -1472,7 +1472,7 @@ begin
If CheckRange(AValue) then If CheckRange(AValue) then
SetData(@AValue) SetData(@AValue)
else else
RangeError(Avalue,FMinrange,FMaxRange); RangeError(AValue,FMinRange,FMaxRange);
end; end;
procedure TLongintField.SetVarValue(const AValue: Variant); procedure TLongintField.SetVarValue(const AValue: Variant);
@ -1489,11 +1489,11 @@ begin
Clear Clear
else else
begin begin
Val(AVAlue,L,Code); Val(AValue,L,Code);
If Code=0 then If Code=0 then
SetAsLongint(L) SetAsLongint(L)
else else
DatabaseErrorFMT(SNotAnInteger,[Avalue]); DatabaseErrorFMT(SNotAnInteger,[AValue]);
end; end;
end; end;
@ -1629,7 +1629,7 @@ end;
procedure TLargeintField.SetAsFloat(AValue: Double); procedure TLargeintField.SetAsFloat(AValue: Double);
begin begin
SetAsLargeint(Round(Avalue)); SetAsLargeint(Round(AValue));
end; end;
procedure TLargeintField.SetAsLargeint(AValue: Largeint); procedure TLargeintField.SetAsLargeint(AValue: Largeint);
@ -1638,13 +1638,13 @@ begin
If CheckRange(AValue) then If CheckRange(AValue) then
SetData(@AValue) SetData(@AValue)
else else
RangeError(Avalue,FMinrange,FMaxRange); RangeError(AValue,FMinRange,FMaxRange);
end; end;
procedure TLargeintField.SetAsLongint(AValue: Longint); procedure TLargeintField.SetAsLongint(AValue: Longint);
begin begin
SetAsLargeint(Avalue); SetAsLargeint(AValue);
end; end;
procedure TLargeintField.SetAsString(const AValue: string); procedure TLargeintField.SetAsString(const AValue: string);
@ -1657,11 +1657,11 @@ begin
Clear Clear
else else
begin begin
Val(AVAlue,L,Code); Val(AValue,L,Code);
If Code=0 then If Code=0 then
SetAsLargeint(L) SetAsLargeint(L)
else else
DatabaseErrorFMT(SNotAnInteger,[Avalue]); DatabaseErrorFMT(SNotAnInteger,[AValue]);
end; end;
end; end;
@ -1864,7 +1864,7 @@ procedure TFloatField.SetAsFloat(AValue: Double);
begin begin
If CheckRange(AValue) then If CheckRange(AValue) then
SetData(@Avalue) SetData(@AValue)
else else
RangeError(AValue,FMinValue,FMaxValue); RangeError(AValue,FMinValue,FMaxValue);
end; end;
@ -1877,7 +1877,7 @@ end;
procedure TFloatField.SetAsLongint(AValue: Longint); procedure TFloatField.SetAsLongint(AValue: Longint);
begin begin
SetAsFloat(Avalue); SetAsFloat(AValue);
end; end;
procedure TFloatField.SetAsString(const AValue: string); procedure TFloatField.SetAsString(const AValue: string);
@ -1898,7 +1898,7 @@ end;
procedure TFloatField.SetVarValue(const AValue: Variant); procedure TFloatField.SetVarValue(const AValue: Variant);
begin begin
SetAsFloat(Avalue); SetAsFloat(AValue);
end; end;
constructor TFloatField.Create(AOwner: TComponent); constructor TFloatField.Create(AOwner: TComponent);
@ -1913,8 +1913,8 @@ end;
Function TFloatField.CheckRange(AValue : Double) : Boolean; Function TFloatField.CheckRange(AValue : Double) : Boolean;
begin begin
If (FMinValue<>0) or (FmaxValue<>0) then If (FMinValue<>0) or (FMaxValue<>0) then
Result:=(AValue>=FMinValue) and (AVAlue<=FMAxValue) Result:=(AValue>=FMinValue) and (AValue<=FMaxValue)
else else
Result:=True; Result:=True;
end; end;
@ -1958,7 +1958,7 @@ function TBooleanField.GetAsString: string;
Var B : wordbool; Var B : wordbool;
begin begin
If Getdata(@B) then If GetData(@B) then
Result:=FDisplays[False,B] Result:=FDisplays[False,B]
else else
result:=''; result:='';
@ -2073,7 +2073,7 @@ function TDateTimeField.GetAsVariant: Variant;
Var d : tDateTime; Var d : tDateTime;
begin begin
If Getdata(@d,False) then If GetData(@d,False) then
Result := d Result := d
else else
Result:=Null; Result:=Null;
@ -2106,7 +2106,7 @@ Var R : TDateTime;
F : String; F : String;
begin begin
If Not Getdata(@R,False) then If Not GetData(@R,False) then
TheText:='' TheText:=''
else else
begin begin
@ -2127,7 +2127,7 @@ end;
procedure TDateTimeField.SetAsDateTime(AValue: TDateTime); procedure TDateTimeField.SetAsDateTime(AValue: TDateTime);
begin begin
SetData(@Avalue,False); SetData(@AValue,False);
end; end;
@ -2145,7 +2145,7 @@ Var R : TDateTime;
begin begin
if AValue<>'' then if AValue<>'' then
begin begin
R:=StrToDateTime(AVAlue); R:=StrToDateTime(AValue);
SetData(@R,False); SetData(@R,False);
end end
else else
@ -2187,7 +2187,7 @@ begin
Clear // set to NULL Clear // set to NULL
else else
begin begin
R:=StrToTime(AVAlue); R:=StrToTime(AValue);
SetData(@R,False); SetData(@R,False);
end; end;
end; end;
@ -2311,7 +2311,7 @@ end;
procedure TBinaryField.SetText(const AValue: string); procedure TBinaryField.SetText(const AValue: string);
begin begin
SetAsString(Avalue); SetAsString(AValue);
end; end;
procedure TBinaryField.SetVarValue(const AValue: Variant); procedure TBinaryField.SetVarValue(const AValue: Variant);
@ -2386,7 +2386,7 @@ class procedure TBCDField.CheckTypeSize(AValue: Longint);
begin begin
If not (AValue in [0..4]) then If not (AValue in [0..4]) then
DatabaseErrorfmt(SInvalidFieldSize,[Avalue]); DatabaseErrorfmt(SInvalidFieldSize,[AValue]);
end; end;
function TBCDField.GetAsBCD: TBCD; function TBCDField.GetAsBCD: TBCD;
@ -2489,7 +2489,7 @@ procedure TBCDField.SetAsBCD(const AValue: TBCD);
var var
c:system.currency; c:system.currency;
begin begin
if BCDToCurr(AValue,c) then //always returns true !! if BCDToCurr(AValue,c) then
SetAsCurrency(c); SetAsCurrency(c);
end; end;
@ -2499,7 +2499,7 @@ begin
If CheckRange(AValue) then If CheckRange(AValue) then
setdata(@AValue) setdata(@AValue)
else else
RangeError(AValue,FMinValue,FMaxvalue); RangeError(AValue,FMinValue,FMaxValue);
end; end;
procedure TBCDField.SetVarValue(const AValue: Variant); procedure TBCDField.SetVarValue(const AValue: Variant);
@ -2510,8 +2510,8 @@ end;
Function TBCDField.CheckRange(AValue : Currency) : Boolean; Function TBCDField.CheckRange(AValue : Currency) : Boolean;
begin begin
If (FMinValue<>0) or (FmaxValue<>0) then If (FMinValue<>0) or (FMaxValue<>0) then
Result:=(AValue>=FMinValue) and (AVAlue<=FMaxValue) Result:=(AValue>=FMinValue) and (AValue<=FMaxValue)
else else
Result:=True; Result:=True;
end; end;
@ -2543,8 +2543,8 @@ constructor TBCDField.Create(AOwner: TComponent);
begin begin
Inherited Create(AOwner); Inherited Create(AOwner);
FMaxvalue := 0; FMaxValue := 0;
FMinvalue := 0; FMinValue := 0;
FValidChars := [DecimalSeparator, '+', '-', '0'..'9']; FValidChars := [DecimalSeparator, '+', '-', '0'..'9'];
SetDataType(ftBCD); SetDataType(ftBCD);
FPrecision := 15; FPrecision := 15;
@ -2848,9 +2848,9 @@ var
begin begin
With GetBlobStream(bmwrite) do With GetBlobStream(bmwrite) do
try try
Len := Length(Avalue); Len := Length(AValue);
if Len > 0 then if Len > 0 then
WriteBuffer(aValue[1], Len); WriteBuffer(AValue[1], Len);
finally finally
Free; Free;
end; end;
@ -2863,9 +2863,9 @@ var
begin begin
With GetBlobStream(bmwrite) do With GetBlobStream(bmwrite) do
try try
Len := Length(Avalue) * 2; Len := Length(AValue) * 2;
if Len > 0 then if Len > 0 then
WriteBuffer(aValue[1], Len); WriteBuffer(AValue[1], Len);
finally finally
Free; Free;
end; end;
@ -2964,7 +2964,7 @@ procedure TBlobField.SetFieldType(AValue: TFieldType);
begin begin
If AValue in [Low(TBlobType)..High(TBlobType)] then If AValue in [Low(TBlobType)..High(TBlobType)] then
SetDatatype(Avalue); SetDatatype(AValue);
end; end;
{ TMemoField } { TMemoField }
@ -2981,9 +2981,9 @@ begin
Result := GetAsString; Result := GetAsString;
end; end;
procedure TMemoField.SetAsWideString(const aValue: WideString); procedure TMemoField.SetAsWideString(const AValue: WideString);
begin begin
SetAsString(aValue); SetAsString(AValue);
end; end;
{ TWideMemoField } { TWideMemoField }
@ -2999,9 +2999,9 @@ begin
Result := GetAsWideString; Result := GetAsWideString;
end; end;
procedure TWideMemoField.SetAsString(const aValue: string); procedure TWideMemoField.SetAsString(const AValue: string);
begin begin
SetAsWideString(aValue); SetAsWideString(AValue);
end; end;
function TWideMemoField.GetAsVariant: Variant; function TWideMemoField.GetAsVariant: Variant;
@ -3042,7 +3042,7 @@ end;
class procedure TGuidField.CheckTypeSize(AValue: LongInt); class procedure TGuidField.CheckTypeSize(AValue: LongInt);
begin begin
if aValue <> 38 then if AValue <> 38 then
DatabaseErrorFmt(SInvalidFieldSize,[AValue]); DatabaseErrorFmt(SInvalidFieldSize,[AValue]);
end; end;
@ -3064,9 +3064,9 @@ begin
Result := 38; Result := 38;
end; end;
procedure TGuidField.SetAsGuid(const aValue: TGUID); procedure TGuidField.SetAsGuid(const AValue: TGUID);
begin begin
SetAsString(GuidToString(aValue)); SetAsString(GuidToString(AValue));
end; end;
function TVariantField.GetDefaultWidth: Integer; function TVariantField.GetDefaultWidth: Integer;