NodeJS将批量值插入MySQL

NodeJS将批量值插入MySQL,mysql,Mysql,我想对MYSQL表进行大容量插入。根据这个,我使用的是2D数组。然而,我不断得到MYSQL语法错误。有人能指出我吗 错误: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' 我在db中有五列,其中有一个自动递增的Id,update\u date和create\u d

我想对MYSQL表进行大容量插入。根据这个,我使用的是2D数组。然而,我不断得到MYSQL语法错误。有人能指出我吗

错误:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL'
我在db中有五列,其中有一个自动递增的
Id
update\u date
create\u date
,我没有将其放入
insert
查询中。对于
update\u date
create\u date
我在更新当前时间戳时将其设置为

var insert = 'INSERT INTO table2 (link, text) VALUES ?';
var res = [['www.google.com', 'google'],['www.bing.com', 'bing']];
var connection = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: 'XXX',
    database: 'dbname'
});
connection.connect();
connection.query(insert, [res], function(err) {
    if (err) {
        console.log(err)
        connection.end();
        throw err;
    }
    connection.end();
});

字段定义中是否缺少“默认值”

    update_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

字段定义中是否缺少“默认值”

    update_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

你能手动插入记录吗?例如,在mysql控制台或工作台中运行INSERT INTO table2(链接、文本)值('www.google.com','google');是的,我可以手动插入。但是日期值为空。我需要修改该表以将默认值设置为NOTNULL。然而,这并没有解决我的问题-(那么,您还没有更改表定义?
alter table table 2 modify created_at timestamp NOT NULL DEFAULT CURRENT_timestamp ON UPDATE CURRENT_timestamp
我已经更改了它。
6 apple.com 2016-01-19 09:21:51 2016-01-19 09:21:51 apple
示例记录插入手册可以手动插入记录吗?即在mysql控制台中或者WorkBench运行INSERT INTO table2(链接,文本)值('www.google.com','google');是的,我可以手动插入。但是日期值为null。我需要更改表格以将默认值设置为非null。但是,这并没有解决我的问题-(那么,您没有更改表定义?
alter table table 2 modify created_at timestamp NOT NULL DEFAULT CURRENT_timestamp ON UPDATE CURRENT_timestamp
我已经更改了它。
6 apple.com 2016-01-19 09:21:51 2016-01-19 09:21:51 apple
-手动插入样本记录