diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDao.kt index 131647593..dcaafb5b6 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDao.kt @@ -68,13 +68,15 @@ class BookDao( // insert urls in a temporary table, else the select size can exceed the statement limit dsl.deleteFrom(u).execute() - dsl.batch( - dsl.insertInto(u, u.URL).values(null as String?) - ).also { step -> - urls.forEach { - step.bind(it.toString()) - } - }.execute() + if (urls.isNotEmpty()) { + dsl.batch( + dsl.insertInto(u, u.URL).values(null as String?) + ).also { step -> + urls.forEach { + step.bind(it.toString()) + } + }.execute() + } return dsl.selectFrom(b) .where(b.LIBRARY_ID.eq(libraryId)) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDao.kt index d18ed620b..6daf5ba8b 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDao.kt @@ -46,13 +46,15 @@ class SeriesDao( // insert urls in a temporary table, else the select size can exceed the statement limit dsl.deleteFrom(u).execute() - dsl.batch( - dsl.insertInto(u, u.URL).values(null as String?) - ).also { step -> - urls.forEach { - step.bind(it.toString()) - } - }.execute() + if (urls.isNotEmpty()) { + dsl.batch( + dsl.insertInto(u, u.URL).values(null as String?) + ).also { step -> + urls.forEach { + step.bind(it.toString()) + } + }.execute() + } return dsl.selectFrom(s) .where(s.LIBRARY_ID.eq(libraryId))