newRootDB(), newDB가 이전의 코드 수정으로 new를 수행하는 경우가 줄어들었으므로 getRootDB(), newDB() 로 이름 변경

This commit is contained in:
2018-01-28 21:44:08 +09:00
parent 373bcde70b
commit dc56de8afd
8 changed files with 15 additions and 14 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ require(__dir__.'/../vendor/autoload.php');
*
* @return MeekroDB
*/
function newRootDB(){
function getRootDB(){
$host = '_host_';
$user = '_user_';
$password = '_password_';
+1
View File
@@ -43,6 +43,7 @@ switch($btn) {
$gen = MYDB_fetch_array($result);
$uid[$i] = $gen['user_id'];
}
$connect = dbConn("sammo");
$date = date('Y-m-d H:i:s');
for($i=0; $i < sizeof($uid); $i++) {
+1 -1
View File
@@ -6,7 +6,7 @@ require_once(__dir__.'/../../d_setting/conf.php');
*
* @return MeekroDB
*/
function newDB(){
function getDB(){
$host = '_host_';
$user = '_user_';
$password = '_password_';
+5 -5
View File
@@ -1797,7 +1797,7 @@ function adminMsg($connect, $skin=1) {
}
function getOnlineNum() {
return newDB()->queryFirstField('select `online` from `game` where `no`=1');
return getDB()->queryFirstField('select `online` from `game` where `no`=1');
}
function onlinegen($connect) {
@@ -2133,7 +2133,7 @@ function CutDay($date) {
function increateRefreshEx($type, $cnt=1){
$db = newDB();
$db = getDB();
$db->query("update `game` set `refresh` = `refresh` + %d_p_id where `no` = %d_cnt", array(
'p_id'=>$p_id,
@@ -2317,12 +2317,12 @@ function CheckOverhead($connect) {
}
function isLock() {
return newDB()->queryFirstField("select plock from plock where no=1") != 0;
return getDB()->queryFirstField("select plock from plock where no=1") != 0;
}
function tryLock() {
//NOTE: 게임 로직과 관련한 모든 insert, update 함수들은 lock을 거칠것을 권장함.
$db = newDB();
$db = getDB();
//테이블 락
$db->query("lock tables plock write");
// 잠금
@@ -2340,7 +2340,7 @@ function tryLock() {
function unlock() {
// 풀림
//NOTE: unlock에는 table lock이 필요없는가?
newDB()->query("update plock set plock=0 where no=1");
getDB()->query("update plock set plock=0 where no=1");
}
function timeover($connect) {
+2 -2
View File
@@ -8,7 +8,7 @@
function getScenario() {
//FIXME: 정말로 side effect가 없으려면 query는 밖으로 이동해야함.
$scenario = newDB()->queryFirstColumn('select `scenario` from `game` where no=1');
$scenario = getDB()->queryFirstColumn('select `scenario` from `game` where no=1');
switch($scenario) {
case 0: $str = '공백지모드'; break;
@@ -629,7 +629,7 @@ function getBill($dedication) {
function getCost($armtype) {
//FIXME: 정말로 side effect가 없으려면 query는 밖으로 이동해야함.
//TODO: 병종 값이 column으로 들어있는건 전혀 옳지 않음. key->value 형태로 바꿔야함
return newDB()->queryFirstColumn('select cst%l from game where no=1', intval($armtype));
return getDB()->queryFirstColumn('select cst%l from game where no=1', intval($armtype));
}
function TechLimit($startyear, $year, $tech) {
+2 -2
View File
@@ -75,7 +75,7 @@ function getRawMessage($mailbox, $limit=30, $fromTime=NULL){
}
//TODO: table 네임의 prefix를 처리할 수 있도록 개선
$result = newDB()->query($sql, [
$result = getDB()->query($sql, [
'mailbox' => $mailbox,
'limit' => $limit,
'time' => $fromTime
@@ -100,7 +100,7 @@ function getMessage($msgType, $limit=30, $fromTime=NULL){
return getRawMessage($genID, $limit, $fromTime);
}
else if($msgType === 'national'){
$nationID = newDB()->queryFirstField(
$nationID = getDB()->queryFirstField(
'select `nation` from `general` where user_id = %i',
$genID
);
+2 -2
View File
@@ -66,7 +66,7 @@ function CoreTurnTable() {
function allButton() {
global $_basecolor2;
$npcmode = newDB()->queryFirstField("select npcmode from game where no='1'");
$npcmode = getDB()->queryFirstField("select npcmode from game where no='1'");
if($npcmode == 1) {
$site = "a_npcList.php";
$call = "빙의일람";
@@ -109,7 +109,7 @@ function commandButton() {
if($generalID === NULL){
return '';
}
$db = newDB();
$db = getDB();
$me = $db->queryFirstRow("select skin,no,nation,level,belong from general where user_id=%i", $generalID);
+1 -1
View File
@@ -34,7 +34,7 @@ if(!CheckLoginEx($db)){
}
$db = newDB();
$db = getDB();
$connect = dbConn();
increaseRefresh($connect, '서신전달', 1);