Hi, I've opened a PR adding a new attribute to PDO\Sqlite:
https://github.com/php/php-src/pull/19317 <https://github.com/php/php-
src/pull/19317?notification_referrer_id=NT_kwDOAfgLhrQxNzkxMjcwMjYzOTozMzAzMzA5NA#issuecomment-
3176177745>
The change is explained in depth in the PR, but in short, it makes it
possible to use immediate/exclusive transaction modes, rather than the
default deferred mode, when using $pdo->beginTransaction(). Deferred
mode has this particular behavior where if your transaction first reads
before writing, it will only wait for other transactions to finish while
acquiring the initial shared lock. Then when it tries to upgrade to a
write lock it just immediately aborts with SQLITE_BUSY, regardless of
your busy_timeout setting.
This is a real pain point with using SQLite in production. I've
addressed it by adding a new attribute that changes how the PDO driver
begins the transaction.
Is my understanding correct that this doesn't need an RFC? And if that's
the case, is this PR not subject to the PHP 8.5 feature freeze happening
this week?
The changes are pretty basic so I'd appreciate any reviews that could
move this forward. Would love for this to land in PHP 8.5.
Hi, I've opened a PR adding a new attribute to PDO\Sqlite: https://
github.com/php/php-src/pull/19317 <https://github.com/php/php-src/
pull/19317?
notification_referrer_id=NT_kwDOAfgLhrQxNzkxMjcwMjYzOTozMzAzMzA5NA#issuecomment-3176177745>
As far as the form the attribute takes goes, an Enum with the values
DEFERRED/IMMEDIATE/EXCLUSIVE would do the job.
(As for calling it an attribute, I thought at first that what was being
suggested was an Attribute, rather than a connection option.)
By enums I'm assuming you mean PHP enums. That could work and would
solve my issue of trying to represent the values of the attribute (only
thing I'm not sure about is Pdo\SqliteTransactionMode being directly in
the Pdo namespace). I've included a sample implementation in this
comment <https://github.com/php/php-src/pull/19317#issuecomment-
3177353751>
Hi, I've opened a PR adding a new attribute to PDO\Sqlite: https://
github.com/php/php-src/pull/19317 <<https://github.com/php/php-
src/>
pull/19317?notification_referrer_id=NT_kwDOAfgLhrQxNzkxMjcwMjYzOTozMzAzMzA5NA#issuecomment-
3176177745>
As far as the form the attribute takes goes, an Enum with the values
DEFERRED/IMMEDIATE/EXCLUSIVE would do the job.(As for calling it an attribute, I thought at first that what was
being
suggested was an Attribute, rather than a connection option.)