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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to