Commit f6b334ea authored by Aigars Gedroics's avatar Aigars Gedroics

PDO results with fetch style PDO::FETCH_COLUMN made available for caching

parent 394f7e9a
...@@ -68,6 +68,10 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement ...@@ -68,6 +68,10 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
return array_values($row); return array_values($row);
} else if ($fetchStyle === PDO::FETCH_BOTH) { } else if ($fetchStyle === PDO::FETCH_BOTH) {
return array_merge($row, array_values($row)); return array_merge($row, array_values($row));
} else if ($fetchStyle === PDO::FETCH_COLUMN) {
return reset($row);
} else {
throw new \InvalidArgumentException("Invalid fetch-style given for fetching result.");
} }
} }
return false; return false;
...@@ -91,4 +95,4 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement ...@@ -91,4 +95,4 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
} }
return $row[$columnIndex]; return $row[$columnIndex];
} }
} }
\ No newline at end of file
...@@ -169,6 +169,8 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement ...@@ -169,6 +169,8 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
return array_values($row); return array_values($row);
} else if ($fetchStyle == PDO::FETCH_BOTH) { } else if ($fetchStyle == PDO::FETCH_BOTH) {
return array_merge($row, array_values($row)); return array_merge($row, array_values($row));
} else if ($fetchStyle == PDO::FETCH_COLUMN) {
return reset($row);
} else { } else {
throw new \InvalidArgumentException("Invalid fetch-style given for caching result."); throw new \InvalidArgumentException("Invalid fetch-style given for caching result.");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment