Skip to content

Commit 41b832c

Browse files
committed
Ajustes em ftArray, JsonInterface e ClientSQL
- Suporte a campos ftArray como String (limite inicial 255). - Correções de Null/NullClass na JsonInterface (inclui Lazarus). - Remoção de memory leaks em Lazarus/FPC. - Propriedade BinaryRequest removida do ClientSQL (padrão binário será no ClientPooler). - Ajuste da numeração de versão.
1 parent 89c88fa commit 41b832c

File tree

7 files changed

+118
-69
lines changed

7 files changed

+118
-69
lines changed

CORE/Source/Basic/uRESTDWBasicDB.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,13 +817,13 @@ interface
817817
Property FieldDefs;
818818
Property ReadData : Boolean Read GetReadData;
819819
Property MasterDetailList : TMasterDetailList Read vMasterDetailList Write vMasterDetailList;
820+
Property BinaryRequest : Boolean Read vBinaryRequest; // Write vBinaryRequest;
820821
Published
821822
Property MasterDataSet : TRESTDWClientSQL Read vMasterDataSet Write SetMasterDataSet;
822823
{$IFDEF FPC}
823824
Property DatabaseCharSet;
824825
{$ENDIF}
825826
Property MasterCascadeDelete : Boolean Read vCascadeDelete Write vCascadeDelete;
826-
Property BinaryRequest : Boolean Read vBinaryRequest Write vBinaryRequest;
827827
Property Datapacks : Integer Read vDatapacks Write SetDatapacks;
828828
Property OnGetDataError : TOnEventConnection Read vOnGetDataError Write vOnGetDataError; //Recebe os Erros de ExecSQL ou de GetData
829829
Property AfterScroll : TOnAfterScroll Read vOnAfterScroll Write vOnAfterScroll;

CORE/Source/Basic/uRESTDWStorageBin.pas

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,22 @@ interface
160160
AStream.Read(vFieldType, SizeOf(vFieldType));
161161
vFieldDef.DataType := DWFieldTypeToFieldType(vFieldType);
162162
FFieldTypes[I] := vFieldType;
163+
164+
If vFieldType in [{$IFDEF FPC}45, {$ENDIF}dwftExtended] Then
165+
FFieldTypes[I] := {$IFDEF FPC}Integer(ftFMTBcd){$ELSE}Integer(ftExtended){$ENDIF}
166+
Else
167+
FFieldTypes[I] := vFieldType;
163168
// field size
164169
AStream.Read(vInt, SizeOf(vInt));
170+
If vFieldType = dwftVarBytes Then //Max Array Size
171+
Begin
172+
FFieldTypes[I] := Integer(ftString);
173+
FFieldSize[I] := 255;
174+
vInt := FFieldSize[I];
175+
End
176+
Else
177+
FFieldSize[I] := vInt;
165178
vFieldDef.Size := vInt;
166-
FFieldSize[I] := vInt;
167179
// field precision
168180
AStream.Read(vInt, SizeOf(vInt));
169181
FFieldPrecision[I] := vInt;
@@ -341,7 +353,13 @@ interface
341353
FFieldTypes[I] := vFieldType;
342354
// field size
343355
AStream.Read(vFieldSize, SizeOf(vFieldSize));
344-
FFieldSize[I] := vFieldSize;
356+
If vFieldType = dwftVarBytes Then //Max Array Size
357+
Begin
358+
FFieldTypes[I] := Integer(ftString);
359+
FFieldSize[I] := 255;
360+
End
361+
Else
362+
FFieldSize[I] := vFieldSize;
345363
// field precision
346364
AStream.Read(vFieldPrecision, SizeOf(vFieldPrecision));
347365
{$IFDEF FPC}
@@ -589,8 +607,9 @@ interface
589607
End;
590608
End;
591609
// N Bytes - Strings
610+
dwftVarBytes,
592611
dwftFixedChar,
593-
dwftString :Begin
612+
dwftString : Begin
594613
stream.Read(vInt64, SizeOf(vInt64));
595614
vString := '';
596615
If vInt64 > 0 Then
@@ -611,7 +630,7 @@ interface
611630
Move(vString[InitStrPos], pData^, Length(vString));
612631
{$ENDIF}
613632
End;
614-
End;
633+
End;
615634
// 1 - Byte - Inteiro
616635
dwftByte,
617636
dwftShortint :Begin
@@ -888,7 +907,7 @@ interface
888907
dwftStream,
889908
dwftOraBlob,
890909
dwftBlob,
891-
dwftBytes :Begin
910+
dwftBytes : Begin
892911
SetLength(vBytes, 0);
893912
stream.Read(vInt64, SizeOf(DWInt64));
894913
If vInt64 > 0 Then
@@ -906,7 +925,7 @@ interface
906925
Finally
907926
SetLength(vBytes, 0);
908927
End;
909-
End;
928+
End;
910929
// N Bytes - Others
911930
Else
912931
Begin
@@ -975,6 +994,7 @@ interface
975994
If (FFieldTypes[i] In [dwftFixedChar,
976995
dwftWideString,
977996
dwftString,
997+
dwftVarBytes,
978998
dwftFixedWideChar]) Then
979999
Begin
9801000
AStream.Read(vInt64, Sizeof(vInt64));
@@ -1291,7 +1311,7 @@ interface
12911311
dwftWideString : vByte := FieldTypeToDWFieldType(ftString);
12921312
dwftSingle : vByte := FieldTypeToDWFieldType(ftFloat);
12931313
End;
1294-
AStream.Write(vByte, SizeOf(vByte));
1314+
AStream.Write(vByte, SizeOf(vByte));
12951315
// fieldsize
12961316
vInt := ADataset.Fields[i].Size;
12971317
AStream.Write(vInt, SizeOf(vInt));
@@ -1427,6 +1447,7 @@ interface
14271447
Stream.Write(vString[1], vInt64);
14281448
{$ENDIF}
14291449
End;
1450+
dwftVarBytes,
14301451
dwftString : Begin
14311452
{$IFDEF RESTDWANDROID}
14321453
vString := MarshaledAString(PData);
@@ -1658,6 +1679,7 @@ interface
16581679
AStream.Write(vString[InitStrPos], vInt64);
16591680
End;
16601681
// N - Bytes
1682+
dwftVarBytes,
16611683
dwftString : Begin
16621684
vString := ADataset.Fields[i].AsString;
16631685
If EncodeStrs Then

