Page 1 of 1

How to "clone" a TOraQuery

Posted: Mon 03 Oct 2005 14:33
by Eric
Hi,

Is there a simple way to entirely copy a TOraQuery (with its results, preparation, position, dataset, etc...).

NB: it is to always use the same TOraQuery in a recursive loop...

Posted: Tue 04 Oct 2005 07:22
by Alex
You can use the following code to implement necessary functionality,
but notice that you need to specify KeyFields or include RowId field in select statement:
OraQuery1 - base query
OraQuery2 - "clone" query

Code: Select all

  OraQuery2.Assign(OraQuery1);
  OraQuery2.Open;
  OraQuery2.GotoCurrent(OraQuery1);
This solution doesn't assign OraQuery1 results to OraQuery2, so data fetch will be performed once more.