查看node.js模块列表
- node- mysql-实现MySQL协议的node.js模块
- node-mysql2 —另一个纯JS异步驱动程序。流水线,准备好的语句。
- node-mysql-libmysqlclient —基于libmysqlclient的MySQL异步绑定
node-mysql看起来很简单:
var mysql = require('mysql');var connection = mysql.createConnection({ host : 'example.org', user : 'bob', password : 'secret',});connection.connect(function(err) { // connected! (unless `err` is set)});
查询:
var post = {id: 1, title: 'Hello MySQL'};var query = connection.query('INSERT INTO posts SET ?', post, function(err, result) { // Neat!});console.log(query.sql); // INSERT INTO posts SET `id` = 1, `title` = 'Hello MySQL'
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)