{
var _this = this;
var config = require("./configure.js");
- var MySQLPool = new require("./mysql_pool.js");
- var pool = new MySQLPool({
- host : config.db_host,
- user : config.db_user,
- password : config.db_password,
- port : config.db_port,
- database : config.db_name,
- });
+ var RoomInfomationModel = require("./init").GetRoomInfomation;
var collection = {};
this.Get = function(rno){
return collection[rno];
var async = require("async");
async.waterfall([
function(next){
- pool.query("TRUNCATE TABLE rooms",null,next);
+ RoomInfomationModel.drop().done(next);
},
function(result,next){
var util = require("util");
Add(rno,password,romonly);
items.push(new Array(rno,password,romonly));
}
- pool.query("INSERT INTO rooms VALUES ?",[items],callfunc);
+ newRoom = RoomInfomationModel.build(items);
+ newRoom.save().done(next);
}
],callfunc);
}
var async = require("async");
async.waterfall([
function(next){
- pool.query("SELECT * FROM rooms",null,next);
+ RoomInfomationModel.findAll().done(next);
},
function(result,next){
for(var i = 0; i < result.length; i++)
{
- //MySQL\82Å\82ÍTINYINT\82ª\8eg\82í\82ê\82Ä\82¢\82é
- Add(result[i].number,result[i].password,result[i].hiddenlog != 0);
+ Add(result[i].number,result[i].password,result[i].hiddenlog);
}
next(null,null);
}