dimanche 29 mars 2015

Node-mysql with LOCK TABLES

Anyone know how to use node-mysql and LOCK/UNLOCK TABLES correctly ?


My code do not work as expected, parallel connections still can access tables and rewrite them



sql.query('LOCK TABLES `y` WRITE, `z` WRITE', function(err, row){
sql.query("DELETE FROM `y` WHERE `unID`="+sql.escape(data.id), function(err, row2){
sql.query('UPDATE `z` SET `w`=`w`+'+w+' WHERE `login`='+sql.escape(socket.waa), function(err, row3){
sql.query("UNLOCK TABLES");
});
});
});

Aucun commentaire:

Enregistrer un commentaire