全站数据
9 6 1 5 2 8 3

NodeJs使用Mysql模块实现事务处理实例

二建小科普 | 简单学习,快乐成长!         

先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

给代码加密一下,别人就看不了你的代码了

猜你喜欢内容

更多推荐