go to bug id or search bugs for
PDO does not respect MySQL 5.7's new feature - max_execution_time()
The code below will explain further. Sadly the mysqli_* seg faults if the same native prepared statement is executed.
$connection = new PDO("mysql:host=127.0.0.1;dbname=experiments", 'root', '');
// Setting this to true triggers a query directly but still the result is same (which is also weird)
// The query is supposed to take about 6s to execute
$stmt = $connection->prepare("select /*+ max_execution_time(1000) */ * from users where name = ?");
It should throw an error around what Mysql natively does:
"ERROR 3024 (HY000): Query execution was interrupted, maximum statement execution time exceeded"
Add a Patch
Add a Pull Request
When client side prepared statement is used i.e PDO::ATTR_EMULATE_PREPARES => true, the expected error PDOException: SQLSTATE[HY000]: General error: 3024 Query execution was interrupted, maximum statement execution time exceeded is thrown
However on using server side prepared statements, this exception is not thrown.
Compared with a ruby script using the mysql2 client. The exception is thrown both when server side prepared statement is used and when prepared query is sent to mysql directly.
This might have to do with how the prepared statement APIs of libmysqlclient are being used internally.
Adding "PDO Mysql" to the title.
I'm also running into this issue. 100% reproducible as per the original reporter.