mysql - Performing a transaction across multiple statements in phpMyAdmin -
i'm not sure if issue phpmyadmin, or i'm not understanding how transactions work, want able step through series of queries within transaction, , either rollback or commit based on returned results. i'm using innodb storage engine.
here's basic example;
start transaction; update students set lastname = "jones" studentid = 1; select * students; rollback; as single query, works entirely fine, , if i'm happy results, re-run entire query commit.
however, if these queries can ran seperately, why phpmyadmin lose transaction?
for example, if this;
start transaction; update students set lastname = "jones" studentid = 1; select * students; then this;
commit; select * students; the update made in transaction lost, , lastname retains original value, if update never took place. under impression transactions can span multiple queries, , i've seen couple of examples of this;
1: entirely possible in navicat, different ide
2: possible in php via mysqli
why losing transaction in phpmyadmin, if transactions able span multiple individual queries?
edit 1: after doing bit of digging, appears there 2 other ways transaction can implicitly ended in mysql;
- disconnecting client session implicitly end current transaction. changes rolled back.
- killing client session implicitly end current transaction. changes rolled back.
is possible phpmyadmin ending client session after go hit , query submitted?
edit 2:
just confirm phpmyadmin-specific issue, ran same query across multiple seperate queries in mysql workbench, , worked intended, retaining transaction, appears failure on phpmyadmin's part.
is possible phpmyadmin ending client session after go hit , query submitted?
that pretty how php works. send request, get's processed, , once done, (including mysql connections) gets thrown away. next request, start afresh.
there feature called persistent connections, doing it's clean up. otherwise code have somehow handle giving same user same connection. prove difficult given way php works.
Comments
Post a Comment