mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-12-13 05:40:30 +05:30
Merge pull request #660 from TeamPiped/excluded-update
Use excluded in DO UPDATE SET
This commit is contained in:
commit
75883f6588
@ -162,18 +162,17 @@ public class VideoHelpers {
|
||||
s.createNativeMutationQuery(
|
||||
"INSERT INTO videos (uploader_id,duration,is_short,thumbnail,title,uploaded,views,id) values " +
|
||||
"(:uploader_id,:duration,:is_short,:thumbnail,:title,:uploaded,:views,:id) ON CONFLICT (id) DO UPDATE SET " +
|
||||
"duration = :duration," +
|
||||
"title = :title," +
|
||||
"views = :views"
|
||||
"duration = excluded.duration, title = excluded.title, views = excluded.views"
|
||||
)
|
||||
.setParameter("uploader_id", video.getChannel())
|
||||
.setParameter("uploader_id", video.getChannel().getUploaderId())
|
||||
.setParameter("duration", video.getDuration())
|
||||
.setParameter("is_short", video.isShort())
|
||||
.setParameter("thumbnail", video.getThumbnail())
|
||||
.setParameter("title", video.getTitle())
|
||||
.setParameter("uploaded", video.getUploaded())
|
||||
.setParameter("views", video.getViews())
|
||||
.setParameter("id", video.getId()).executeUpdate();
|
||||
.setParameter("id", video.getId())
|
||||
.executeUpdate();
|
||||
tr.commit();
|
||||
} catch (Exception e) {
|
||||
tr.rollback();
|
||||
|
Loading…
Reference in New Issue
Block a user