Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么赢了';我的MySQL语句是否在NodeJS中执行?_Mysql_Node.js - Fatal编程技术网

为什么赢了';我的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()