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: 2020-12-09 16:57 UTC
From: mail at jonas-staudenmeir dot de Assigned:
Status: Duplicate Package: PDO MySQL
PHP Version: 7.3.5 OS: Ubuntu
Private report: No CVE-ID: None
 [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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-05-05 10:11 UTC] cmb@php.net
-Package: MySQL related +Package: PDO MySQL
 [2020-12-09 16:57 UTC] nikic@php.net
-Status: Open +Status: Duplicate
 [2020-12-09 16:57 UTC] nikic@php.net
This is another instance of bug #70066.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 12:01:27 2024 UTC