[英]Why there is a part of the code who is not executed? Node.js/Oriento
I have call a function, function select(items ,className, callback)
,which have inside a console.log console.log("Function ran.")
and the console.log is never made. 我已经调用了一个函数,
function select(items ,className, callback)
,该console.log("Function ran.")
console.log console.log("Function ran.")
并且从未创建console.log 。
Here I called it: 在这里我称它为:
io.on('connection', function(socket){
console.log('User connected.');
openServer(); //This start the connection between OrientDB and the Server
select("name", "Buyers", function(err, data){
if(err){
console.log("ERROR: ", err);
} else {
console.log("result from db is: ", data);
}
});
Code of the function: 功能代码:
function select(items ,className, callback){
server.query("SELECT "+items+" FROM "+className+"", function(err, result){
console.log("Function ran.");
if (err)
return callback(err, null);
else
return callback(null, result[0].name);
});
}
Neither of console.log()
of the select function()
are executed. select function()
的console.log()
select function()
均未执行。
My question is: 我的问题是:
OrientJS as the old Oriento uses Promises OrientJS作为旧的Oriento使用Promises
http://orientdb.com/docs/last/OrientJS-Query.html http://orientdb.com/docs/last/OrientJS-Query.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.