Answer the question
In order to leave comments, you need to log in
The level of isolation itself is changing !!! (php, pdo, mysql)?
Hello everyone,
I'm working with mysql using pdo, I'm trying to change the isolation level, but after the first request, it returns to the default value again. If anyone has come across please let me know.
//create connection
$x = new PDO("mysql:host=". db_host. ";dbname=". db_name, db_user, db_pass);
//change isolation level
$x->query("SET TRANSACTION ISOLATION LEVEL READ COMMITTED;");
//check it
$query = "SHOW VARIABLES LIKE '%tx_isolation%';";
$result = $x->query($query);
$res = $result->fetch(PDO::FETCH_ASSOC);
print_r($res);
//…
$x->query("select * from test");
// check again
$query = "SHOW VARIABLES LIKE '
$result = $x->query($query);
$res = $result->fetch(PDO::FETCH_ASSOC);
print_r($res);
as a result, we get two completely different values
Array
(
[Variable_name] => tx_isolation
[Value] => READ-COMMITTED
)
Array
(
[Variable_name] => tx_isolation
[Value] => REPEATABLE-READ
)
Answer the question
In order to leave comments, you need to log in
Autocommit enabled?
dev.mysql.com/doc/refman/5.5/en/innodb-transaction-model.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question