BookmarkDao.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:airsonic 作者:
/**
 * Creates or updates a bookmark.  If created, the ID of the bookmark will be set by this method.
 */
@Transactional
public void createOrUpdateBookmark(Bookmark bookmark) {
    int n = update("update bookmark set position_millis=?, comment=?, changed=? where media_file_id=? and username=?",
            bookmark.getPositionMillis(), bookmark.getComment(), bookmark.getChanged(), bookmark.getMediaFileId(), bookmark.getUsername());

    if (n == 0) {
        update("insert into bookmark (" + INSERT_COLUMNS + ") values (" + questionMarks(INSERT_COLUMNS) + ")",
               bookmark.getMediaFileId(), bookmark.getPositionMillis(), bookmark.getUsername(), bookmark.getComment(),
               bookmark.getCreated(), bookmark.getChanged());
        int id = queryForInt("select id from bookmark where media_file_id=? and username=?", 0, bookmark.getMediaFileId(), bookmark.getUsername());
        bookmark.setId(id);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号