Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close the cursor of the statement object after the result set has been read #1281

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -35,12 +35,6 @@
*/
class Result
{
/**
* Database result
* @var DoctrineStatement
*/
protected $resResult;

/**
* Query string
* @var string
Expand Down Expand Up @@ -87,18 +81,10 @@ class Result
*/
public function __construct(DoctrineStatement $statement, $strQuery)
{
$this->resResult = $statement;
$this->strQuery = $strQuery;
$this->resultSet = $statement->fetchAll(\PDO::FETCH_ASSOC);
}

/**
* Automatically free the result
*/
public function __destruct()
{
$this->resultSet = null;
$this->resResult->closeCursor();
$statement->closeCursor();
}

/**
Expand Down Expand Up @@ -155,7 +141,7 @@ public function __get($strKey)
break;

case 'numFields':
return $this->resResult->columnCount();
return \count($this->resultSet[0]);
break;

case 'isModified':
Expand Down