static Task <CAsyncDBHandler.SQLExeInfo> TestBatch(CMysql mysql, List <KeyValue> ra, out CDBVariantArray vData) { //sql with delimiter '|' string sql = @" delete from employee;delete from company| INSERT INTO company(ID,NAME,ADDRESS,Income)VALUES(?,?,?,?)| insert into employee(CompanyId,name,JoinDate,image,DESCRIPTION,Salary)values(?,?,?,?,?,?)| SELECT * from company;select * from employee;select curtime()| call sp_TestProc(?,?,?)"; vData = new CDBVariantArray(); using (CScopeUQueue sbBlob = new CScopeUQueue()) { //first set vData.Add(1); vData.Add("Google Inc."); vData.Add("1600 Amphitheatre Parkway, Mountain View, CA 94043, USA"); vData.Add(66000000000.15); vData.Add(1); //google company id vData.Add("Ted Cruz"); vData.Add(DateTime.Now); sbBlob.Save(m_wstr); vData.Add(sbBlob.UQueue.GetBuffer()); vData.Add(m_wstr); vData.Add(254000.26); vData.Add(1); //input vData.Add(1.4); //input-output vData.Add(0); //output //second set vData.Add(2); vData.Add("Microsoft Inc."); vData.Add("700 Bellevue Way NE- 22nd Floor, Bellevue, WA 98804, USA"); vData.Add(93600000000.37); vData.Add(1); //google company id vData.Add("Donald Trump"); vData.Add(DateTime.Now); sbBlob.UQueue.SetSize(0); sbBlob.Save(m_str); vData.Add(sbBlob.UQueue.GetBuffer()); vData.Add(m_str); vData.Add(20254000.85); vData.Add(2); //input vData.Add(2.5); //input-output vData.Add(0); //output //third set vData.Add(3); vData.Add("Apple Inc."); vData.Add("1 Infinite Loop, Cupertino, CA 95014, USA"); vData.Add(234000000000.09); vData.Add(2); //Microsoft company id vData.Add("Hillary Clinton"); vData.Add(DateTime.Now); sbBlob.Save(m_wstr); vData.Add(sbBlob.UQueue.GetBuffer()); vData.Add(m_wstr); vData.Add(6254000.55); vData.Add(0); //input vData.Add(4.5); //input-output vData.Add(0); //output } CMysql.DRows r = (handler, rowData) => { //rowset data come here int last = ra.Count - 1; KeyValuePair <CDBColumnInfoArray, CDBVariantArray> item = ra[last]; item.Value.AddRange(rowData); }; CMysql.DRowsetHeader rh = (handler) => { //rowset header comes here KeyValue item = new KeyValue(handler.ColumnInfo, new CDBVariantArray()); ra.Add(item); }; //first, start a transaction with ReadCommited isolation //second, execute delete from employee;delete from company //third, prepare and execute three sets of // INSERT INTO company(ID,NAME,ADDRESS,Income)VALUES(?,?,?,?) //fourth, prepare and execute three sets of //insert into employee(CompanyId,name,JoinDate,image,DESCRIPTION,Salary)values(?,?,?,?,?,?) //fifth, SELECT * from company;select * from employee;select curtime() //sixth, prepare and three sets of call sp_TestProc(?,?,?) //last, commit transaction if there is no error, and rollback if there is one or more errors return(mysql.executeBatch(tagTransactionIsolation.tiReadCommited, sql, vData, r, rh, "|")); }