-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
sqlite: add limits property to DatabaseSync #61298
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
base: main
Are you sure you want to change the base?
Conversation
|
Review requested:
|
f2bfe7a to
f57afa7
Compare
f57afa7 to
ffd7dd0
Compare
louwers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add SQLITE_MAX_LENGTH etc. as constants? https://sqlite.org/limits.html
SQLITE_MAX are compile-time preprocessor macros, so they can't be exported directly at runtime. however, the default values returned by db.limits are exactly these SQLITE_MAX values (assuming SQLite was compiled with default settings). so db.limits.length returns 1000000000 which equals SQLITE_MAX_LENGTH. if you want explicit constants, i could add SQLITE_LIMIT (the enum IDs used with sqlite3_limit()) to the constants object. |
Co-authored-by: Anna Henningsen <github@addaleax.net>
Co-authored-by: Anna Henningsen <github@addaleax.net>
Co-authored-by: Anna Henningsen <github@addaleax.net>
Co-authored-by: Anna Henningsen <github@addaleax.net>
Co-authored-by: Anna Henningsen <github@addaleax.net>
Co-authored-by: Anna Henningsen <github@addaleax.net>
Co-authored-by: Anna Henningsen <github@addaleax.net>
Co-authored-by: Anna Henningsen <github@addaleax.net>
|
@addaleax thanks for reviews, I tried solve |
|
I think my only main thought is regarding the intended behaviour when requested limits are out of range. Presumably we can add the relevant compile-time value to each |
thanks for comment, I tried use SQLITE_MAX_* |
I think this is actually a lot more ergonomic. Then if you want to reset a limit you can just do: db.limits.length = Infinity;Otherwise you'd need to look up the maximum limit. If you make a mistake, or the maximum limit changes, you get an exception... These limits are for limiting a database. If the user tries to set a limit that is too high, it may not be what "the result the user intended", but the intended result was impossible anyway... |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #61298 +/- ##
==========================================
+ Coverage 88.01% 88.50% +0.49%
==========================================
Files 704 704
Lines 208759 208903 +144
Branches 40194 40296 +102
==========================================
+ Hits 183741 184896 +1155
+ Misses 16958 15995 -963
+ Partials 8060 8012 -48
🚀 New features to boost your workflow:
|
thanks for the suggestion ❤️ Yes, this is the current behavior values are passed directly to sqlite3_limit() which handles truncation silently. So db.limits.length = Infinity works as a convenient way to reset to the maximum. |
While I'm not fundamentally opposed to this pattern, note that Could we use |
for: #61268
add limits property to databaseSync