コミットメタ情報
ログメッセージ
変更サマリ
差分
| | @@ -330,6 +330,7 @@ | 330 | 330 | private $where_not = []; | 331 | 331 | private $where_not_null = []; | 332 | 332 | private $where_in = []; | | 333 | + private $where_not_in = []; | 333 | 334 | private $where_bool = []; | 334 | 335 | private $where_not_true = []; | 335 | 336 | private $group = []; |
| | @@ -442,6 +443,11 @@ | 442 | 443 | return $this->StoreWhere('where_in', $column, $count); | 443 | 444 | } | 444 | 445 | | | 446 | + //WHERE 句登録 (NOT IN) | | 447 | + public function WhereNotIn($column, $count) { | | 448 | + return $this->StoreWhere('where_not_in', $column, $count); | | 449 | + } | | 450 | + | 445 | 451 | //WHERE 句登録 (NOT) | 446 | 452 | public function WhereNot($column) { | 447 | 453 | return $this->StoreWhere('where_not', $column); |
| | @@ -557,11 +563,15 @@ | 557 | 563 | | 558 | 564 | $stack = []; | 559 | 565 | foreach ($this->where as $value) { | 560 | | - $in_count = ArrayFilter::Get($this->where_in, $value); | 561 | | - $bool = ArrayFilter::Get($this->where_bool, $value); | 562 | | - if (false === is_null($in_count) && $in_count > 0) { | 563 | | - $in_list = array_fill(0, $in_count, '?'); | 564 | | - $stack[] = $value . ' IN ' . Text::Quote(ArrayFilter::ToCSV($in_list)); | | 566 | + $count = ArrayFilter::Get($this->where_in, $value); | | 567 | + $not_count = ArrayFilter::Get($this->where_not_in, $value); | | 568 | + $bool = ArrayFilter::Get($this->where_bool, $value); | | 569 | + if (false === is_null($count) && $count > 0) { | | 570 | + $list = array_fill(0, $count, '?'); | | 571 | + $stack[] = $value . ' IN ' . Text::Quote(ArrayFilter::ToCSV($list)); | | 572 | + } elseif (false === is_null($not_count) && $not_count > 0) { | | 573 | + $list = array_fill(0, $not_count, '?'); | | 574 | + $stack[] = $value . ' NOT IN ' . Text::Quote(ArrayFilter::ToCSV($list)); | 565 | 575 | } elseif (false === is_null($bool)) { | 566 | 576 | $stack[] = $value . ' IS ' . ((true === $bool) ? self::ENABLE : self::DISABLE); | 567 | 577 | } elseif (in_array($value, $this->where_not)) { |
| | @@ -158,26 +158,25 @@ | 158 | 158 | public static function DeleteVote() { | 159 | 159 | if (is_null(DB::$ROOM->id)) return true; | 160 | 160 | | 161 | | - $query = 'DELETE FROM vote WHERE room_no = ? AND date = ?'; | | 161 | + $query = Query::Init()->Table('vote')->Delete()->Where(['room_no', 'date']); | 162 | 162 | $list = [DB::$ROOM->id, DB::$ROOM->date]; | 163 | 163 | switch (DB::$ROOM->scene) { | 164 | 164 | case RoomScene::DAY: | 165 | | - $query .= Query::AddWhere(['type', 'revote_count']); | | 165 | + $query->Where(['type', 'revote_count']); | 166 | 166 | array_push($list, VoteAction::VOTE_KILL, DB::$ROOM->revote_count); | 167 | 167 | break; | 168 | 168 | | 169 | 169 | case RoomScene::NIGHT: | 170 | 170 | if (DB::$ROOM->IsDate(1)) { | 171 | | - $query .= ' AND type NOT IN (?, ?)'; | | 171 | + $query->WhereNotIn('type', 2); | 172 | 172 | array_push($list, VoteAction::CUPID, VoteAction::DUELIST); | 173 | 173 | } else { | 174 | | - $query .= ' AND type NOT IN (?)'; | | 174 | + $query->WhereNotIn('type', 1); | 175 | 175 | $list[] = VoteAction::VOTE_KILL; | 176 | 176 | } | 177 | 177 | break; | 178 | 178 | } | 179 | | - | 180 | | - DB::Prepare($query, $list); | | 179 | + DB::Prepare($query->Build(), $list); | 181 | 180 | return DB::Execute() && DB::Optimize('vote'); | 182 | 181 | } | 183 | 182 | |
旧リポジトリブラウザで表示
|