Update ignore syntax to allow adding SQL WHERE clauses.

This commit is contained in:
Craig Drummond committed 2022-03-06 11:31:02 +00:00
1 parent 6f8f3d52a9
commit e60a3c7b09
4 files changed
+25 -12

No files matched your search

+13 -5
View File
@@ -249,11 +249,19 @@ impl Db {
}
}
pub fn set_ignore(&self, like:&str) {
log::info!("Ignore: {}", like);
match self.conn.execute(&format!("UPDATE Tracks SET Ignore=1 WHERE File LIKE \"{}%\"", like), []) {
Ok(_) => { },
Err(e) => { log::error!("Failed set Ignore column for '{}'. {}", like, e); }
pub fn set_ignore(&self, line:&str) {
log::info!("Ignore: {}", line);
if line.starts_with("SQL:") {
let sql = &line[4..];
match self.conn.execute(&format!("UPDATE Tracks Set Ignore=1 WHERE {}", sql), []) {
Ok(_) => { },
Err(e) => { log::error!("Failed set Ignore column for '{}'. {}", line, e); }
}
} else {
match self.conn.execute(&format!("UPDATE Tracks SET Ignore=1 WHERE File LIKE \"{}%\"", line), []) {
Ok(_) => { },
Err(e) => { log::error!("Failed set Ignore column for '{}'. {}", line, e); }
}
}
}
}