I am really confused using connection.end () in node-mysysl.
I donโt quite understand where it is going, at the moment I put it after the request, but then if I create a new request I get the Cannot enqueue Query after invoking quit. error message Cannot enqueue Query after invoking quit.
Now my application has a bunch of checks that go here:
socket.on('connect', function(data,callBack){ var session = sanitize(data['session']).escape(); var query = connection.query('SELECT uid FROM sessions WHERE id = ?', [session], function(err,results){ if(err){ console.log('Oh No! '+err); }else{ io.sockets.socket(socket.id).emit('connectConfirm',{data : true}); } connection.end(); }); });
Now after that, if I have any other request, I get an error.
I made a more reasonable explanation in my jsFiddle: http://jsfiddle.net/K2FBk/ to better explain the problem. I am receiving. The documentation for node-mysql does not fully explain the correct placement of connection.end()
When should this error be avoided?
Sir
source share