FIREDAC Database Bulk Statement submission (efficient)

Source: Internet
Author: User

FD provides a batch execution function, called an Array DML. You can do this:

FDQuery1.Sql.Text:=' INSERT into Mytab values (:p 1,:p 2,:p 3) ';Here Fdquery1.params collection are filled by 3 parametersFDQuery1.Params.ArraySize:=100;For I:=0To100-1DoBegin FDQuery1.Params[0]. Asintegers[i := i; Fdquery1. Params[1]. Asstrings[i] :=  ' qwe ' Span class= "sy1" >; Fdquery1. Params[2]. Clear (I; End 
/span>
FDQuery1.  Execute(0);//starting from 0, performing 100 batch executions

ShowMessage(inttostr(FDQuery1.  rowsaffected));//show the number of successful executions

Onexecuteerror event to handle execution errors
Procedure TForm1.Fdquery1executeerror(Asendertobjectinteger; var aaction: Tfderroraction) ; Begin if aerror. Errors[0]. Kind = ekukviolated then aaction := Easkip Span class= "KW1" >else aaction := eafail; End               
              

FIREDAC Database Bulk statement submission (efficient)

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.