[Proposal] Add `savepoint()` method to PDO
| From: | Saki Takamachi | Date: | Mon, 05 Feb 2024 00:32:39 +0000 |
| Subject: | [Proposal] Add `savepoint()` method to PDO | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-122278@lists.php.net to get a copy of this message | ||
Hi internals,
I'm thinking of adding a
savepoint(string $name) method to PDO. Similarly, add
releaseSavepoint(string $name) and change the signature of rollback() to
rollback(?string $name = null).
Savepoint is a feature defined in SQL99, so it is a feature supported by many databases. Therefore,
I thought it would be a good idea to support this with PDO.
If we use savepoint() before a transaction has started, it is expected that a
PDOException will be thrown. Similarly, if we use releaseSavepoint() or
rollback('savepoint_name’) when there is no savepoint, an exception will be
thrown.
Only pdo_odbc cannot predict what kind of database will be used, but in the odbc3 API, we can use
supportsSavepoints() to find out whether the database supports savepoints.
FYI, mysqli already has support for savepoints.
I would like to know your opinion.
Regard.
Saki