为什么赢了';我的MySQL语句是否在NodeJS中执行?
我似乎找不到其他人有这个问题,但似乎我根本无法执行语句 这是我的密码:为什么赢了';我的MySQL语句是否在NodeJS中执行?,mysql,node.js,Mysql,Node.js,我似乎找不到其他人有这个问题,但似乎我根本无法执行语句 这是我的密码: xroxy.getProxies(function(error, proxies) { console.log(proxies); connection.prepare('INSERT INTO `proxies` (`ip`, `port`) VALUES (INET_ATON(?), ?)', function(err, statement) { for (
xroxy.getProxies(function(error, proxies) {
console.log(proxies);
connection.prepare('INSERT INTO `proxies` (`ip`, `port`) VALUES (INET_ATON(?), ?)', function(err, statement) {
for (var key in proxies) {
if (!proxies.hasOwnProperty(key)) continue;
console.log(key + ": " + proxies[key]);
statement.execute([key, proxies[key]], function(err, rows, columns) {
console.log(err);
console.log(rows);
});
statement.close();
//console.log('test');
}
});
connection.end(function(err) {
});
}, 100);
在使用statement.execute()
之前,我尝试只使用connection.execute()
,但这似乎也不起作用。我已经让mysql2处于调试模式,它向我显示了语句正在准备(甚至在我使用connection.execute()
时也准备好了),但如果超过了它,则不会向数据库中插入任何内容
回调似乎从未从
语句中调用。execute()
或连接。execute()
您在哪里添加准备好的语句参数?它们来自xroxy。getProxies的callbackhi Rob,您可以制作简单的可复制示例(包括架构创建)吗并将其作为问题放在mysql2 github上?我将尝试帮助您在执行任何语句之前关闭连接。尝试计算已完成的execute()调用数,并在上一次回调中执行connection.end()