for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Foolz\SphinxQL\Drivers\Pdo;
use Foolz\SphinxQL\Drivers\ResultSetAdapterInterface;
use PDO;
use PDOStatement;
class ResultSetAdapter implements ResultSetAdapterInterface
{
/**
* @var PDOStatement
*/
protected $statement;
* @var bool
protected $valid = true;
* @param PDOStatement $statement
public function __construct(PDOStatement $statement)
$this->statement = $statement;
}
* @inheritdoc
public function getAffectedRows()
return $this->statement->rowCount();
public function getNumRows()
public function getFields()
$fields = array();
for ($i = 0; $i < $this->statement->columnCount(); $i++) {
$fields[] = (object)$this->statement->getColumnMeta($i);
return $fields;
public function isDml()
return $this->statement->columnCount() == 0;
public function store()
return $this->statement->fetchAll(PDO::FETCH_NUM);
public function toRow($num)
throw new \BadMethodCallException('Not implemented');
public function freeResult()
$this->statement->closeCursor();
public function rewind()
public function valid()
return $this->valid;
public function fetch($assoc = true)
if ($assoc) {
$row = $this->statement->fetch(PDO::FETCH_ASSOC);
} else {
$row = $this->statement->fetch(PDO::FETCH_NUM);
if (!$row) {
$this->valid = false;
$row = null;
return $row;
public function fetchAll($assoc = true)
$row = $this->statement->fetchAll(PDO::FETCH_ASSOC);
$row = $this->statement->fetchAll(PDO::FETCH_NUM);
if (empty($row)) {