Show: Delphi C++
Display Preferences

FireDAC.Comp.Client.TFDCustomCommand.NextRecordSet

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure NextRecordSet;

C++

void __fastcall NextRecordSet(void);

Properties

Type Visibility Source Unit Parent
procedure
function
public
FireDAC.Comp.Client.pas
FireDAC.Comp.Client.hpp
FireDAC.Comp.Client TFDCustomCommand

Description

Moves to the next cursor, returned by the SQL command.

The NextRecordSet method closes the current cursor, forwards it to the next accessible cursor and opens the command. If there are no more accessible cursors after performing this call, the command is closed (State = csPrepared).

The Close method closes the current cursor. The CloseAll method discards all assocciated cursors. So, to get all cursors, you should set FetchOptions.AutoClose to False before opening the command.

Oracle REF CURSORs for FireDAC are also command cursors, and the NextRecordSet call will select the next PL/SQL REF CURSOR parameter.

At design time, you can forward the dataset to the next cursor, by right clicking the component and choosing the "Next record set" popup menu item.

Example

ADCommand1.FetchOptions.AutoClose := False;
ADCommand1.CommandText.Text := 'select 1 as i; select ''qwe'' as s';
ADCommand1.Open;
oTab := ADCommand1.Define;
try
  ADCommand1.Fetch(oTab);
  ShowMessage(oTab.Rows[0].DumpRow(True)); // output "i: 1"
finally
  oTab.Free;
end;
ADCommand1.NextRecordSet;
oTab := ADCommand1.Define;
try
  ADCommand1.Fetch(oTab);
  ShowMessage(oTab.Rows[0].DumpRow(True)); // output "s: qwe"
finally
  oTab.Free;
end;
ADQuery1.CloseAll;

See Also

Personal tools
RAD Studio 10.2 Tokyo
In Other Languages
Previous Versions
Assistance