-
-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pagination & transaction #1278
Comments
I don't know what you are trying to achieve, but this has nothing to do with transactions. You are updating rows, which affects the query in If you log what you're doing you'll see that it doesn't make sense: +console.log('update', id);
db.prepare(`UPDATE bar SET foo = ? WHERE id = ?`).run(crypto.randomBytes(6).toString("hex"), id); results
You're essentially removing 10 items from the results (by making foo not null) while also moving offset further, which will then cause 10 items to be skipped. |
Thank you for your response. The logs were included for the example, but indeed the example was incorrect. I intended to pass results into the transaction function, not ids. However, my mind clicked when I read your last sentence. Indeed, the cursor shifts with the foo IS NULL condition, hence my mistake. I simply removed the offset to resolve this issue. Thank you. |
Hello 👋,
I notice an issue when I want to use pagination (offset + limit) and then perform transactions.
Here is an example that reproduces the problem:
We can see that the offset correctly returns the first 10, then skips the next 10. Without the transaction to update the rows, the behavior is correct; I get 1 to 10, then 11 to 20, and so on.
Is this normal behavior, or is there indeed an issue?
Thank you 😊.
The text was updated successfully, but these errors were encountered: