Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CORE/Packages/Lazarus/RESTDataWareComponents.lpk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2"/>
<DebugInfoType Value="dsDwarf3"/>
</Debugging>
</Linking>
<Other>
Expand Down
4 changes: 2 additions & 2 deletions CORE/Source/Basic/uRESTDWBasicDB.pas
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ interface
vBookmark : Integer;
vActive,
vInactive : Boolean;
Procedure InternalPost; overload; // Gilberto Rocha 12/04/2019 - usado para poder fazer datasource.dataset.Post
Procedure InternalPost; override; // Gilberto Rocha 12/04/2019 - usado para poder fazer datasource.dataset.Post
procedure InternalOpen; override; // Gilberto Rocha 03/09/2021 - usado para poder fazer datasource.dataset.Open
Function GetRecordCount : Integer; Override;
procedure InternalRefresh; overload; // Gilberto Rocha 03/09/2021 - usado para poder fazer datasource.dataset.Refresh
Expand Down Expand Up @@ -9069,7 +9069,7 @@ procedure TRESTDWTable.InternalOpen;

Procedure TRESTDWClientSQL.InternalPost;
Begin
Inherited;
Inherited InternalPost;
End;

procedure TRESTDWClientSQL.InternalOpen;
Expand Down
55 changes: 44 additions & 11 deletions CORE/Source/Plugins/Memdataset/uRESTDWMemoryDataset.pas
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
SMinIndexes = 'The minimum amount of indexes is 1';
SIndexNotFound = 'Index ''%s'' not found';
SUniDirectional = 'Operation cannot be performed on an unidirectional dataset';
SFieldRequired = 'Field ''%s'' must have a value';

