From 3754ed745454fa0e3be5dcaf5b091cc3163f68a6 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 6 May 2025 17:01:54 +0400 Subject: [PATCH] modifs.mineures sans commentaires --- .idea/php.xml | 9 ++++++++- nur_bin/sqlite-storage.php | 28 ++++++++-------------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.idea/php.xml b/.idea/php.xml index d678acf..3c96682 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -60,9 +60,16 @@ - + + + + + + + + diff --git a/nur_bin/sqlite-storage.php b/nur_bin/sqlite-storage.php index d81b72f..a636ce3 100755 --- a/nur_bin/sqlite-storage.php +++ b/nur_bin/sqlite-storage.php @@ -63,21 +63,14 @@ Application::run(new class extends Application { $storage = new SqliteStorage($dbfile); $db = $storage->db(); - $haveChannels = $storage->tableExists("_channels"); - $name = $this->name; $channelClass = $this->channelClass; $tableName = $this->tableName; if ($name !== null) { - $row = null; - if ($haveChannels) { - $row = $db->one([ - "select from _channels", - "where" => ["name" => $name], - ]); + if (!$storage->channelExists($name, $row)) { + self::die("$name: nom de canal de données introuvable"); } - if ($row === null) self::die("$name: nom de canal de données introuvable"); - if ($row["class"] !== "class@anonymous") $channelClass = $row["class"]; + if ($row["class_name"] !== "class@anonymous") $channelClass = $row["class_name"]; else $tableName = $row["table_name"]; } if ($channelClass !== null) { @@ -92,17 +85,12 @@ Application::run(new class extends Application { }; } else { $found = false; - if ($haveChannels) { - $rows = $db->all([ - "select from _channels", - ]); - foreach ($rows as $row) { - msg::print($row["name"]); - $found = true; - } + foreach ($storage->getChannels() as $row) { + msg::print($row["name"]); + $found = true; } - if (!$found) self::die("Vous devez spécifier le canal de données"); - else self::exit(); + if ($found) self::exit(); + self::die("Vous devez spécifier le canal de données"); } $capacitor = new Capacitor($storage, $channel);