Skip to content

Commit 65e3ab1

Browse files
committed
Novas Atualizações
--- ### **Correções e Melhorias para Lazarus/FPC** - Correções de compilação para **Lazarus e FPC**. - Correção de `FreeMem` para Lazarus/Delphi antigos no binário. - Correção para **set de dados Timestamp** em Lazarus/FPC. - Correção no `ServerContext` em **modo visual** para Lazarus/Delphi. - Correção de `IndexDefs`. - Ajustes na **IDE**, nome de eventos e parâmetros dos eventos no Lazarus. ### **Ajustes e Melhorias em Exemplos/Demos** - Correção do exemplo **FileTransfer** para Lazarus no Windows. - Correção do exemplo **Client do FileTransfer**. - Correção do exemplo **FullClient**, permitindo que, ao clicar no título, um índice seja selecionado no campo correspondente via `IndexDefs`. - Melhoria no exemplo **ClientSQL**. - Ajustes gerais nos **demos** para Lazarus e Delphi. ### **Correções e Melhorias Gerais** - Correção no `Get Server Events`. - Correção de `DriverBase` para gravação de **dados nulos** em campos `Data`. - Ajuste de `UTF-8` para **campos string**. - Suporte a **campos UID** adicionado. - Correção de **compilação para Lazarus e Delphi antigos**. ---
1 parent 846a6cf commit 65e3ab1

File tree

11 files changed

+186
-122
lines changed

11 files changed

+186
-122
lines changed

CORE/Source/Basic/uRESTDWBasicDB.pas

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@
2323
Roniery - Devel.
2424
}
2525

26-
{$IFNDEF RESTDWLAZARUS}
27-
{$IFDEF FPC}
28-
{$MODE OBJFPC}{$H+}
29-
{$ENDIF}
26+
{$IFDEF FPC}
27+
{$MODE OBJFPC}{$H+}
3028
{$ENDIF}
3129

3230
interface

CORE/Source/Basic/uRESTDWParams.pas

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@
2222
Roniery - Devel.
2323
}
2424

25-
{$IFNDEF RESTDWLAZARUS}
26-
{$IFDEF FPC}
27-
{$MODE OBJFPC}{$H+}
28-
{$ENDIF}
25+
{$IFDEF FPC}
26+
{$MODE OBJFPC}{$H+}
2927
{$ENDIF}
3028

3129

@@ -261,20 +259,22 @@ interface
261259
vTypeObject : TTypeObject;
262260
vObjectDirection : TObjectDirection;
263261
vObjectValue : TObjectValue;
262+
FName,
264263
vAlias,
265264
vDefaultValue,
266265
vParamName : String;
267266
vEncoded : Boolean;
267+
Property Name : String Read GetDisplayName Write SetDisplayName;
268268
Public
269-
Function GetDisplayName : String; {$IFNDEF FPC}Override;{$ENDIF}
270-
Procedure SetDisplayName(Const Value : String); {$IFNDEF FPC}Override;{$ENDIF}
271-
Constructor Create (aCollection : TCollection); {$IFNDEF FPC}Override;{$ENDIF}
269+
Function GetDisplayName : String; Override;
270+
Procedure SetDisplayName(Const Value : String); Override;
271+
Constructor Create (aCollection : TCollection); Override;
272272
Published
273273
Property TypeObject : TTypeObject Read vTypeObject Write vTypeObject;
274274
Property ObjectDirection : TObjectDirection Read vObjectDirection Write vObjectDirection;
275275
Property ObjectValue : TObjectValue Read vObjectValue Write vObjectValue;
276276
Property Alias : String Read vAlias Write vAlias;
277-
Property ParamName : String Read GetDisplayName Write SetDisplayName;
277+
Property ParamName : String Read FName Write FName;
278278
Property Encoded : Boolean Read vEncoded Write vEncoded;
279279
Property DefaultValue : String Read vDefaultValue Write vDefaultValue;
280280
End;
@@ -681,15 +681,16 @@ implementation
681681
vTypeObject := toParam;
682682
vObjectDirection := odINOUT;
683683
vObjectValue := ovString;
684-
vParamName := 'dwparam' + IntToStr(aCollection.Count);
684+
vParamName := 'dwparam' + IntToStr(aCollection.Count);
685+
FName := vParamName;
685686
vEncoded := True;
686687
vDefaultValue := '';
687688
vAlias := '';
688689
End;
689690

