Autocommit not working with Create Table

MsWord

Mitglied
Hi zusammen,

hat auch schon mal das Problem gehabt, dass das autocommit nicht funktioniert?
Laut MySQL :: MySQL PHP API :: 3.9.44 mysqli::rollback, mysqli_rollback müsste es aber gehen.
Folgendes Beispiel:
PHP:
<?php
                        $mysql->autocommit(FALSE); // my
                        $queryCreate = "CREATE TABLE test (id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY, timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, test FLOAT DEFAULT 0, test2 INT(11) DEFAULT 0, test3 INT(11) DEFAULT 0)";
                        $mysql->query($queryCreate);
                        $mysql->rollback();
// erstellt Tabelle
Warum geht das nicht? Also warum erstellt er die Tabelle obwohl ich autocommit auf false mache?

LG
 
Ich habe gerade mal PHP: mysqli::autocommit - Manual als Erstes aufgeschlagen und siehe da: ein Kommentar schreibt Folgendes:
Geoffrey Thubron hat gesagt.:
[...]
CREATE TABLE and CREATE DATABASE (and probably others) are always commited immediately and your transaction appears to terminate. Thus any commands before and after will be commited, even if a subsequent rollback is attempted.
[...]
Quelle: PHP: mysqli::autocommit - Manual (Der Kommentar ist sage und schreibe 13 Jahre alt! Du kannst ja -- so wie ich -- auch +1 drücken :))

Für nähere Informationen würde ich wahrscheinlich in die MySQL-(Treiber-)Doku bzgl. Autocommit sehen.
 
Zurück