GetQueryVariables doesn't not work as expected

fneuhaus

Member
I want to do the folloing:

procedure TForm1.ApplyRecord(Sender: TOracleDataSet;
Action: Char; var Applied: Boolean; var NewRowId: String);

if Action = 'I' then begin
OracleQuery1.DeleteVariables;
OracleQuery1.Sql.Assign(slSQL);
Sender.DeclareQueryVariables(OracleQuery1);
Sender.SetQueryVariables(OracleQuery1);
OracleQuery1.Execute;
Sender.GetQueryVariables(OracleQuery1);
Applied := True;
end;

A record is inserted through a PL/SQL-Block in OracleQuery1.
The inserted fields are declared as variables (DeclareQueryVariables)
and get their initial values from the corresponding fields in
Sender (SetQueryVariables).

After execution of the PL/SQL-Block some of the variables have got
new values and I want to copy these new values to the corresponding fields
in Sender (GetQueryVariables) and this step doesn't work.

No field value in Sender has changed after a call to GetQueryVariables, although
all variables in OracleQuery1 provide the expected new values and the variable values
are different from the original field values in Sender.

Is this a bug or is it a misunderstanding of mine in using GetQueryVariables?

I recognised for example that you don't use GetQueryVariables in
your demo application PkgApply. Instead you call:

if VariableIndex('DeptNo') >= 0 then DeptNo.Value := GetVariable('DeptNo');

Is there a reason for that?
 
I'm not sure if GetQueryVariables works for other actions than a Refresh. During an Insert action it may be required to explicitly set the value of the modified fields, just like in the PkgApply demo.

------------------
Marco Kalter
Allround Automations
 
Back
Top