690691
function TRESTDWParamMethod.GetDisplayName: String;
691692
begin
692-
Result := vParamName;
693+
Result := FName;
693694
end;
694695

695696
procedure TRESTDWParamMethod.SetDisplayName(const Value: String);
@@ -699,6 +700,7 @@ procedure TRESTDWParamMethod.SetDisplayName(const Value: String);
699700
Else
700701
Begin
701702
vParamName := Trim(Value);
703+
FName := vParamName;
702704
Inherited SetDisplayName(Value);
703705
End;
704706
end;
@@ -1687,7 +1689,7 @@ procedure TRESTDWParamsMethods.PutRecName(Index: String; Item: TRESTDWParamMetho
16871689
Result := vNewFieldList
16881690
Else
16891691
Begin
1690-
{$IFDEF RESTDWLAZARUS}
1692+
{$IFDEF FPC}
16911693
Result := @aNewFieldList;
16921694
{$ELSE}
16931695
{$IFNDEF FPC}

CORE/Source/Basic/uRESTDWServerContext.pas

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,22 @@ interface
9494
vOwnerCollection : TCollection;
9595
Procedure SetContextScript(Value : TStrings);
9696
Public
97-
Function GetDisplayName : String; {$IFNDEF FPC}Override;{$ENDIF}
98-
Procedure SetDisplayName (Const Value : String); {$IFNDEF FPC}Override;{$ENDIF}
99-
Function GetNamePath : String; {$IFNDEF FPC}Override;{$ENDIF}
100-
Procedure Assign (Source : TPersistent); Override;
101-
Constructor Create (aCollection : TCollection); Override;
97+
Function GetDisplayName : String; Override;
98+
Procedure SetDisplayName (Const Value : String); Override;
99+
Function GetNamePath : String; Override;
100+
Procedure Assign (Source : TPersistent); Override;
101+
Constructor Create (aCollection : TCollection); Override;
102102
Destructor Destroy; Override;
103103
Function BuildClass : String;
104104
Published
105-
Property ContextTag : String Read vContextTag Write vContextTag;
106-
Property TypeItem : String Read vType Write vType;
107-
Property ClassItem : String Read vClass Write vClass;
108-
Property TagID : String Read vTagID Write vTagID;
109-
Property TagReplace : String Read vTagReplace Write vTagReplace;
110-
Property css : String Read vCss Write vCss;
111-
Property ContextScript : TStrings Read vContextScript Write SetContextScript;
112-
Property ObjectName : String Read FName Write FName;
105+
Property ContextTag : String Read vContextTag Write vContextTag;
106+
Property TypeItem : String Read vType Write vType;
107+
Property ClassItem : String Read vClass Write vClass;
108+
Property TagID : String Read vTagID Write vTagID;
109+
Property TagReplace : String Read vTagReplace Write vTagReplace;
110+
Property css : String Read vCss Write vCss;
111+
Property ContextScript : TStrings Read vContextScript Write SetContextScript;
112+
Property ObjectName : String Read FName Write FName;
113113
Property OnRequestExecute : TRESTDWMarkRequest Read vDWMarkRequest Write vDWMarkRequest;
114114
Property OnBeforeRendererContextItem : TRESTDWGetContextItemTag Read vDWGetContextItemTag Write vDWGetContextItemTag;
115115
End;
@@ -180,6 +180,9 @@ interface
180180
Type
181181
TRESTDWContext = Class;
182182
PDWContext = ^TRESTDWContext;
183+
184+
{ TRESTDWContext }
185+
183186
TRESTDWContext = Class(TCollectionItem)
184187
Protected
185188
Private
@@ -208,6 +211,8 @@ interface
208211
Function GetBeforeRenderer : TRESTDWBeforeRenderer;
209212
Procedure SetBeforeRenderer (Value : TRESTDWBeforeRenderer);
210213
Procedure SetBaseURL(Value : String);
214+
Procedure SetContextName(Value : String);
215+
Property Name : String Read GetDisplayName Write SetDisplayName;
211216
Public
212217
Function GetDisplayName : String; Override;
213218
Procedure SetDisplayName(Const Value : String); Override;
@@ -219,9 +224,8 @@ interface
219224
Published
220225
Property Params : TRESTDWParamsMethods Read vDWParams Write vDWParams;
221226
Property ContentType : String Read vContentType Write vContentType;
222-
Property Name : String Read GetDisplayName Write SetDisplayName;
223227
Property BaseURL : String Read vBaseURL Write SetBaseURL;
224-
Property ContextName : String Read vContextName Write vContextName;
228+
Property ContextName : String Read vContextName Write SetContextName;
225229
Property DefaultHtml : TStrings Read vDefaultHtml Write SetDefaultPage;
226230
Property Description : TStrings Read vDescription Write SetDescription;
227231
Property Routes : TRESTDWRoutes Read vDWRoutes Write vDWRoutes;
@@ -301,7 +305,7 @@ implementation
301305

302306
{ TRESTDWContext }
303307

304-
Function TRESTDWContext.GetNamePath: String;
308+
function TRESTDWContext.GetNamePath: String;
305309
Begin
306310
Result := vOwnerCollection.GetNamePath + FName;
307311
End;
@@ -314,7 +318,7 @@ constructor TRESTDWContext.Create(aCollection: TCollection);
314318
DWReplyRequestData := TRESTDWReplyRequestData.Create(Nil);
315319
vOwnerCollection := aCollection;
316320
FName := 'dwcontext' + IntToStr(aCollection.Count);
317-
vContextName := '';
321+
vContextName := FName;
318322
vBaseURL := '/';
319323
DWReplyRequestData.Name := FName;
320324
vDWRoutes := TRESTDWRoutes.Create;
@@ -335,17 +339,17 @@ destructor TRESTDWContext.Destroy;
335339
inherited;
336340
end;
337341

338-
Function TRESTDWContext.GetBeforeRenderer: TRESTDWBeforeRenderer;
342+
function TRESTDWContext.GetBeforeRenderer: TRESTDWBeforeRenderer;
339343
Begin
340344
Result := vDWBeforeRenderer;
341345
End;
342346

343-
Function TRESTDWContext.GetDisplayName: String;
347+
function TRESTDWContext.GetDisplayName: String;
344348
Begin
345-
Result := DWReplyRequestData.Name;
349+
Result := FName;
346350
End;
347351

348-
Procedure TRESTDWContext.CompareParams(Var Dest : TRESTDWParams);
352+
procedure TRESTDWContext.CompareParams(var Dest: TRESTDWParams);
349353
Var
350354
I : Integer;
351355
Begin
@@ -364,7 +368,7 @@ destructor TRESTDWContext.Destroy;
364368
End;
365369
End;
366370

367-
Procedure TRESTDWContext.Assign(Source: TPersistent);
371+
procedure TRESTDWContext.Assign(Source: TPersistent);
368372
begin
369373
If Source is TRESTDWContext then
370374
Begin
@@ -376,17 +380,17 @@ destructor TRESTDWContext.Destroy;
376380
Inherited;
377381
End;
378382

379-
Function TRESTDWContext.GetReplyRequestStream: TRESTDWReplyRequestStream;
383+
function TRESTDWContext.GetReplyRequestStream: TRESTDWReplyRequestStream;
380384
Begin
381385
Result := DWReplyRequestData.OnReplyRequestStream;
382386
End;
383387

384-
Function TRESTDWContext.GetReplyRequest: TRESTDWReplyRequest;
388+
function TRESTDWContext.GetReplyRequest: TRESTDWReplyRequest;
385389
Begin
386390
Result := DWReplyRequestData.OnReplyRequest;
387391
End;
388392

389-
Procedure TRESTDWContext.SetBaseURL(Value : String);
393+
procedure TRESTDWContext.SetBaseURL(Value: String);
390394
Var
391395
vTempValue : String;
392396
Begin
@@ -403,12 +407,18 @@ destructor TRESTDWContext.Destroy;
403407
End;
404408
End;
405409

406-
Procedure TRESTDWContext.SetBeforeRenderer(Value: TRESTDWBeforeRenderer);
410+
Procedure TRESTDWContext.SetContextName(Value: String);
411+
Begin
412+
FName := Trim(Value);
413+
vContextName := FName;
414+
End;
415+
416+
procedure TRESTDWContext.SetBeforeRenderer(Value: TRESTDWBeforeRenderer);
407417
Begin
408418
vDWBeforeRenderer := Value;
409419
End;
410420

411-
Procedure TRESTDWContext.SetDescription(Strings : TStrings);
421+
procedure TRESTDWContext.SetDescription(Strings: TStrings);
412422
begin
413423
vDescription.Assign(Strings);
414424
end;
@@ -418,7 +428,7 @@ procedure TRESTDWContext.SetDefaultPage(Strings: TStrings);
418428
vDefaultHtml.Assign(Strings);
419429
end;
420430

421-
Procedure TRESTDWContext.SetDisplayName(Const Value: String);
431+
procedure TRESTDWContext.SetDisplayName(const Value: String);
422432
Begin
423433
If Trim(Value) = '' Then
424434
Raise Exception.Create(cInvalidContextName)
@@ -432,7 +442,8 @@ procedure TRESTDWContext.SetDefaultPage(Strings: TStrings);
432442
End;
433443
End;
434444

435-
Procedure TRESTDWContext.SetReplyRequestStream(Value : TRESTDWReplyRequestStream);
445+
procedure TRESTDWContext.SetReplyRequestStream(Value: TRESTDWReplyRequestStream
446+
);
436447
begin
437448
DWReplyRequestData.OnReplyRequestStream := Value;
438449
end;

CORE/Source/Basic/uRESTDWServerEvents.pas

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ interface
9292
Procedure SetBaseUrl (Value : String);
9393
Procedure SetContentType(Value : String);
9494
Procedure SetDataMode (Value : TDataMode);
95+
Property Name : String Read GetDisplayName Write SetDisplayName;
9596
Public
9697
Function GetDisplayName : String; Override;
9798
Procedure SetDisplayName(Const Value : String); Override;
@@ -104,8 +105,7 @@ interface
104105
Property Routes : TRESTDWRoutes Read vDWRoutes Write vDWRoutes;
105106
Property Params : TRESTDWParamsMethods Read vDWParams Write vDWParams;
106107
Property DataMode : TDataMode Read vDataMode Write SetDataMode;
107-
Property Name : String Read GetDisplayName Write SetDisplayName;
108-
Property EventName : String Read vEventName Write vEventName;
108+
Property EventName : String Read FName Write FName;
109109
Property BaseURL : String Read vBaseURL Write SetBaseURL;
110110
Property DefaultContentType : String Read vContentType Write SetContentType;
111111
Property CallbackEvent : Boolean Read vCallbackEvent Write vCallbackEvent;
@@ -171,7 +171,7 @@ interface
171171
Var DWParams : TRESTDWParams);
172172
Published
173173
Property IgnoreInvalidParams : Boolean Read vIgnoreInvalidParams Write vIgnoreInvalidParams;
174-
Property Events : TRESTDWEventList Read vEventList Write vEventList;
174+
Property Events : TRESTDWEventList Read vEventList Write vEventList;
175175
Property AccessTag : String Read vAccessTag Write vAccessTag;
176176
Property DefaultEvent : String Read vDefaultEvent Write vDefaultEvent;
177177
Property OnCreate : TObjectEvent Read vOnCreate Write vOnCreate;
@@ -268,7 +268,7 @@ constructor TRESTDWEvent.Create(aCollection: TCollection);
268268

