Skip to content
This repository was archived by the owner on Jul 1, 2026. It is now read-only.

Added support for setting SQLite limits - #1548

Merged
daniellockyer merged 1 commit into
TryGhost:masterfrom
paulfitz:sqlite3-limit
Jul 31, 2022
Merged

Added support for setting SQLite limits#1548
daniellockyer merged 1 commit into
TryGhost:masterfrom
paulfitz:sqlite3-limit

Conversation

@paulfitz

Copy link
Copy Markdown
Contributor

This extends db.configure to support the sqlite3_limit method.

Calling db.configure('limit', sqlite3.LIMIT_XXX, value) is now equivalent to calling sqlite3_limit(db, SQLITE_LIMIT_XXX, value). For example, to prohibit attaching extra databases on a given database connection, you'd call db.configure('limit', sqlite3.LIMIT_ATTACHED, 0). The list of possible limits is taken from https://www.sqlite.org/c3ref/c_limit_attached.html

This is useful for selectively reducing limits. It cannot increase limits set at compile-time.

@paulfitz

Copy link
Copy Markdown
ContributorAuthor

The single test failure looks unrelated:
Screenshot from 2022-03-03 10-15-19
Other runs look happier:
Screenshot from 2022-03-03 10-17-38

@daniellockyer

Copy link
Copy Markdown
Contributor

@paulfitz Would you be able to rebase the PR? 🙂

@daniellockyerdaniellockyer self-assigned this Jul 31, 2022
This extends `db.configure` to support the `sqlite3_limit` method.
Calling `db.configure('limit', sqlite3.LIMIT_XXX, value)` is equivalent to
calling `sqlite3_limit(db, SQLITE_LIMIT_XXX, value)`.
For example, to prohibit attaching extra databases on a given database
connection, you'd call `db.configure('limit', sqlite3.LIMIT_ATTACHED, 0)`.
@paulfitz

Copy link
Copy Markdown
ContributorAuthor

@daniellockyer I've rebased the PR.

@daniellockyerdaniellockyer changed the title support sqlite3_limit(id, value) via db.configure('limit', id, value)Added support for setting SQLite limitsJul 31, 2022
@daniellockyer
daniellockyer merged commit 1bcbf70 into TryGhost:masterJul 31, 2022
@joebnb

Copy link
Copy Markdown

waiting for this feature come

@paulfitz
paulfitz deleted the sqlite3-limit branch September 19, 2022 16:14
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@paulfitz@daniellockyer@joebnb