From ac94ddc345a177861d7e569560fff2fe32f33de8 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 16 Jul 2024 17:44:02 +0400 Subject: [PATCH] modifs.mineures sans commentaires --- src/db/Capacitor.php | 4 ++-- src/db/CapacitorChannel.php | 4 ++-- src/db/CapacitorStorage.php | 12 ++++++------ src/db/sqlite/Sqlite.php | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/db/Capacitor.php b/src/db/Capacitor.php index 61ab4b4..274f1ae 100644 --- a/src/db/Capacitor.php +++ b/src/db/Capacitor.php @@ -157,9 +157,9 @@ class Capacitor implements ITransactor { return $this->storage->_all($this->channel, $filter, $mergeQuery); } - function each($filter, $func=null, ?array $args=null, ?array $mergeQuery=null, ?int &$updated=null): int { + function each($filter, $func=null, ?array $args=null, ?array $mergeQuery=null, ?int &$nbUpdated=null): int { if ($this->subChannels !== null) $this->beginTransaction(); - return $this->storage->_each($this->channel, $filter, $func, $args, $mergeQuery, $updated); + return $this->storage->_each($this->channel, $filter, $func, $args, $mergeQuery, $nbUpdated); } function delete($filter, $func=null, ?array $args=null): int { diff --git a/src/db/CapacitorChannel.php b/src/db/CapacitorChannel.php index fe6e4ce..99676f4 100644 --- a/src/db/CapacitorChannel.php +++ b/src/db/CapacitorChannel.php @@ -397,8 +397,8 @@ class CapacitorChannel { return $this->capacitor->all($filter, $mergeQuery); } - function each($filter, $func=null, ?array $args=null, ?array $mergeQuery=null, ?int &$updated=null): int { - return $this->capacitor->each($filter, $func, $args, $mergeQuery, $updated); + function each($filter, $func=null, ?array $args=null, ?array $mergeQuery=null, ?int &$nbUpdated=null): int { + return $this->capacitor->each($filter, $func, $args, $mergeQuery, $nbUpdated); } function delete($filter, $func=null, ?array $args=null): int { diff --git a/src/db/CapacitorStorage.php b/src/db/CapacitorStorage.php index 576765f..46cde2e 100644 --- a/src/db/CapacitorStorage.php +++ b/src/db/CapacitorStorage.php @@ -496,10 +496,10 @@ EOT; * si la fonction retourne un tableau, il est utilisé pour mettre à jour la * ligne * - * @param int $updated reçoit le nombre de lignes mises à jour + * @param int $nbUpdated reçoit le nombre de lignes mises à jour * @return int le nombre de lignes parcourues */ - function _each(CapacitorChannel $channel, $filter, $func, ?array $args, ?array $mergeQuery=null, ?int &$updated=null): int { + function _each(CapacitorChannel $channel, $filter, $func, ?array $args, ?array $mergeQuery=null, ?int &$nbUpdated=null): int { $this->_create($channel); if ($func === null) $func = CapacitorChannel::onEach; func::ensure_func($func, $channel, $args); @@ -513,7 +513,7 @@ EOT; $commitThreshold = $channel->getEachCommitThreshold(); } $count = 0; - $updated = 0; + $nbUpdated = 0; $tableName = $channel->getTableName(); try { $args ??= []; @@ -525,7 +525,7 @@ EOT; if (!array_key_exists("modified_", $updates)) { $updates["modified_"] = date("Y-m-d H:i:s"); } - $updated += $db->exec([ + $nbUpdated += $db->exec([ "update", "table" => $tableName, "values" => $this->serialize($channel, $updates), @@ -552,8 +552,8 @@ EOT; } } - function each(?string $channel, $filter, $func=null, ?array $args=null, ?array $mergeQuery=null, ?int &$updated=null): int { - return $this->_each($this->getChannel($channel), $filter, $func, $args, $mergeQuery, $updated); + function each(?string $channel, $filter, $func=null, ?array $args=null, ?array $mergeQuery=null, ?int &$nbUpdated=null): int { + return $this->_each($this->getChannel($channel), $filter, $func, $args, $mergeQuery, $nbUpdated); } /** diff --git a/src/db/sqlite/Sqlite.php b/src/db/sqlite/Sqlite.php index ede6c95..4692014 100644 --- a/src/db/sqlite/Sqlite.php +++ b/src/db/sqlite/Sqlite.php @@ -86,7 +86,7 @@ class Sqlite implements IDatabase { ##schéma $defaultFile = self::params_SCHEMA["file"][1]; $this->file = $file = strval($params["file"] ?? $defaultFile); - $inMemory = $file === ":memory:"; + $inMemory = $file === ":memory:" || $file === ""; # $defaultFlags = self::params_SCHEMA["flags"][1]; $this->flags = intval($params["flags"] ?? $defaultFlags);