269269
Function TRESTDWEvent.GetDisplayName: String;
270270
Begin
271-
Result := DWReplyEventData.Name;
271+
Result := FName;
272272
End;
273273

274274
Procedure TRESTDWEvent.Assign(Source: TPersistent);
@@ -802,8 +802,8 @@ procedure TRESTDWClientEvents.GetOnlineEvents(Value: Boolean);
802802
If Assigned(vRESTClientPooler.OnBeforeExecute) Then
803803
vRESTClientPooler.OnBeforeExecute(Self);
804804
DWParams := TRESTDWParams.Create;
805-
DWParams.CriptOptions.Use := CriptOptions.Use;
806-
DWParams.CriptOptions.Key := CriptOptions.Key;
805+
// DWParams.CriptOptions.Use := CriptOptions.Use;
806+
// DWParams.CriptOptions.Key := CriptOptions.Key;
807807
JSONParam := TRESTDWJSONParam.Create(RESTClientPoolerExec.Encoding);
808808
JSONParam.ParamName := 'dwservereventname';
809809
JSONParam.ObjectDirection := odIn;

CORE/Source/Consts/uRESTDWConsts.pas

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@
2222
Roniery - Devel.
2323
}
2424

25-
{$IFNDEF RESTDWLAZARUS}
26-
{$IFDEF FPC}
27-
{$MODE OBJFPC}{$H+}
28-
{$ENDIF}
25+
{$IFDEF FPC}
26+
{$MODE OBJFPC}{$H+}
2927
{$ENDIF}
3028

