diff options
author | Dennis Kobert <dennis@kobert.dev> | 2020-02-11 21:47:40 +0000 |
---|---|---|
committer | Dennis Kobert <dennis@kobert.dev> | 2020-02-11 21:47:40 +0000 |
commit | b9606de0d8801f37edb289ad3733b96e557dea3e (patch) | |
tree | 0deae6e1b2cef7ec66ce318111deb60da904a5af /src | |
parent | f4a5e3ac53e854065a3999828a176024cead3807 (diff) |
Fix result query
Diffstat (limited to 'src')
-rw-r--r-- | src/serve.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/serve.rs b/src/serve.rs index 7c15b03..bc13b86 100644 --- a/src/serve.rs +++ b/src/serve.rs @@ -34,6 +34,9 @@ pub fn get_tracks(name: String, url: String) -> String { ) .unwrap(); let uid = get_uid(user_id.as_ref(), &mut client); + client + .execute("DELETE FROM user_track WHERE user_id = $1;", &[&uid]) + .unwrap(); drop(client); let chunk_size = 50; let mut playlist_index = 0; @@ -184,10 +187,11 @@ pub fn match_users(name1: String, name2: String) -> Result<String, status::Custo let tid: i32 = row.get(0); let song = &client .query( - "SELECT name artist popularity FROM track where track_id = $1", + "SELECT name, artist FROM track where track_id = $1", &[&tid], ) .unwrap()[0]; + println!("{:?}", song.columns()); let name: String = song.get(0); let artist: String = song.get(1); songs = format!("{}{} by {}\n", songs, name, artist); |