CORE/Source/Consts/uRESTDWConsts.pas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Unit uRESTDWConsts;
1+
Unit uRESTDWConsts;
22

33
{$I ..\..\Source\Includes\uRESTDW.inc}
44

@@ -60,8 +60,8 @@
6060

6161
// controle de versão
6262
RESTDWVersionINFO = 'v2.1.0-';
63-
RESTDWRelease = '3857';
64-
RESTDWCodeProject = 'Galaga - SourceForge';
63+
RESTDWRelease = '3974';
64+
RESTDWCodeProject = 'Final Fantasy X - GitHub';
6565
RESTDWVersao = RESTDWVersionINFO + RESTDWRelease + '(' + RESTDWCodeProject + ')';
6666
RESTDWDialogoTitulo = 'REST DataWare Components ' + RESTDWVersao;
6767
RESTDWSobreTitulo = 'REST DataWare '+ RESTDWVersao;

CORE/Source/Sockets/Indy/uRESTDWIdBase.pas

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3281,7 +3281,6 @@ TIdHTTPAccess = class(TIdHTTP)
32813281
{$IFEND}
32823282
vAuthRealm := AResponseInfo.AuthRealm;
32833283
vContentType := ARequestInfo.ContentType;
3284-
32853284
If CommandExec (TComponent(AContext),
32863285
RemoveBackslashCommands(ARequestInfo.URI),
32873286
ARequestInfo.RawHTTPCommand,
@@ -3898,10 +3897,8 @@ function TRESTDWIdClientPooler.IsServerLive(Aip: String; Aport: Integer;
38983897
If Assigned(bJsonOBJ) Then
38993898
FreeAndNil(bJsonOBJ);
39003899
End;
3901-
{$IFNDEF FPC} //TODO XyberX
39023900
If Assigned(bJsonValue) Then
39033901
FreeAndNil(bJsonValue);
3904-
{$ENDIF}
39053902
End;
39063903
Finally
39073904
If vTempValue <> '' Then

0 commit comments

Comments
 (0)