3129
Interface
@@ -62,7 +60,7 @@
6260

6361
// controle de versão
6462
RESTDWVersionINFO = 'v2.1.0-';
65-
RESTDWRelease = '3920';
63+
RESTDWRelease = '3933';
6664
RESTDWCodeProject = 'Galaga - Github';
6765
RESTDWVersao = RESTDWVersionINFO + RESTDWRelease + '(' + RESTDWCodeProject + ')';
6866
RESTDWDialogoTitulo = 'REST DataWare Components ' + RESTDWVersao;

CORE/Source/Database_Drivers/uRESTDWDriverBase.pas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ procedure TRESTDWDrvDataset.ImportParams(DWParams: TRESTDWParams);
578578
vParam.Clear;
579579
end
580580
else If vParam.DataType in [ftDate, ftTime, ftDateTime, ftTimeStamp] then begin
581-
if (Trim(DWParams[I].Value) <> '') and (not DWParams[I].IsNull) then begin
581+
if (Trim(DWParams[I].AsString) <> '') and (not DWParams[I].IsNull) then begin
582582
if vParam.DataType = ftDate then
583583
vParam.Value := DWParams[I].AsDate
584584
else If vParam.DataType = ftTime then
@@ -617,7 +617,7 @@ procedure TRESTDWDrvDataset.ImportParams(DWParams: TRESTDWParams);
617617
if vParam.RESTDWDataTypeParam in [dwftMemo, dwftFmtMemo] then
618618
vParam.Value := DecodeStrings(DWParams[I].AsString)
619619
else
620-
vParam.Value := utf8tostring(DWParams[I].AsString);
620+
vParam.Value := DWParams[I].AsString;
621621
{$ELSE}
622622
if vParam.RESTDWDataTypeParam in [dwftMemo, dwftFmtMemo] then
623623
vParam.Value := DecodeStrings(DWParams[I].AsString)
@@ -628,7 +628,7 @@ procedure TRESTDWDrvDataset.ImportParams(DWParams: TRESTDWParams);
628628
if vParam.RESTDWDataTypeParam in [dwftMemo] then
629629
vParam.Value := DecodeStrings(DWParams[I].AsString, csUndefined)
630630
else
631-
vParam.Value := utf8tostring(DWParams[I].AsString);
631+
vParam.Value := DWParams[I].AsString;
632632
{$ENDIF}
633633
End
634634
Else

0 commit comments

Comments
 (0)