Skip to content

Commit

Permalink
drivers: removed auto-free feature
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Aug 9, 2023
1 parent 9e2a936 commit 66f8697
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 105 deletions.
15 changes: 0 additions & 15 deletions src/Dibi/Drivers/FirebirdResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ class FirebirdResult implements Dibi\ResultDriver
/** @var resource */
private $resultSet;

/** @var bool */
private $autoFree = true;


/**
* @param resource $resultSet
Expand All @@ -36,17 +33,6 @@ public function __construct($resultSet)
}


/**
* Automatically frees the resources allocated for this result set.
*/
public function __destruct()
{
if ($this->autoFree && $this->getResultResource()) {
$this->free();
}
}


/**
* Returns the number of rows in a result set.
*/
Expand Down Expand Up @@ -105,7 +91,6 @@ public function free(): void
*/
public function getResultResource()
{
$this->autoFree = false;
return is_resource($this->resultSet) ? $this->resultSet : null;
}

Expand Down
15 changes: 0 additions & 15 deletions src/Dibi/Drivers/MySqliResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ class MySqliResult implements Dibi\ResultDriver
/** @var \mysqli_result */
private $resultSet;

/** @var bool */
private $autoFree = true;

/** @var bool Is buffered (seekable and countable)? */
private $buffered;

Expand All @@ -36,17 +33,6 @@ public function __construct(\mysqli_result $resultSet, bool $buffered)
}


/**
* Automatically frees the resources allocated for this result set.
*/
public function __destruct()
{
if ($this->autoFree && $this->getResultResource()) {
@$this->free();
}
}


/**
* Returns the number of rows in a result set.
*/
Expand Down Expand Up @@ -136,7 +122,6 @@ public function getResultColumns(): array
*/
public function getResultResource(): \mysqli_result
{
$this->autoFree = false;
return $this->resultSet;
}

Expand Down
15 changes: 0 additions & 15 deletions src/Dibi/Drivers/OdbcResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ class OdbcResult implements Dibi\ResultDriver
/** @var resource */
private $resultSet;

/** @var bool */
private $autoFree = true;

/** @var int Cursor */
private $row = 0;

Expand All @@ -38,17 +35,6 @@ public function __construct($resultSet)
}


/**
* Automatically frees the resources allocated for this result set.
*/
public function __destruct()
{
if ($this->autoFree && $this->getResultResource()) {
$this->free();
}
}


/**
* Returns the number of rows in a result set.
*/
Expand Down Expand Up @@ -129,7 +115,6 @@ public function getResultColumns(): array
*/
public function getResultResource()
{
$this->autoFree = false;
return is_resource($this->resultSet) ? $this->resultSet : null;
}

Expand Down
15 changes: 0 additions & 15 deletions src/Dibi/Drivers/OracleResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ class OracleResult implements Dibi\ResultDriver
/** @var resource */
private $resultSet;

/** @var bool */
private $autoFree = true;


/**
* @param resource $resultSet
Expand All @@ -35,17 +32,6 @@ public function __construct($resultSet)
}


/**
* Automatically frees the resources allocated for this result set.
*/
public function __destruct()
{
if ($this->autoFree && $this->getResultResource()) {
$this->free();
}
}


/**
* Returns the number of rows in a result set.
*/
Expand Down Expand Up @@ -111,7 +97,6 @@ public function getResultColumns(): array
*/
public function getResultResource()
{
$this->autoFree = false;
return is_resource($this->resultSet) ? $this->resultSet : null;
}

Expand Down
15 changes: 0 additions & 15 deletions src/Dibi/Drivers/PostgreResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ class PostgreResult implements Dibi\ResultDriver
/** @var resource|PgSql\Result */
private $resultSet;

/** @var bool */
private $autoFree = true;


/**
* @param resource|PgSql\Result $resultSet
Expand All @@ -37,17 +34,6 @@ public function __construct($resultSet)
}


/**
* Automatically frees the resources allocated for this result set.
*/
public function __destruct()
{
if ($this->autoFree && $this->getResultResource()) {
$this->free();
}
}


/**
* Returns the number of rows in a result set.
*/
Expand Down Expand Up @@ -114,7 +100,6 @@ public function getResultColumns(): array
*/
public function getResultResource()
{
$this->autoFree = false;
return is_resource($this->resultSet) || $this->resultSet instanceof PgSql\Result
? $this->resultSet
: null;
Expand Down
15 changes: 0 additions & 15 deletions src/Dibi/Drivers/SqliteResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,13 @@ class SqliteResult implements Dibi\ResultDriver
/** @var \SQLite3Result */
private $resultSet;

/** @var bool */
private $autoFree = true;


public function __construct(\SQLite3Result $resultSet)
{
$this->resultSet = $resultSet;
}


/**
* Automatically frees the resources allocated for this result set.
*/
public function __destruct()
{
if ($this->autoFree && $this->getResultResource()) {
@$this->free();
}
}


/**
* Returns the number of rows in a result set.
* @throws Dibi\NotSupportedException
Expand Down Expand Up @@ -109,7 +95,6 @@ public function getResultColumns(): array
*/
public function getResultResource(): \SQLite3Result
{
$this->autoFree = false;
return $this->resultSet;
}

Expand Down
15 changes: 0 additions & 15 deletions src/Dibi/Drivers/SqlsrvResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ class SqlsrvResult implements Dibi\ResultDriver
/** @var resource */
private $resultSet;

/** @var bool */
private $autoFree = true;


/**
* @param resource $resultSet
Expand All @@ -35,17 +32,6 @@ public function __construct($resultSet)
}


/**
* Automatically frees the resources allocated for this result set.
*/
public function __destruct()
{
if ($this->autoFree && $this->getResultResource()) {
$this->free();
}
}


/**
* Returns the number of rows in a result set.
*/
Expand Down Expand Up @@ -107,7 +93,6 @@ public function getResultColumns(): array
*/
public function getResultResource()
{
$this->autoFree = false;
return is_resource($this->resultSet) ? $this->resultSet : null;
}

Expand Down

0 comments on commit 66f8697

Please sign in to comment.