php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77970 "ALTER VIEW" queries not working as prepared statements
Submitted: 2019-05-04 17:09 UTC Modified: 2019-05-05 10:11 UTC
From: mail at jonas-staudenmeir dot de Assigned:
Status: Open Package: PDO MySQL
PHP Version: 7.3.5 OS: Ubuntu
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-05-04 17:09 UTC] mail at jonas-staudenmeir dot de
Description:
------------
Ubuntu 18.04.2
MySQL 8.0.15

"ALTER VIEW" queries don't work as prepared statements if emulation is disabled.

Test script:
---------------
$pdo = new PDO('mysql:host=127.0.0.1;port=3306;dbname=database', 'user', 'password', [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_EMULATE_PREPARES => false,
]);

$pdo->prepare('create view `test` as select 1')->execute();
$pdo->prepare('alter view `test` as select 1')->execute();

Expected result:
----------------
Successful query execution.

Actual result:
--------------
The last line throws an exception:

"PDOException: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute."

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-05-05 10:11 UTC] cmb@php.net
-Package: MySQL related +Package: PDO MySQL
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Jul 19 21:01:26 2019 UTC