Compare commits
3 commits
d79d27fc9f
...
c107b67a7e
Author | SHA1 | Date | |
---|---|---|---|
c107b67a7e | |||
411d06f08a | |||
95c2943c24 |
2 changed files with 4 additions and 4 deletions
|
@ -8,7 +8,7 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rusqlite = "0.29.0"
|
rusqlite = "0.29.0"
|
||||||
anyhow = { version = "1.0.75", features = ["backtrace"] }
|
anyhow = { version = "1.0.75", features = ["backtrace"] }
|
||||||
reqwest = "0.11.21"
|
reqwest = "0.11.22"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
futures = "0.3.28"
|
futures = "0.3.28"
|
||||||
|
|
|
@ -79,8 +79,8 @@ impl DataBase {
|
||||||
for (device, control) in devices.plugs.iter() {
|
for (device, control) in devices.plugs.iter() {
|
||||||
self.sql.execute(
|
self.sql.execute(
|
||||||
&format!(
|
&format!(
|
||||||
"INSERT INTO devices (device, type)
|
"INSERT INTO devices (device, type, control)
|
||||||
SELECT \"{device}\", \"plug\"
|
SELECT \"{device}\", \"plug\", ?1
|
||||||
WHERE
|
WHERE
|
||||||
NOT EXISTS (
|
NOT EXISTS (
|
||||||
SELECT device
|
SELECT device
|
||||||
|
@ -89,7 +89,7 @@ impl DataBase {
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
),
|
),
|
||||||
[],
|
&[control],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let ctl = if *control { 1 } else { 0 };
|
let ctl = if *control { 1 } else { 0 };
|
||||||
|
|
Loading…
Reference in a new issue