Problem about firedac returning multiple result sets

Source: Internet
Author: User

Previously, ADO was used. If multiple result sets returned by SQL can be obtained through nextrecordset in sequence.

Code porting to firedac is similar to processing multiple result sets, but there are some differences:

1. tdataset itself does not support multiple result sets, so do not waste any effort on this.

2. Switch to the next result set. The FD. nextrecordset corresponds to ADO. nextrecordset.

3. Determine whether the next result set exists. The ADO method is nextrecordset <> nil. The nextrecordset of firedac does not return a value. Therefore, determine FD. Active after nextrecordset.

4. ADO. the recordset corresponds to FD. data, but recordset is an interface. After manual reference counting is added, the ADO object can still be released, but data is not available. After the FD object is released, the data content will be gone, even though it is also an interface, however, the actual data is stored in the FD object.

5. firedac does not support returned results from multiple result sets by default. You need to manually set fetchoptions. autoclose: = false.

6. If you want to obtain multiple result sets one by one, you cannot directly use temporary variables to save data (data is an interface). You need to use a memory table to save the data:

Fdquery1.open; fdquery1.fetchall; fdmemtable1.close; {Be sure to close it first; otherwise, an error will be returned when data is set for the second time.} else: = fdquery1.data; If fdquery1.active then begin fdquery1.fetchall; FDM: = fdquery1.data; end;

 

Problem about firedac returning multiple result sets

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.