How can background data be looped into the database?

the data obtained by the foreground is in the form of an array. How to insert the data into the database after a loop? at present, this code cannot be looped. Why can only one piece of data be inserted in the database? Ask for guidance, thank you!
module.exports = function (sender) {

var yjDBService = global.yjRequire("yujiang.Foil").yjDBService;
var _getNewSN = global.yjRequire("yujiang.Foil.Biz","sn/_getNewSN.js");
var async = require("async");
var data = sender.req.body;

/ / above are referenced corporate frameworks and some components

var events = {
    "inserted" : insertData,
    "updated" : updateData
}

var fn = null;
for(var i in data){
    fn = events[i];
    var param = data[i];
    if(fn){
        fn(param);
    }else{
        sender.error(new Error("Param is not found!"))
    }
}

function insertData(data){
    var events = [];
    for (var i = 0; i < data.length; iPP) {
        (function(i){
            var obj = data[i];
            function insert(callback){
                _getNewSN({
                    query : {category : "ProjectOID_" + obj.ProjectOID},
                    success : function(sn){
                        var param = [parseInt(obj.FunctionCode),
                                parseInt(obj.StartRegister) , 
                                parseInt(obj.Length) , 
                                obj.Description, 
                                obj.ProjectHardwareOID , 
                                obj.Port,sn.SN];
                        var sql = "insert into " + 
                                "plcModbusDB(FunctionCode,StartRegister," + 
                                "Length,Description,ProjectHardwareOID," + 
                                "Port,DataID) values(?,?,?,?,?,?,?)";
                        yjDBService.exec({
                            sql:sql,
                            parameters : param,
                            success : sender.success,
                            error : sender.error
                        });
                    },
                    error : sender.error
                })
            }
            events.push(insert);
        })(i)
    }

    async.waterfall(events,function(err,result){
        if(err){
            sender.error(err);
        }else{
            sender.success(result);
        }
    })
    
}

function updateData(data){
    var sql = "update plcModbusDB " + 
                "set FunctionCode=?,StartRegister=?,Length=?,Description=? " + 
                "where OID = ?";
    yjDBService.exec({
        sql:sql,
        parameters : [data.FunctionCode , data.StartRegister , data.Length , data.Description , data.OID],
        success : sender.success,
        error : sender.error
    });
}

}

Mar.29,2022

concatenate a sql
insert into table name (field name 1, field name 2) values (value A1, value b1), (value a2, value b2), (value a3, value b3).

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb7b3d-4844b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb7b3d-4844b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?