PHP  
 PHP_7_3
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Expected Test Failure Report for ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt ('MySQL PDOStatement->nextRowSet()')

Script

1: <?php
2:     
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR 'mysql_pdo_test.inc');
3:     
$db MySQLPDOTest::factory();
4:     
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHEStrue);
5:
6:     
MySQLPDOTest::createTestTable($db);
7:
8:     
$stmt $db->query('SELECT id FROM test');
9:     if (
false !== ($tmp $stmt->nextRowSet()))
10:         
printf("[002] Expecting false got %s\n"var_export($tmptrue));
11:
12:     
// TODO: should give a warning, but its PDO, let's ignore the missing warning for now
13:     
if (false !== ($tmp $stmt->nextRowSet(1)))
14:         
printf("[003] Expecting false got %s\n"var_export($tmptrue));
15:
16:     function 
test_proc1($db) {
17:
18:         
$stmt $db->query('SELECT @VERSION as _version');
19:         
$tmp $stmt->fetch(PDO::FETCH_ASSOC);
20:         
assert($tmp['_version'] === NULL);
21:         while (
$stmt->fetch()) ;
22:
23:         
$db->exec('DROP PROCEDURE IF EXISTS p');
24:         
$db->exec('CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;');
25:         
$db->exec('CALL p(@VERSION)');
26:         
$stmt $db->query('SELECT @VERSION as _version');
27:         
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
28:         
var_dump($stmt->nextRowSet());
29:
30:     }
31:
32:     function 
test_proc2($db) {
33:
34:         
$db->exec('DROP PROCEDURE IF EXISTS p');
35:         
$db->exec('CREATE PROCEDURE p() BEGIN SELECT id FROM test ORDER BY id ASC LIMIT 3; SELECT id, label FROM test WHERE id < 4 ORDER BY id DESC LIMIT 3; END;');
36:         
$stmt $db->query('CALL p()');
37:         do {
38:             
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
39:         } while (
$stmt->nextRowSet());
40:         
var_dump($stmt->nextRowSet());
41:
42:     }
43:
44:     try {
45:
46:         
// Emulated PS
47:         
printf("Emulated PS...\n");
48:         
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES1);
49:
50:         
$db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY1);
51:         
test_proc1($db);
52:         
test_proc2($db);
53:
54:         
$db MySQLPDOTest::factory();
55:         
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHEStrue);
56:         
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES1);
57:         
$db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY0);
58:         
test_proc1($db);
59:         
test_proc2($db);
60:
61:         
// Native PS
62:         
printf("Native PS...\n");
63:         
$db MySQLPDOTest::factory();
64:         
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHEStrue);
65:         
$db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY1);
66:         
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES0);
67:         
test_proc1($db);
68:         
test_proc2($db);
69:
70:         
$db MySQLPDOTest::factory();
71:         
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHEStrue);
72:         
$db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY0);
73:         
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES0);
74:
75:         
test_proc1($db);
76:         
test_proc2($db);
77:
78:         @
$db->exec('DROP PROCEDURE IF EXISTS p');
79:
80:     } catch (
PDOException $e) {
81:         
printf("[001] %s [%s] %s\n",
82:             
$e->getMessage(), $db->errorCode(), implode(' '$db->errorInfo()));
83:     }
84:
85:     print 
"done!";
86:
?>
87:

Expected

Emulated PS...
array(1) {
  [0]=>
  array(1) {
    ["_version"]=>
    string(%d) "%s"
  }
}
bool(false)
array(3) {
  [0]=>
  array(1) {
    ["id"]=>
    string(1) "1"
  }
  [1]=>
  array(1) {
    ["id"]=>
    string(1) "2"
  }
  [2]=>
  array(1) {
    ["id"]=>
    string(1) "3"
  }
}
array(3) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "3"
    ["label"]=>
    string(1) "c"
  }
  [1]=>
  array(2) {
    ["id"]=>
    string(1) "2"
    ["label"]=>
    string(1) "b"
  }
  [2]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    ["label"]=>
    string(1) "a"
  }
}
bool(false)
array(1) {
  [0]=>
  array(1) {
    ["_version"]=>
    string(%d) "%s"
  }
}
bool(false)
array(3) {
  [0]=>
  array(1) {
    ["id"]=>
    string(1) "1"
  }
  [1]=>
  array(1) {
    ["id"]=>
    string(1) "2"
  }
  [2]=>
  array(1) {
    ["id"]=>
    string(1) "3"
  }
}
array(3) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "3"
    ["label"]=>
    string(1) "c"
  }
  [1]=>
  array(2) {
    ["id"]=>
    string(1) "2"
    ["label"]=>
    string(1) "b"
  }
  [2]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    ["label"]=>
    string(1) "a"
  }
}
bool(false)
Native PS...
array(1) {
  [0]=>
  array(1) {
    ["_version"]=>
    string(%d) "%s"
  }
}
bool(false)
array(3) {
  [0]=>
  array(1) {
    ["id"]=>
    string(1) "1"
  }
  [1]=>
  array(1) {
    ["id"]=>
    string(1) "2"
  }
  [2]=>
  array(1) {
    ["id"]=>
    string(1) "3"
  }
}
array(3) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "3"
    ["label"]=>
    string(1) "c"
  }
  [1]=>
  array(2) {
    ["id"]=>
    string(1) "2"
    ["label"]=>
    string(1) "b"
  }
  [2]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    ["label"]=>
    string(1) "a"
  }
}
bool(false)
array(1) {
  [0]=>
  array(1) {
    ["_version"]=>
    string(%d) "%s"
  }
}
bool(false)
array(3) {
  [0]=>
  array(1) {
    ["id"]=>
    string(1) "1"
  }
  [1]=>
  array(1) {
    ["id"]=>
    string(1) "2"
  }
  [2]=>
  array(1) {
    ["id"]=>
    string(1) "3"
  }
}
array(3) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "3"
    ["label"]=>
    string(1) "c"
  }
  [1]=>
  array(2) {
    ["id"]=>
    string(1) "2"
    ["label"]=>
    string(1) "b"
  }
  [2]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    ["label"]=>
    string(1) "a"
  }
}
bool(false)
done!

