mirror of
https://github.com/dg/dibi.git
synced 2025-08-04 21:28:02 +02:00
removed support for PHP 7
This commit is contained in:
@@ -229,24 +229,19 @@ class DataSource implements IDataSource
|
|||||||
*/
|
*/
|
||||||
public function __toString(): string
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
try {
|
return $this->connection->translate(
|
||||||
return $this->connection->translate(
|
"\nSELECT %n",
|
||||||
"\nSELECT %n",
|
(empty($this->cols) ? '*' : $this->cols),
|
||||||
(empty($this->cols) ? '*' : $this->cols),
|
"\nFROM %SQL",
|
||||||
"\nFROM %SQL",
|
$this->sql,
|
||||||
$this->sql,
|
"\n%ex",
|
||||||
"\n%ex",
|
$this->conds ? ['WHERE %and', $this->conds] : null,
|
||||||
$this->conds ? ['WHERE %and', $this->conds] : null,
|
"\n%ex",
|
||||||
"\n%ex",
|
$this->sorting ? ['ORDER BY %by', $this->sorting] : null,
|
||||||
$this->sorting ? ['ORDER BY %by', $this->sorting] : null,
|
"\n%ofs %lmt",
|
||||||
"\n%ofs %lmt",
|
$this->offset,
|
||||||
$this->offset,
|
$this->limit,
|
||||||
$this->limit,
|
);
|
||||||
);
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
trigger_error($e->getMessage(), E_USER_ERROR);
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -125,7 +125,7 @@ class OdbcDriver implements Dibi\Driver
|
|||||||
*/
|
*/
|
||||||
public function begin(?string $savepoint = null): void
|
public function begin(?string $savepoint = null): void
|
||||||
{
|
{
|
||||||
if (!odbc_autocommit($this->connection, PHP_VERSION_ID < 80000 ? 0 : false)) {
|
if (!odbc_autocommit($this->connection, false)) {
|
||||||
throw new Dibi\DriverException(odbc_errormsg($this->connection) . ' ' . odbc_error($this->connection));
|
throw new Dibi\DriverException(odbc_errormsg($this->connection) . ' ' . odbc_error($this->connection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ class OdbcDriver implements Dibi\Driver
|
|||||||
throw new Dibi\DriverException(odbc_errormsg($this->connection) . ' ' . odbc_error($this->connection));
|
throw new Dibi\DriverException(odbc_errormsg($this->connection) . ' ' . odbc_error($this->connection));
|
||||||
}
|
}
|
||||||
|
|
||||||
odbc_autocommit($this->connection, PHP_VERSION_ID < 80000 ? 1 : true);
|
odbc_autocommit($this->connection, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ class OdbcDriver implements Dibi\Driver
|
|||||||
throw new Dibi\DriverException(odbc_errormsg($this->connection) . ' ' . odbc_error($this->connection));
|
throw new Dibi\DriverException(odbc_errormsg($this->connection) . ' ' . odbc_error($this->connection));
|
||||||
}
|
}
|
||||||
|
|
||||||
odbc_autocommit($this->connection, PHP_VERSION_ID < 80000 ? 1 : true);
|
odbc_autocommit($this->connection, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -411,12 +411,7 @@ class Fluent implements IDataSource
|
|||||||
*/
|
*/
|
||||||
final public function __toString(): string
|
final public function __toString(): string
|
||||||
{
|
{
|
||||||
try {
|
return $this->connection->translate($this->_export());
|
||||||
return $this->connection->translate($this->_export());
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
trigger_error($e->getMessage(), E_USER_ERROR);
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -147,9 +147,9 @@ if ($config['system'] === 'mysql') {
|
|||||||
->limit(' 1; DROP TABLE users')
|
->limit(' 1; DROP TABLE users')
|
||||||
->offset(' 1; DROP TABLE users');
|
->offset(' 1; DROP TABLE users');
|
||||||
|
|
||||||
Assert::error(function () use ($fluent) {
|
Assert::exception(function () use ($fluent) {
|
||||||
(string) $fluent;
|
(string) $fluent;
|
||||||
}, E_USER_ERROR, "Expected number, ' 1; DROP TABLE users' given.");
|
}, Dibi\Exception::class, "Expected number, ' 1; DROP TABLE users' given.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user