Cela a fonctionné comme un charme!
$db->query('set profiling=1'); //optional if profiling is already enabled
$db->query($_POST['query']);
$stmt = $db->query('show profiles');
$db->query('set profiling=0'); //optional as well
$records = $stmt->fetchAll(PDO::FETCH_ASSOC);
$errmsg = $stmt->errorInfo()[2]; //Output the error message
MISE À JOUR (ce qui suit fonctionne maintenant sur innodb sur ma configuration actuelle)
$db->query('set profiling=1'); //optional if profiling is already enabled
$db->query($_POST['query']);
$res = $db->query('show profiles');
$records = $res->fetchAll(PDO::FETCH_ASSOC);
$duration = $records[0]['Duration']; // get the first record [0] and the Duration column ['Duration'] from the first record
Résultat de (afficher les profils) de phpmyadmin.
Query_ID Duration Query
1 0.00010575 SELECT DATABASE()