OSDN Git Service

初期化時に必須メンバーの存在をチェックするようにした
authorkonekoneko <jbh03215@hotmail.co.jp>
Sun, 5 May 2013 05:37:35 +0000 (14:37 +0900)
committerkonekoneko <jbh03215@hotmail.co.jp>
Sun, 5 May 2013 05:37:35 +0000 (14:37 +0900)
init.js

diff --git a/init.js b/init.js
index 9d9b50b..a94e78b 100644 (file)
--- a/init.js
+++ b/init.js
@@ -11,6 +11,38 @@ var pool = new MySQLPool({
                        database : "webchat",
                });
 
+if("name_hash" in config.alias)
+{
+       if(config.alias["name_hash"].type != "unsignednumber")
+               throw "name_hash???unsignednumber??????????";
+}else{
+       throw "name_hash?????????";
+}
+
+if("name" in config.alias)
+{
+       if(config.alias["name"].type != "text")
+               throw "name???text??????????";
+}else{
+       throw "name?????????";
+}
+
+if("password" in config.alias)
+{
+       if(config.alias["password"].type != "password")
+               throw "name???password??????????";
+}else{
+       throw "password?????????";
+}
+
+if("lastmodified" in config.alias)
+{
+       if(config.alias["lastmodified"].type != "datetime")
+               throw "lastmodified???text??????????";
+}else{
+       throw "lastmodified?????????";
+}
+
 async.waterfall([
        function(next){
                var query = GetDropTableQuery("list"); 
@@ -65,7 +97,8 @@ async.waterfall([
                pool.query(query,null,next);
        },
 ],function(err){
-       console.log(err);
+       if(err != null)
+               console.log(err);
        process.exit();
 });