feat: now ignores primary key attempted insert
This commit is contained in:
parent
4c4d7ff68d
commit
c0fdc222fb
1 changed files with 8 additions and 8 deletions
|
@ -11,8 +11,8 @@ pub enum DatabaseCreationError {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct DatabaseRequest {
|
pub struct DatabaseRequest {
|
||||||
search_type: SearchType,
|
pub search_type: SearchType,
|
||||||
search_tag: PartialTag,
|
pub search_tag: PartialTag,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum SearchType {
|
pub enum SearchType {
|
||||||
|
@ -21,11 +21,11 @@ pub enum SearchType {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct PartialTag {
|
pub struct PartialTag {
|
||||||
path: Option<String>,
|
pub path: Option<String>,
|
||||||
title: Option<String>,
|
pub title: Option<String>,
|
||||||
artist: Option<String>,
|
pub artist: Option<String>,
|
||||||
album: Option<String>,
|
pub album: Option<String>,
|
||||||
album_artist: Option<String>,
|
pub album_artist: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PartialTag {
|
impl Default for PartialTag {
|
||||||
|
@ -147,7 +147,7 @@ impl DBObject {
|
||||||
|
|
||||||
pub fn save_tag(self: &Self, tag: &ItemTag) -> Result<(), DatabaseCreationError> {
|
pub fn save_tag(self: &Self, tag: &ItemTag) -> Result<(), DatabaseCreationError> {
|
||||||
self.conn.execute(
|
self.conn.execute(
|
||||||
"INSERT INTO musicinfo (path, title, artist, album, album_artist) VALUES ( ?1, ?2, ?3, ?4, ?5 )",
|
"INSERT OR IGNORE INTO musicinfo (path, title, artist, album, album_artist) VALUES ( ?1, ?2, ?3, ?4, ?5 )",
|
||||||
params![tag.path, tag.title, tag.artist, tag.album, tag.album_artist],
|
params![tag.path, tag.title, tag.artist, tag.album, tag.album_artist],
|
||||||
)?;
|
)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue