Open bkdotcom opened 2 years ago
Relevant: https://wiki.php.net/rfc/improve_mysqli#the_never-finished_features
Although I was never able to figure out how it works or even if it works, it doesn't necessarily mean that it's completely broken.
@kamil-tekiela interesting...
mysqli::savepoint and mysqli::release_savepoint()
indeed they just seem to abstract simple queries
I turned on mysql statement logging and this is what I got
Query START TRANSACTION
Query INSERT INTO `bob` (`t`) VALUES ("test 1")
Query SAVEPOINT `foo`
Query INSERT INTO `bob` (`t`) VALUES ("test 2")
Query RELEASE SAVEPOINT `foo`
Query ROLLBACK /*foo*/
Query COMMIT /*comment*/
So...
mysqli has a
savepoint($name)
method https://www.php.net/manual/en/mysqli.savepoint.php which creates a savepoint with specified name (SAVEPOINT `foo`)mysqli has a
rollback
method with optional $name param https://www.php.net/manual/en/mysqli.rollback.php but the name param is effectively worthless.. rather than create aROLLBACK TO :foo statement,(as anyone would reasonably expect), instead the method creates a
ROLLBACK /foo/` statement (name simply in a comment).. psych! is there a @todo in the php code ? we have savepoint($name), and rollback(...$name) that doesn't seem to behave as expectedmysqli has a
commit
method with optional $name param https://www.php.net/manual/en/mysqli.commit.php what is the point? mysql doesn't have a "commit to name" or "commit since name" functionality like mysqli::rollback, this simply adds a comment to the query (COMMIT /*foo*/
)