like
Code: Select all
select * from public.p_test1(:id, :b, :c)
:b, :c other params no matter what types
then other query
Code: Select all
select * from public.p_test2(:id, :d, :e)
:d, :e other params no matter what types
and on TZquery.Open have error Could not convert variant of type (String) into type (Boolean)
all code
Code: Select all
zqrQuery.Close;
zqrQuery.Sql.Text := 'select * from public.p_test1(:id, :b, :c)';
zqrQuery.ParamByName('id').Value := VarToInt(...);
...
zqrQuery.Open;
...
zqrQuery.Close;
zqrQuery.Sql.Text := 'select * from public.p_test2(:id, :d, :e)';
zqrQuery.ParamByName('id').Value := VarToIntArray(...);
...
zqrQuery.Open; // error;
function VarToIntArray():variant; return null or string like '{10,20,30}'
quick analysis of errors found as for me wrong code
Code: Select all
procedure TZAbstractRODataset.UpdateSQLStrings(Sender: TObject);
var
I: Integer;
OldParams: TParams;
begin
FieldDefs.Clear;
if Active then
Close
else Statement := nil;
OldParams := TParams.Create; //save old params
OldParams.Assign(FParams);
FParams.Clear;
try
for I := 0 to FSQL.ParamCount - 1 do
FParams.CreateParam(ftUnknown, FSQL.ParamNames[I], ptUnknown); //add new params with datatype ftUnknown
FParams.AssignValues(OldParams); // restore from old query param params with same name (datatype and value)
finally
OldParams.Free;
end;
end;
Code: Select all
zqrQuery.Close;
zqrQuery.Params.Clear;