How do I do a bulk insert in mySQL using node.js

后端 未结 12 2288
一整个雨季
一整个雨季 2020-11-22 10:39

How would one do a bulk insert into mySQL if using something like https://github.com/felixge/node-mysql

12条回答
  •  不思量自难忘°
    2020-11-22 11:06

    I was having similar problem. It was just inserting one from the list of arrays. It worked after making the below changes.

    1. Passed [params] to the query method.
    2. Changed the query from insert (a,b) into table1 values (?) ==> insert (a,b) into table1 values ? . ie. Removed the paranthesis around the question mark.

    Hope this helps. I am using mysql npm.

提交回复
热议问题