findDuplicates() public static method

Finds duplicate columns in select statement
public static findDuplicates ( PDOStatement $statement ) : string
$statement PDOStatement
return string
Beispiel #1
0
 /**
  * @inheritDoc
  */
 public function fetch()
 {
     $data = $this->pdoStatement ? $this->pdoStatement->fetch() : NULL;
     if (!$data) {
         $this->pdoStatement->closeCursor();
         return FALSE;
     } elseif ($this->result === NULL && count($data) !== $this->pdoStatement->columnCount()) {
         $duplicates = Helpers::findDuplicates($this->pdoStatement);
         trigger_error("Found duplicate columns in database result set: {$duplicates}.", E_USER_NOTICE);
     }
     $row = new Row();
     foreach ($this->normalizeRow($data) as $key => $value) {
         if ($key !== '') {
             $row->{$key} = $value;
         }
     }
     $this->resultKey++;
     return $this->result = $row;
 }