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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mail at jonas-staudenmeir dot de
New email:
PHP Version: OS:

 

 [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
 [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: Sat Apr 27 06:01:30 2024 UTC