Two TZParams bugs
Posted: 21.01.2021, 17:09
Hello,
I found two bugs with the TZparams handling. Imagine the following code:
As it is a new parameter, I expect it to be empty but a message box will pop up, containing the date. I don't think this is correct.
Second one is an access violation and I have no clue what is going on...
Error is raised at the string parameter, call stack is ZParam.GetAsVariant, line 2336:
UnicodeString(TVarData(Result).{$IF declared(VUString)}VUString{$ELSE}VAny{$IFEND}) := UnicodeString(FData.pvPointer);
Using Delphi 10.4.1, Zeos 8.0.0-015f7868e:
egonhugeist on 1/20/2021, 5:58:11 PM
Copy&Paste documentations Fix lately introduced old PG-Bug and IB/FB value logs
I found two bugs with the TZparams handling. Imagine the following code:
Code: Select all
ZQuery1.SQL.Text := ':pParam1 :pParam2 :pParam3';
ZQuery1.Params[0].AsDateTime := Now;
ZQuery1.Params[1].AsDateTime := Now;
ZQuery1.Params[2].AsString := 'Hello, world';
ZQuery1.SQL.Text := ':pParam5';
If Not ZQuery1.Params[0].IsNull Then
ShowMessage(ZQuery1.Params[0].AsString);
Second one is an access violation and I have no clue what is going on...
Code: Select all
Var
dict: TDictionary<String, Variant>;
a: Integer;
begin
dict := TDictionary<String, Variant>.Create;
Try
ZQuery1.SQL.Text := ':pParam1 :pParam2 :pParam3';
ZQuery1.Params[0].AsDateTime := Now;
ZQuery1.Params[1].AsDateTime := Now;
ZQuery1.Params[2].AsString := 'Hello, world';
For a := 0 To ZQuery1.Params.Count - 1 Do
dict.AddOrSetValue(ZQuery1.Params[a].Name, ZQuery1.Params[a].Value);
Finally
FreeAndNil(dict);
End;
End;
UnicodeString(TVarData(Result).{$IF declared(VUString)}VUString{$ELSE}VAny{$IFEND}) := UnicodeString(FData.pvPointer);
Using Delphi 10.4.1, Zeos 8.0.0-015f7868e:
egonhugeist on 1/20/2021, 5:58:11 PM
Copy&Paste documentations Fix lately introduced old PG-Bug and IB/FB value logs