Node????mysql???????
???????????? ???????[ 2016/12/30 11:22:24 ] ????????????? Node
	???????Node??Web?????????????????? NoSQL ??????????????? MongoDB ???????????Щ????Web???????????????????????? MySQL ????????????????????????? MySQL ???????????????????????????
	????npm install --save mysql
	?????????????????? MySQL ?????????????????????????DOCS???????????????????????????
	var mysql = require('mysql');
	var connection = mysql.createConnection({
	host: 'localhost'??
	user: 'me'??
	password : 'secret'??
	database : 'my_db'
	});
	connection.connect();
	connection.query('SELECT 1 + 1 AS solution'?? function(err?? rows?? fields){
	if (err) throw err;
	console.log('The solution is: '?? rows[0].solution);
	});
	connection.end();
	???????????????????????????????ó?????? createConnection(option) ????????????????????????????? connect() ?????????????????? query() ???????SQL???????????????????????? rows ????? rows ??????????
	????1. ????
	?????????????????????????????????Щ???????????? createConnection(option) ??? option ?? option ??????????????????????? createConnection() ???????????о??????????????
	????host ??????
	????user ?????????????
	????password ????
	????database ?????????
	??????????????????????????1??DOCS?????????о????????????????Щ?????????
	????2. ???
	????????????????? end() ?????? end() ?????????????????????£?
	????connect.end(function(err){
	????console.log('End a connection');
	????});
	???????????????????? end() ????????????????????????????????????????????? destroy() ??????????????????????????????????ɡ?
	????????????????
	var mysql = require('mysql');
	var option = require('./connect.js').option;
	var conn = mysql.createConnection(option);
	conn.query('select * from message'??function(err??rows??fields){
	if(!err){
	console.log(rows);
	}
	});
	conn.end(function(err){
	console.log('end a connection');
	});
	??????????????????? SELECT ????????????? end a connection ??????????????????? conn.destroy(); ?????????????κν????????????????????????????????
	????3. ?????
	?????????????????????????????????????????“????”??????????????????????“????”?????????????????????????????????????????????????????????????????????????????????????????????????DOCS???????????????
	var mysql = require('mysql');
	var pool  = mysql.createPool({
	connectionLimit : 10??
	host            : 'example.org'??
	user            : 'bob'??
	password        : 'secret'??
	database        : 'my_db'
	});
	pool.query('SELECT 1 + 1 AS solution'?? function(err?? rows?? fields){
	if (err) throw err;
	console.log('The solution is: '?? rows[0].solution);
	});
	??????????????????? createPool(option) ?? option ???????????? connectionLimit ????????????????????????????????????10?????????????????????????????????淽???????????
	var mysql = require('mysql');
	var pool  = mysql.createPool({
	host     : 'example.org'??
	user     : 'bob'??
	password : 'secret'??
	database : 'my_db'
	});
	pool.getConnection(function(err?? connection){
	// Use the connection
	connection.query( 'SELECT something FROM sometable'?? function(err?? rows){
	// And done with the connection.
	connection.release();
	// Don't use the connection here?? it has been returned to the pool.
	});
	// Use the connection
	connection.query( 'SELECT something2 FROM sometable2'?? function(err?? rows){
	// And done with the connection.
	connection.release();
	// Don't use the connection here?? it has been returned to the pool.
	});
	});
	???????????????????????? query() ??????
	
??????
					
					???·???
App??С????H5?????????????????Щ??
2024/9/11 15:34:34?????????????????????????
2024/9/10 11:13:49P-One ???????????????????????????????????????
2024/9/10 10:14:12???????????????????????????
2024/9/9 18:04:26??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44
					
			
								
								
								
								
								
								
								
								
								
								
				
sales@spasvo.com