Use \PDO::fetchAll() instead of PreparedStatement::fetchColumns()
authorMatthias Schmidt <gravatronics@live.com>
Sun, 8 May 2016 08:59:31 +0000 (10:59 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 8 May 2016 08:59:31 +0000 (10:59 +0200)
files/lib/data/conversation/Conversation.class.php
files/lib/data/conversation/ConversationAction.class.php
files/lib/data/conversation/ConversationParticipantList.class.php
files/lib/data/conversation/FeedConversationList.class.php
files/lib/data/conversation/UserConversationList.class.php
files/lib/data/conversation/label/ConversationLabelAction.class.php
files/lib/form/ConversationMessageAddForm.class.php
files/lib/system/clipboard/action/ConversationClipboardAction.class.php

index 4074cac0012d62eef6a1b74e4e8cebe4599abd4d..fc86df59c60051e5bdfaf4fea53213f932ffd086 100644 (file)
@@ -266,7 +266,7 @@ class Conversation extends DatabaseObject implements IRouteController, ITitledLi
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute($conditions->getParameters());
                
-               return $statement->fetchColumns();
+               return $statement->fetchAll(\PDO::FETCH_COLUMN);
        }
        
        /**
@@ -283,7 +283,7 @@ class Conversation extends DatabaseObject implements IRouteController, ITitledLi
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute([$this->conversationID]);
                
-               return $statement->fetchColumns();
+               return $statement->fetchAll(\PDO::FETCH_COLUMN);
        }
        
        /**
index 15e61bbc3914c619aa19a5f31dcfd370b292417a..866a84b0151919ba635221b8655f6252cd9e4eec 100644 (file)
@@ -243,7 +243,7 @@ class ConversationAction extends AbstractDatabaseObjectAction implements IClipbo
                                ".$conditionBuilder;
                        $statement = WCF::getDB()->prepareStatement($sql);
                        $statement->execute($conditionBuilder->getParameters());
-                       $notificationObjectIDs = $statement->fetchColumns();
+                       $notificationObjectIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
                        
                        if (!empty($notificationObjectIDs)) {
                                UserNotificationHandler::getInstance()->markAsConfirmed('conversation', 'com.woltlab.wcf.conversation.notification', [WCF::getUser()->userID], $notificationObjectIDs);
@@ -263,7 +263,7 @@ class ConversationAction extends AbstractDatabaseObjectAction implements IClipbo
                                ".$conditionBuilder;
                        $statement = WCF::getDB()->prepareStatement($sql);
                        $statement->execute($conditionBuilder->getParameters());
-                       $notificationObjectIDs = $statement->fetchColumns();
+                       $notificationObjectIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
                        
                        if (!empty($notificationObjectIDs)) {
                                UserNotificationHandler::getInstance()->markAsConfirmed('conversationMessage', 'com.woltlab.wcf.conversation.message.notification', [WCF::getUser()->userID], $notificationObjectIDs);
@@ -602,7 +602,7 @@ class ConversationAction extends AbstractDatabaseObjectAction implements IClipbo
                                ".$conditionBuilder;
                        $statement = WCF::getDB()->prepareStatement($sql);
                        $statement->execute($conditionBuilder->getParameters());
-                       $conversationIDs = $statement->fetchColumns();
+                       $conversationIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
                        
                        if (!empty($conversationIDs)) {
                                $action = new ConversationAction($conversationIDs, 'delete');
index ec4b511b74a5b0069432f627e68e9052644fa054..87d2dd8c5043d3185d04ebb842aefce86c10b99a 100644 (file)
@@ -78,7 +78,7 @@ class ConversationParticipantList extends UserProfileList {
                                ".(!empty($this->sqlOrderBy) ? "ORDER BY ".$this->sqlOrderBy : '');
                $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
                $statement->execute($this->getConditionBuilder()->getParameters());
-               $this->objectIDs = $statement->fetchColumns();
+               $this->objectIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
        }
        
        /**
index 20202ee01ee9f0c32bac4e5aeeda4bd0c597456f..afc0c7ad5211a317bd45d6ffbf254c42f33d6bd3 100644 (file)
@@ -34,7 +34,7 @@ class FeedConversationList extends ConversationList {
                                ".(!empty($this->sqlOrderBy) ? "ORDER BY ".$this->sqlOrderBy : '');
                $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
                $statement->execute($this->getConditionBuilder()->getParameters());
-               $this->objectIDs = $statement->fetchColumns();
+               $this->objectIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
        }
        
        /**
index 5121b67b37b88617c22972a2d35c78ae4ea72585..fb8506cdf0cdb8bb34e45c87bef6e3daeb3c86ab 100644 (file)
@@ -125,7 +125,7 @@ class UserConversationList extends ConversationList {
                                ".(!empty($this->sqlOrderBy) ? "ORDER BY ".$this->sqlOrderBy : '');
                $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
                $statement->execute($this->getConditionBuilder()->getParameters());
-               $this->objectIDs = $statement->fetchColumns();
+               $this->objectIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
        }
        
        /**
index 036bd205d902ae6bd9c77d3e85899b4e93fe5063..10859ecb282409bcd22ef1c31ac69f62f610f84b 100644 (file)
@@ -175,7 +175,7 @@ class ConversationLabelAction extends AbstractDatabaseObjectAction {
                                ".$conditions;
                        $statement = WCF::getDB()->prepareStatement($sql);
                        $statement->execute($conditions->getParameters());
-                       $assignedLabels = $statement->fetchColumns();
+                       $assignedLabels = $statement->fetchAll(\PDO::FETCH_COLUMN);
                }
                
                WCF::getTPL()->assign(array(
index 22943c3ad8e6158ec55d7ff9b21e33349f1798de..5f74b9cefea773fd1b891a57282f133458e3b338 100644 (file)
@@ -130,7 +130,7 @@ class ConversationMessageAddForm extends MessageForm {
                                                WHERE   conversationID = ?";
                                        $statement = WCF::getDB()->prepareStatement($sql);
                                        $statement->execute(array($this->conversation->conversationID));
-                                       $messageIDs = $statement->fetchColumns();
+                                       $messageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
                                        
                                        $renderedQuotes = MessageQuoteManager::getInstance()->getQuotesByObjectIDs('com.woltlab.wcf.conversation.message', $messageIDs);
                                        if (!empty($renderedQuotes)) {
index 17ccaf6636b201ad24cdc8f6fa741a84bb9e12d3..435c464edf7d4e85dc5fb5247847d77c6be0b647 100644 (file)
@@ -200,7 +200,7 @@ class ConversationClipboardAction extends AbstractClipboardAction {
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute($conditions->getParameters());
                
-               return $statement->fetchColumns();
+               return $statement->fetchAll(\PDO::FETCH_COLUMN);
        }
        
        /**
@@ -273,6 +273,6 @@ class ConversationClipboardAction extends AbstractClipboardAction {
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute($conditions->getParameters());
                
-               return $statement->fetchColumns();
+               return $statement->fetchAll(\PDO::FETCH_COLUMN);
        }
 }