Output

Emulated PS...
array(1) {
  [0]=>
  array(1) {
    ["_version"]=>
    string(6) "5.1.73"
  }
}
bool(false)
array(3) {
  [0]=>
  array(1) {
    ["id"]=>
    string(1) "1"
  }
  [1]=>
  array(1) {
    ["id"]=>
    string(1) "2"
  }
  [2]=>
  array(1) {
    ["id"]=>
    string(1) "3"
  }
}
array(3) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "3"
    ["label"]=>
    string(1) "c"
  }
  [1]=>
  array(2) {
    ["id"]=>
    string(1) "2"
    ["label"]=>
    string(1) "b"
  }
  [2]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    ["label"]=>
    string(1) "a"
  }
}
bool(false)
array(1) {
  [0]=>
  array(1) {
    ["_version"]=>
    string(6) "5.1.73"
  }
}
bool(false)
array(3) {
  [0]=>
  array(1) {
    ["id"]=>
    string(1) "1"
  }
  [1]=>
  array(1) {
    ["id"]=>
    string(1) "2"
  }
  [2]=>
  array(1) {
    ["id"]=>
    string(1) "3"
  }
}
bool(false)
Native PS...
array(1) {
  [0]=>
  array(1) {
    ["_version"]=>
    string(6) "5.1.73"
  }
}
bool(false)
array(3) {
  [0]=>
  array(1) {
    ["id"]=>
    string(1) "1"
  }
  [1]=>
  array(1) {
    ["id"]=>
    string(1) "2"
  }
  [2]=>
  array(1) {
    ["id"]=>
    string(1) "3"
  }
}
array(3) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "3"
    ["label"]=>
    string(1) "c"
  }
  [1]=>
  array(2) {
    ["id"]=>
    string(1) "2"
    ["label"]=>
    string(1) "b"
  }
  [2]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    ["label"]=>
    string(1) "a"
  }
}
bool(false)
array(1) {
  [0]=>
  array(1) {
    ["_version"]=>
    string(6) "5.1.73"
  }
}
bool(false)
array(3) {
  [0]=>
  array(1) {
    ["id"]=>
    string(1) "1"
  }
  [1]=>
  array(1) {
    ["id"]=>
    string(1) "2"
  }
  [2]=>
  array(1) {
    ["id"]=>
    string(1) "3"
  }
}
array(3) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "3"
    ["label"]=>
    string(1) "c"
  }
  [1]=>
  array(2) {
    ["id"]=>
    string(1) "2"
    ["label"]=>
    string(1) "b"
  }
  [2]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    ["label"]=>
    string(1) "a"
  }
}
bool(false)
done!

Diff

076+ bool(false)
077+ Native PS...
078+ array(1) {
079+   [0]=>
080+   array(1) {
081+     ["_version"]=>
082+     string(6) "5.1.73"
083+   }
084+ }
085+ bool(false)
078-   array(2) {
080-     string(1) "3"
081-     ["label"]=>
082-     string(1) "c"
085-   array(2) {
088+   array(1) {
088-     ["label"]=>
089-     string(1) "b"
090+     string(1) "1"
092-   array(2) {
093+   array(1) {
094-     string(1) "1"
095-     ["label"]=>
096-     string(1) "a"
098+   array(1) {
099- bool(false)
100- Native PS...
101- array(1) {
100+     string(1) "3"
103+ array(3) {
103-   array(1) {
105+   array(2) {
106+     ["id"]=>
107+     string(1) "3"
108+     ["label"]=>
109+     string(1) "c"
110+   }
111+   [1]=>
112+   array(2) {
113+     ["id"]=>
114+     string(1) "2"
115+     ["label"]=>
116+     string(1) "b"
117+   }
118+   [2]=>
119+   array(2) {
120+     ["id"]=>
121+     string(1) "1"
122+     ["label"]=>
123+     string(1) "a"
124+   }
125+ }
126+ bool(false)
127+ array(1) {
128+   [0]=>
129+   array(1) {
150- array(1) {
176+ done!
151-   [0]=>
152-   array(1) {
153-     ["_version"]=>
154-     string(%d) "%s"
155-   }
156- }
157- bool(false)
158- array(3) {
159-   [0]=>
160-   array(1) {
161-     ["id"]=>
162-     string(1) "1"
163-   }
164-   [1]=>
165-   array(1) {
166-     ["id"]=>
167-     string(1) "2"
168-   }
169-   [2]=>
170-   array(1) {
171-     ["id"]=>
172-     string(1) "3"
173-   }
174- }
175- array(3) {
176-   [0]=>
177-   array(2) {
178-     ["id"]=>
179-     string(1) "3"
180-     ["label"]=>
181-     string(1) "c"
182-   }
183-   [1]=>
184-   array(2) {
185-     ["id"]=>
186-     string(1) "2"
187-     ["label"]=>
188-     string(1) "b"
189-   }
190-   [2]=>
191-   array(2) {
192-     ["id"]=>
193-     string(1) "1"
194-     ["label"]=>
195-     string(1) "a"
196-   }
197- }
198- bool(false)
199- done!

 

Generated at Tue, 10 Sep 2019 23:15:19 +0000 (6 days ago)

Copyright © 2005-2019 The PHP Group
All rights reserved.