From 95c2943c24afefdc621be05c40524aa91a4bd733 Mon Sep 17 00:00:00 2001 From: hodasemi Date: Tue, 3 Oct 2023 08:22:21 +0200 Subject: [PATCH] Fix write into devices DB --- src/db.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/db.rs b/src/db.rs index ca92ace..5d4c1a4 100644 --- a/src/db.rs +++ b/src/db.rs @@ -79,8 +79,8 @@ impl DataBase { for (device, control) in devices.plugs.iter() { self.sql.execute( &format!( - "INSERT INTO devices (device, type) - SELECT \"{device}\", \"plug\" + "INSERT INTO devices (device, type, control) + SELECT \"{device}\", \"plug\", ?1 WHERE NOT EXISTS ( SELECT device @@ -89,7 +89,7 @@ impl DataBase { ) " ), - [], + &[control], )?; let ctl = if *control { 1 } else { 0 };