Upgrade to 3.6.5

This commit is contained in:
Bastian Allgeier
2022-04-19 14:59:34 +02:00
parent fee3f5253d
commit 5c64df9e2b
30 changed files with 266 additions and 279 deletions

View File

@@ -775,7 +775,11 @@ class Query
// apply it to the dataset and retrieve all rows. make sure to use Collection as the iterator to be able to attach the pagination object
$iterator = $this->iterator;
$collection = $this->offset($pagination->offset())->limit($pagination->limit())->iterator('Collection')->all();
$collection = $this
->offset($pagination->offset())
->limit($pagination->limit())
->iterator('Kirby\Toolkit\Collection')
->all();
$this->iterator($iterator);
@@ -968,6 +972,11 @@ class Query
$this->bindings($sql['bindings']);
} elseif (is_callable($args[0]) === true) {
$query = clone $this;
// since the callback uses its own where condition
// it is necessary to clear/reset the cloned where condition
$query->where = null;
call_user_func($args[0], $query);
// copy over the bindings from the nested query

View File

@@ -853,8 +853,14 @@ abstract class Sql
$query = [];
$bindings = [];
foreach ($values as $key => $value) {
$fields[] = $this->columnName($table, $key, $enforceQualified);
foreach ($values as $column => $value) {
$key = $this->columnName($table, $column, $enforceQualified);
if ($key === null) {
continue;
}
$fields[] = $key;
if (in_array($value, static::$literals, true) === true) {
$query[] = $value ?: 'null';
@@ -896,6 +902,10 @@ abstract class Sql
foreach ($values as $column => $value) {
$key = $this->columnName($table, $column, $enforceQualified);
if ($key === null) {
continue;
}
if (in_array($value, static::$literals, true) === true) {
$query[] = $key . ' = ' . ($value ?: 'null');
continue;

View File

@@ -137,7 +137,7 @@ class Sqlite extends Sql
public function tables(): array
{
return [
'query' => 'SELECT name FROM sqlite_master WHERE type = "table"',
'query' => 'SELECT name FROM sqlite_master WHERE type = "table" OR type = "view"',
'bindings' => []
];
}