• R/O
  • SSH
  • HTTPS

jinrousiki: Commit


Commit MetaInfo

Revision2309 (tree)
Time2018-12-29 20:50:18
Authorumethyl

Log Message

Query::SetIncrement()

Change Summary

Incremental Difference

--- trunk/include/database/db_class.php (revision 2308)
+++ trunk/include/database/db_class.php (revision 2309)
@@ -423,6 +423,11 @@
423423 return $this->StoreData('set', 'set_data', $column, $data);
424424 }
425425
426+ //SET 句登録 (+1 指定)
427+ public function SetIncrement($column) {
428+ return $this->SetData($column, sprintf('%s + 1', $column));
429+ }
430+
426431 //SET 句登録 (NULL 指定)
427432 public function SetNull($column) {
428433 return $this->SetData($column, 'NULL');
--- trunk/include/database/room_db_class.php (revision 2308)
+++ trunk/include/database/room_db_class.php (revision 2309)
@@ -39,10 +39,10 @@
3939 public static function UpdateVoteCount($revote = false) {
4040 if (DB::$ROOM->IsTest()) return true;
4141
42- $query = self::GetQueryUpdate()->SetData('vote_count', 'vote_count + 1');
42+ $query = self::GetQueryUpdate()->SetIncrement('vote_count');
4343 $query->SetData('overtime_alert', Query::DISABLE);
4444 if (true === $revote) {
45- $query->SetData('revote_count', 'revote_count + 1');
45+ $query->SetIncrement('revote_count');
4646 } else {
4747 $query->SetData('last_update_time', Query::TIME);
4848 }
@@ -153,7 +153,7 @@
153153 if (false === DB::$ROOM->IsDate(1)) { //即処理型は1日目のみ
154154 return true;
155155 }
156- $query = Query::Init()->Table('vote')->Update()->SetData('vote_count', 'vote_count + 1');
156+ $query = Query::Init()->Table('vote')->Update()->SetIncrement('vote_count');
157157 $query->Where(['room_no', 'date'])->WhereIn('type', 2);
158158 $list = [DB::$ROOM->id, DB::$ROOM->date, VoteAction::CUPID, VoteAction::DUELIST];
159159
--- trunk/include/database/talk_db_class.php (revision 2308)
+++ trunk/include/database/talk_db_class.php (revision 2309)
@@ -151,7 +151,7 @@
151151 if (DB::$SELF->talk_count == 0) {
152152 $query->SetData('talk_count', 1);
153153 } else {
154- $query->SetData('talk_count', 'talk_count + 1');
154+ $query->SetIncrement('talk_count');
155155 }
156156
157157 DB::Prepare($query->Build(), [DB::$ROOM->date, DB::$ROOM->id, DB::$SELF->id]);
Show on old repository browser