Type
TCompareFunc = Function(subValue,
Expand Down Expand Up @@ -648,6 +649,7 @@ TDoubleLinkedBufIndex = class(TRESTDWIndex)
Procedure InternalDelete; Override;
Procedure InternalPost; Override;
Procedure InternalClose; Override;
procedure CheckRequiredFields;
Procedure InternalHandleException; Override;
Procedure InternalInitFieldDefs; Override;
Procedure InternalOpen; Override;
Expand Down Expand Up @@ -817,6 +819,7 @@ TDoubleLinkedBufIndex = class(TRESTDWIndex)
Property IndexName : String Read GetIndexName Write SetIndexName;
Property IndexFieldNames : String Read GetIndexFieldNames Write SetIndexFieldNames;
Property MaxIndexesCount : Integer Read FMaxIndexesCount Write SetMaxIndexesCount default 2;
Property Filter;
Property BeforeOpen;
Property AfterOpen;
Property BeforeClose;
Expand Down Expand Up @@ -972,9 +975,11 @@ TDoubleLinkedBufIndex = class(TRESTDWIndex)
Private
vSize,
vPrecision : Integer;
Procedure SetAsExtended(Const AValue : Extended);
Protected
Function GetAsString : String; Override;
Function GetAsVariant : Variant; Override;
Function GetAsString : String; Override;
Procedure SetAsString (Const AValue : String); Override;
// Function GetAsVariant : Variant; Override;
Public
Constructor Create(AOwner: TComponent); override;
Property Size : Integer Read vSize Write vSize;
Expand Down Expand Up @@ -1423,6 +1428,26 @@ TMemBookmarkInfo = record
vPrecision := 8;
End;

{$IFDEF FPC}
Procedure TExtendedField.SetAsExtended(Const AValue : Extended);
Begin
SetData(@AValue, True);
End;

Procedure TExtendedField.SetAsString(Const AValue : String);
Var
x : Extended;
Begin
If AValue = '' Then
Clear
Else
Begin
x := StrToFloat(AValue);
SetAsExtended(x);
End;
End;
{$ENDIF}

Function TExtendedField.GetAsString: string;
Var
x : Extended;
Expand Down Expand Up @@ -1515,13 +1540,6 @@ TMemBookmarkInfo = record
End;
{$ENDIF}

{$IFDEF FPC}
Function TExtendedField.GetAsVariant : Variant;
Begin
Result := Extended(Value); //_RealSupportManager._VarFromReal(Value);
End;
{$ENDIF}

Function TRESTDWMTMemoryRecord.GetIndex: Integer;
Begin
// If FMemoryData <> nil then
Expand Down Expand Up @@ -2699,8 +2717,9 @@ function TRESTDWMemTable.GetActiveRecBuf(var RecBuf: PRESTDWMTMemBuffer
End
Else If Field.datatype = ftExtended Then
Begin
Move(aDataBytes[1], Pointer(@vLongDouble)^, SizeOf(DWLongDouble));
PExtended(Buffer)^ := vLongDouble;
If Length(TRESTDWBytes(Buffer)) = 0 Then
SetLength(TRESTDWBytes(Buffer), cLen);
Move(aDataBytes[1], Pointer(Buffer)^, SizeOf(DWLongDouble));
End
Else
Begin
Expand Down Expand Up @@ -3084,6 +3103,8 @@ procedure TRESTDWMemTable.InternalSetFieldData(Field : TField;
dwftFloat,
{$IFNDEF FPC}
dwftFMTBCD,
{$ELSE}
45,
{$ENDIF}
dwftBCD,
dwftCurrency,
Expand Down Expand Up @@ -5422,6 +5443,18 @@ procedure TRESTDWMemTable.InternalDelete;
End;
End;

procedure TRESTDWMemTable.CheckRequiredFields;
var
I: Integer;
begin
for I := 0 to Fields.Count - 1 do
if Fields[I].Required and not Fields[I].ReadOnly and (Fields[I].FieldKind = fkData) and Fields[I].IsNull then
begin
Fields[I].FocusControl;
DatabaseErrorFmt(SFieldRequired, [Fields[I].DisplayName]);
end;
end;

procedure TRESTDWMemTable.InternalPost;
var
RecPos: Integer;
Expand Down
11 changes: 8 additions & 3 deletions CORE/Source/utils/JSON/uRESTDWDataJSON.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,7 @@
vReal : Real;
bJsonValue : TRESTDWJSONInterfaceObject;
JSONBase : TRESTDWJSONBase;
vString,
DecimalLocal : String;
begin
{$IF Defined(RESTDWLAZARUS) or not Defined(DELPHIXEUP)}
Expand All @@ -1439,12 +1440,15 @@
Begin
For I := 0 To bJsonValue.PairCount -1 Do
Begin
vString := Trim(bJsonValue.pairs[I].Value);
If (Lowercase(bJsonValue.pairs[I].classname) = Lowercase('TJSONObject')) Or
(Lowercase(bJsonValue.pairs[I].classname) = Lowercase('TDWJSONObject')) Or
(Lowercase(bJsonValue.pairs[I].classname) = Lowercase('TJSONArray')) Or
(Lowercase(bJsonValue.pairs[I].classname) = Lowercase('TDWJSONArray')) Then
(Lowercase(bJsonValue.pairs[I].classname) = Lowercase('TDWJSONArray')) Or
((Lowercase(bJsonValue.pairs[I].classname) = '_string') And (vString <> '') And
((vString[InitStrPos] = '[')) And (vString[Length(vString) - FinalStrPos] = ']')) Then
Begin
JSONBase := TRESTDWJSONBase.Create(bJsonValue.pairs[I].Value);
JSONBase := TRESTDWJSONBase.Create(vString);
// If bJsonValue.pairs[I].Name <> '' Then
If Assigned(JSONBase) Then
If bJsonValue.pairs[I].Name <> '' Then
Expand Down Expand Up @@ -1478,7 +1482,8 @@
If (bJsonValue.pairs[I].Value <> cNullvalue) And
(bJsonValue.pairs[I].Value <> cNullvalueTag) Then
Begin
vReal := StrToFloat(StringReplace(bJsonValue.pairs[I].Value, '.', DecimalLocal, [rfReplaceAll]));
vReal := StrToFloat(StringReplace(StringReplace(bJsonValue.pairs[I].Value, '.', DecimalLocal, [rfReplaceAll]),
'"', '', [rfReplaceAll]));
AddFloat(bJsonValue.pairs[I].Name, vReal);
End
Else
Expand Down
3 changes: 2 additions & 1 deletion CORE/Source/utils/JSON/uRESTDWJSON.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2284,7 +2284,8 @@ destructor TJSONArray.destroy;
obj := TObject(myArrayList[0]);
myArrayList [0] := nil;
If (obj <> CONST_FALSE) And
(obj <> CONST_TRUE) Then
(obj <> CONST_TRUE) And
(obj <> CNULL) Then
FreeAndNil(obj);
myArrayList.Delete(0);
end;
Expand Down
6 changes: 3 additions & 3 deletions CORE/Source/utils/uRESTDWMassiveBuffer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1535,9 +1535,9 @@ implementation
End;
End;
End;
{$IFDEF DELPHIXEUP}ftSingle, ftFMTBcd,{$ENDIF}
ftFloat, ftCurrency,
ftBCD : Begin
{$IFDEF DELPHIXEUP}ftSingle, {$ENDIF}
ftFloat, ftCurrency,
ftFMTBcd, ftBCD : Begin
If Not UpdateTag Then
Begin
If Field.IsNull Then
Expand Down
Loading