Mysql子查詢加鎖,NodeJs使用Mysql模塊實現(xiàn)事務(wù)處理實例?
先npm install mysql
然后代碼中就可以require('mysql');
就可以使用了
var mysql = require('mysql');var pool = mysql.createPool(config);pool.getConnection(function(err, connection) {// Use the connectionconnection.query( 'SELECT something FROM sometable', function(err, rows) {// And done with the connection.connection.end();// Don't use the connection here, it has been returned to the pool.});});
js代碼透明,你在寫好代碼提交給別人的時候,或是部署的時候,用
Jshaman
給代碼加密一下,別人就看不了你的代碼了