Re: [Proposal] Add `savepoint()` method to PDO

From: Date: Mon, 05 Feb 2024 13:54:23 +0000
Subject: Re: [Proposal] Add `savepoint()` method to PDO
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-122284@lists.php.net to get a copy of this message
Hi Kentaro, Thank you for your important point. > While most databases use SAVEPOINT [name], but: > > ±\¶Çí Øü > ìc}óhttps://github.com/laravel/framework/blob/v10.43.0/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php#L453-L456 > > ```php > return 'SAVE TRANSACTION '.$name; > ``` > > SQL Server uniquely uses SAVE TRANSACTION [name]. There might > be > other variations in databases, so full support could be challenging, > which is something to be mindful of. I think this feature will be implemented for each driver, so it probably won't be a problem for anything other than pdo_odbc. As you say, I think I need to think a little more about pdo_odbc. (When I looked into odbc3 again, I realized that what I had written was not an API for odbc, sorry. Therefore, it may be difficult to support this feature stably with ODBC.) I'll see if there's a better way. >> change the signature of rollback() to >> rollback(?string $name = null). > > This might lead to confusion due to rollback() having multiple > functionalities, as ROLLBACK and ROLLBACK TO > [name] target > different rollback operations. > > Just as beginTransaction() and > savepoint() are separate, perhaps > having a separate method for rolling back to a savepoint might > maintain consistency, for example rollbackToSavepoint(string $name)Ü Regarding this, mysqli's rollback() is such a specification, so I used that as a reference. However, it may be safer to separate the method itself. rollbackTo() might also be good. Regards. Saki

« previous php.internals (#122284) next »