Skip to content

Commit

Permalink
fix running into apparent bound param limit
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Aug 28, 2024
1 parent b04e558 commit 7218946
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/plugins/playlists.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,17 +618,20 @@ class PlaylistsRepository {
});

const result = await this.#uw.db.transaction().execute(async (tx) => {
await tx.insertInto('playlistItems')
.values(playlistItems.map((item) => ({
id: item.id,
playlistID: playlist.id,
mediaID: item.media.id,
artist: item.artist,
title: item.title,
start: item.start,
end: item.end,
})))
.execute();
for (const item of playlistItems) {
// TODO: use a prepared statement
await tx.insertInto('playlistItems')
.values({
id: item.id,
playlistID: playlist.id,
mediaID: item.media.id,
artist: item.artist,
title: item.title,
start: item.start,
end: item.end,
})
.execute();
}

const result = await tx.selectFrom('playlists')
.select(sql`json(items)`.as('items'))
Expand Down

0 comments on commit 7218946

Please sign in to comment.