bug79872.phpt 768 B

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