xref: /php-src/ext/pdo_mysql/tests/bug79872.phpt (revision 4bb75d56)
1--TEST--
2Bug #79872: Can't execute query with pending result sets
3--EXTENSIONS--
4pdo_mysql
5--SKIPIF--
6<?php
7require_once __DIR__ . '/inc/mysql_pdo_test.inc';
8MySQLPDOTest::skip();
9?>
10--FILE--
11<?php
12require_once __DIR__ . '/inc/mysql_pdo_test.inc';
13
14$db = MySQLPDOTest::factory();
15$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
16
17$stmt = $db->prepare('SET @foo = 1; SET @bar = 2;');
18$stmt->execute();
19try {
20    var_dump($db->query('SELECT @foo')->fetchAll());
21} catch (PDOException $e) {
22    echo $e->getMessage(), "\n";
23}
24?>
25--EXPECT--
26SQLSTATE[HY000]: General error: 2014 Cannot execute queries while there are pending result sets. Consider unsetting the previous PDOStatement or calling PDOStatement::closeCursor()
27