multi_query warning 나는 문제 해결
This commit is contained in:
@@ -124,7 +124,14 @@ $rootDB->error_handler = 'dbSQLFail';
|
||||
$mysqli_obj = $rootDB->get(); //로그인에 실패할 경우 자동으로 dbConnFail()이 실행됨.
|
||||
|
||||
if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/common_schema.sql'))){
|
||||
while (@$mysqli_obj->next_result()) {;}
|
||||
while(true){
|
||||
if (!$mysqli_obj->more_results()) {
|
||||
break;
|
||||
}
|
||||
if(!$mysqli_obj->next_result()){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rootDB->insert('system', array(
|
||||
|
||||
+7
-13
@@ -207,26 +207,20 @@ function SetNationFront($nationNo) {
|
||||
$adj = [];
|
||||
|
||||
$db = DB::db();
|
||||
$warNations = $db->queryFirstColumn(
|
||||
'SELECT you from diplomacy where me = %i and (state=0 or (state=1 and term<=3))'
|
||||
$enemyCities = $db->queryFirstColumn(
|
||||
'SELECT city from city where nation IN
|
||||
(SELECT you from diplomacy where me = %i and (state=0 or (state=1 and term<=3)))'
|
||||
, $nationNo
|
||||
);
|
||||
if($warNations) {
|
||||
foreach($warNations as $warNation){
|
||||
$enemyCities = $db->queryFirstColumn('SELECT city from city where nation=%i', $warNation);
|
||||
foreach($enemyCities as $city){
|
||||
foreach(CityConst::byID($city)->path as $adjCity){
|
||||
$adj[$adjCity] = 1;
|
||||
}
|
||||
}
|
||||
if($enemyCities) {
|
||||
foreach($enemyCities as $city){
|
||||
$adj = array_merge($adj, CityConst::byID($city)->path);
|
||||
}
|
||||
} else {
|
||||
//평시이면 공백지
|
||||
//NOTE: if, else일 경우 NPC는 전쟁시에는 공백지로 출병하지 않는다는 뜻이 된다.
|
||||
foreach ($db->queryFirstColumn('SELECT city,path from city where nation=0') as $city) {
|
||||
foreach(CityConst::byID($city)->path as $adjCity){
|
||||
$adj[$adjCity] = 1;
|
||||
}
|
||||
$adj = array_merge($adj, CityConst::byID($city)->path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+17
-2
@@ -63,11 +63,26 @@ $scenarioObj = new Scenario($scenario);
|
||||
$startyear = $scenarioObj->getYear();
|
||||
|
||||
if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/reset.sql'))){
|
||||
while (@$mysqli_obj->next_result()) {;}
|
||||
while(true){
|
||||
if (!$mysqli_obj->more_results()) {
|
||||
break;
|
||||
}
|
||||
if(!$mysqli_obj->next_result()){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/schema.sql'))){
|
||||
while (@$mysqli_obj->next_result()) {;}
|
||||
while(true){
|
||||
if (!$mysqli_obj->more_results()) {
|
||||
break;
|
||||
}
|
||||
if(!$mysqli_obj->next_result()){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,14 @@ if($fullReset && class_exists('\\sammo\\DB')){
|
||||
$mysqli_obj = DB::db()->get();
|
||||
|
||||
if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/reset.sql'))){
|
||||
while (@$mysqli_obj->next_result()) {;}
|
||||
while(true){
|
||||
if (!$mysqli_obj->more_results()) {
|
||||
break;
|
||||
}
|
||||
if(!$mysqli_obj->next_result()){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user