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);