Hristijan
03/11/2024, 10:44 AMHristijan
03/11/2024, 10:45 AMdeleteWithIds:
DELETE FROM `favorite_movies` WHERE id IN ?;
and this is the generated code from SQLDelight
public fun deleteWithIds(id: Collection<Long>) {
val idIndexes = createArguments(count = id.size)
driver.execute(null, """DELETE FROM `favorite_movies` WHERE id IN $idIndexes""", id.size) {
id.forEachIndexed { index, id_ ->
bindLong(index, id_)
}
}
notifyQueries(1_142_096_770) { emit ->
emit("favorite_movies")
}
}
is this a bug or i am doing something wrong with creating the indexes?
why it is deleting in idIndexes, i was wondering why my delete function doesn’t work 🤔
This is the table
---TABLE
CREATE TABLE IF NOT EXISTS `favorite_movies`(
`id` INTEGER PRIMARY KEY NOT NULL,
`rating` REAL,
`title` TEXT NOT NULL,
`year` INTEGER,
`large_cover_image` TEXT,
`medium_cover_image` TEXT,
`insertedAt` INTEGER NOT NULL
);
---INDICES
CREATE UNIQUE INDEX IF NOT EXISTS favorite_movies_id_idx ON `favorite_movies` (`id`,`title`);
CREATE UNIQUE INDEX IF NOT EXISTS favorite_movies_id_insertion_idx ON `favorite_movies` (`insertedAt`);
Hristijan
03/14/2024, 9:12 AM