1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-30 01:09:50 +02:00

Compare commits

...

7 Commits

Author SHA1 Message Date
David Grudl
cb0cf4ba2f Released version 4.2.8 2023-08-09 16:15:07 +02:00
David Grudl
8e7df8374b drivers: removed auto-free feature 2023-08-09 16:15:07 +02:00
Marek Bartoš
848ac76fed Fluent: improved phpDoc 2023-08-09 16:15:07 +02:00
David Grudl
a0f2ca2fca typo 2023-08-09 16:15:04 +02:00
David Grudl
cf14987b42 cs 2023-08-05 19:56:38 +02:00
David Grudl
01c7ab63e3 tested in PHP 8.3 2023-08-05 19:50:57 +02:00
David Grudl
520119740d updated .gitattributes 2022-12-21 02:06:10 +01:00
14 changed files with 13 additions and 117 deletions

4
.gitattributes vendored
View File

@@ -1,8 +1,8 @@
.gitattributes export-ignore
.gitignore export-ignore
.github export-ignore
.travis.yml export-ignore
ecs.php export-ignore
appveyor.yml export-ignore
ncs.* export-ignore
phpstan.neon export-ignore
tests/ export-ignore

View File

@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
fail-fast: false

View File

@@ -34,7 +34,7 @@ Install Dibi via Composer:
composer require dibi/dibi
```
The Dibi 4.2 requires PHP version 7.2 and supports PHP up to 8.2.
The Dibi 4.2 requires PHP version 7.2 and supports PHP up to 8.3.
Usage
@@ -341,7 +341,7 @@ $database->query('INSERT INTO users', [
There are three methods for dealing with transactions:
```php
$database->beginTransaction();
$database->begin();
$database->commit();

View File

@@ -23,9 +23,6 @@ class FirebirdResult implements Dibi\ResultDriver
/** @var resource */
private $resultSet;
/** @var bool */
private $autoFree = true;
/**
* @param resource $resultSet
@@ -36,17 +33,6 @@ class FirebirdResult implements Dibi\ResultDriver
}
/**
* 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.
*/
@@ -105,7 +91,6 @@ class FirebirdResult implements Dibi\ResultDriver
*/
public function getResultResource()
{
$this->autoFree = false;
return is_resource($this->resultSet) ? $this->resultSet : null;
}

View File

@@ -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;
@@ -36,17 +33,6 @@ class MySqliResult implements Dibi\ResultDriver
}
/**
* 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.
*/
@@ -136,7 +122,6 @@ class MySqliResult implements Dibi\ResultDriver
*/
public function getResultResource(): \mysqli_result
{
$this->autoFree = false;
return $this->resultSet;
}

View File

@@ -22,9 +22,6 @@ class OdbcResult implements Dibi\ResultDriver
/** @var resource */
private $resultSet;
/** @var bool */
private $autoFree = true;
/** @var int Cursor */
private $row = 0;
@@ -38,17 +35,6 @@ class OdbcResult implements Dibi\ResultDriver
}
/**
* 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.
*/
@@ -129,7 +115,6 @@ class OdbcResult implements Dibi\ResultDriver
*/
public function getResultResource()
{
$this->autoFree = false;
return is_resource($this->resultSet) ? $this->resultSet : null;
}

View File

@@ -22,9 +22,6 @@ class OracleResult implements Dibi\ResultDriver
/** @var resource */
private $resultSet;
/** @var bool */
private $autoFree = true;
/**
* @param resource $resultSet
@@ -35,17 +32,6 @@ class OracleResult implements Dibi\ResultDriver
}
/**
* 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.
*/
@@ -111,7 +97,6 @@ class OracleResult implements Dibi\ResultDriver
*/
public function getResultResource()
{
$this->autoFree = false;
return is_resource($this->resultSet) ? $this->resultSet : null;
}

View File

@@ -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
@@ -37,17 +34,6 @@ class PostgreResult implements Dibi\ResultDriver
}
/**
* 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.
*/
@@ -114,7 +100,6 @@ class PostgreResult implements Dibi\ResultDriver
*/
public function getResultResource()
{
$this->autoFree = false;
return is_resource($this->resultSet) || $this->resultSet instanceof PgSql\Result
? $this->resultSet
: null;

View File

@@ -23,9 +23,6 @@ class SqliteResult implements Dibi\ResultDriver
/** @var \SQLite3Result */
private $resultSet;
/** @var bool */
private $autoFree = true;
public function __construct(\SQLite3Result $resultSet)
{
@@ -33,17 +30,6 @@ class SqliteResult implements Dibi\ResultDriver
}
/**
* 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
@@ -109,7 +95,6 @@ class SqliteResult implements Dibi\ResultDriver
*/
public function getResultResource(): \SQLite3Result
{
$this->autoFree = false;
return $this->resultSet;
}

View File

@@ -22,9 +22,6 @@ class SqlsrvResult implements Dibi\ResultDriver
/** @var resource */
private $resultSet;
/** @var bool */
private $autoFree = true;
/**
* @param resource $resultSet
@@ -35,17 +32,6 @@ class SqlsrvResult implements Dibi\ResultDriver
}
/**
* 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.
*/
@@ -107,7 +93,6 @@ class SqlsrvResult implements Dibi\ResultDriver
*/
public function getResultResource()
{
$this->autoFree = false;
return is_resource($this->resultSet) ? $this->resultSet : null;
}

View File

@@ -27,6 +27,8 @@ namespace Dibi;
* @method Fluent innerJoin(...$table)
* @method Fluent rightJoin(...$table)
* @method Fluent outerJoin(...$table)
* @method Fluent union(Fluent $fluent)
* @method Fluent unionAll(Fluent $fluent)
* @method Fluent as(...$field)
* @method Fluent on(...$cond)
* @method Fluent and(...$cond)

View File

@@ -44,22 +44,22 @@ class ResultIterator implements \Iterator, \Countable
}
#[\ReturnTypeWillChange]
/**
* Returns the key of the current element.
* @return mixed
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->pointer;
}
#[\ReturnTypeWillChange]
/**
* Returns the current element.
* @return mixed
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->row;

View File

@@ -44,7 +44,7 @@ class dibi
IDENTIFIER = 'n';
/** version */
public const VERSION = '4.2.6';
public const VERSION = '4.2.8';
/** sorting order */
public const

View File

@@ -82,10 +82,9 @@ $tests = function ($conn) {
$conn->translate('SELECT 1 %lmt', -10)
);
Assert::exception(
$conn->translate('SELECT 1 %ofs %lmt', 10, 10),
Dibi\NotSupportedException::class
);
Assert::exception(function () {
$conn->translate('SELECT 1 %ofs %lmt', 10, 10);
}, Dibi\NotSupportedException::class);
}
};