Repository navigation
feat(sqlite/query-generator): sqlite update queries now support limit via rowid - #8450
Merged
Merged
Conversation
By default SQLite is compiled with SQLITE_ENABLE_UPDATE_DELETE_LIMIT off. That means the UPDATE statements would not support an optional LIMIT clause. By using `UPDATE ... WHERE rowid IN (SELECT rowid FROM ... WHERE ... LIMIT n)` instead it can provide support in environments without such feature.
netsgnut
force-pushed
the
sqlite-update-limit
branch
from
October 10, 2017 08:52
23b874e to
63a4618
Compare
sushantdhiman
approved these changes
Oct 11, 2017
Contributor
Author
|
On a related note, it seems |
| * @param {Boolean} [options.individualHooks=false] Run before / after update hooks?. If true, this will execute a SELECT followed by individual UPDATEs. A select is needed, because the row data needs to be passed to the hooks | ||
| * @param {Boolean} [options.returning=false] Return the affected rows (only for postgres) | ||
| * @param {Number} [options.limit] How many rows to update (only for mysql and mariadb, implemented as TOP(n) for MSSQL) | ||
| * @param {Number} [options.limit] How many rows to update (only for mysql and mariadb, implemented as TOP(n) for MSSQL; for sqlite it is supported only when rowid is present) |
Contributor
There was a problem hiding this comment.
isnt rowId always available?
Contributor
Author
There was a problem hiding this comment.
It is enabled by default, but can be absent if created with WITHOUT ROWID. Ref: https://sqlite.org/withoutrowid.html
Contributor
|
@netsgnut A different PR for delete works |
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request check-list
Please make sure to review and check all of these items:
npm run testornpm run test-DIALECTpass with this change (including linting)?Description of change
By default SQLite is compiled with
SQLITE_ENABLE_UPDATE_DELETE_LIMIToff. That means theUPDATEstatements would not support an optionalLIMITclause. By usingUPDATE ... WHERE rowid IN (SELECT rowid FROM ... WHERE ... LIMIT n)instead it can provide support in environments without such feature.