From 43c53b286ab9334b72bb51fa3f1b5a5a0a6ccc3b Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Thu, 15 May 2025 11:52:33 +0400 Subject: [PATCH] modifs.mineures sans commentaires --- php/src/A.php | 5 +++-- php/src/db/Capacitor.php | 8 ++++++++ php/src/db/CapacitorChannel.php | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/php/src/A.php b/php/src/A.php index a3973ca..75f0284 100644 --- a/php/src/A.php +++ b/php/src/A.php @@ -177,11 +177,12 @@ class A { return $pvalue; } - static final function shift(?array &$dest, int $count=1) { + static final function shift(?array &$dest, int $count=1, $default=null) { if ($dest === null) return null; $values = array_slice($dest, 0, $count); $dest = array_slice($dest, $count); - return $count == 1? $values[0]: $values; + if ($values === []) return $default; + else return $count == 1? $values[0]: $values; } static final function pop(&$dest, $key, $default=null) { diff --git a/php/src/db/Capacitor.php b/php/src/db/Capacitor.php index 0fee8b5..5551f1b 100644 --- a/php/src/db/Capacitor.php +++ b/php/src/db/Capacitor.php @@ -1,6 +1,7 @@ storage->_delete($this->channel, $filter, $func, $args); } + function dbUpdate(array $update) { + return $this->storage->db()->exec(cl::merge([ + "update", + "table" => $this->getTableName(), + ], $update)); + } + function close(): void { $this->storage->close(); } diff --git a/php/src/db/CapacitorChannel.php b/php/src/db/CapacitorChannel.php index c7265bb..df96e2a 100644 --- a/php/src/db/CapacitorChannel.php +++ b/php/src/db/CapacitorChannel.php @@ -482,6 +482,10 @@ class CapacitorChannel implements ITransactor { return $this->capacitor->delete($filter, $func, $args); } + function dbUpdate(array $update) { + return $this->capacitor->dbUpdate($update); + } + function close(): void { $this->capacitor->close(); }