* Memo field has no max length, encode param values with EncodeUriComponent

This commit is contained in:
Michaël Van Canneyt 2022-07-10 11:13:06 +02:00
parent 3f2fac179e
commit 9c9231e6ba

View File

@ -87,6 +87,7 @@ Type
function GetP(aIndex : Integer): TQueryParam;
procedure SetP(aIndex : Integer; AValue: TQueryParam);
Public
function AddParam(aName : string; aEnabled : Boolean = False) : TQueryParam; overload;
Property Params[aIndex : Integer] : TQueryParam Read GetP Write SetP; default;
end;
@ -193,7 +194,6 @@ end;
function TQueryParam.AsQuery: String;
var
S : String;
B : TBytes;
I : Integer;
@ -221,7 +221,7 @@ begin
else
Result:=AsString
end;
Result:=Name+'='+encodeURIComponent(AsString);
Result:=Name+'='+Result;
end;
{ TQueryParams }
@ -236,6 +236,13 @@ begin
Items[aIndex]:=aValue;
end;
function TQueryParams.AddParam(aName: string; aEnabled: Boolean): TQueryParam;
begin
Result:=add As TQueryParam;
Result.Name:=aName;
Result.Enabled:=aEnabled;
end;
{ TServiceRequest }
constructor TServiceRequest.Create(const aMethod,aURL, aUserName, aPassword: String; aOnDone1 : TNotifyEvent; aOnDone2 : TNotifyEvent = Nil);
@ -582,8 +589,10 @@ begin
if Not jsIsNan(toNumber(D)) then
begin
Result:=Trunc(toNumber(D));
if (Result<=0) then
if (Result<0) then
Raise EJSONDataset.CreateFmt('Invalid maximum length specifier for field %s',[AName])
else if Result=0 then // memofield
Result:=1000000
end
else
begin