xref: /PHP-8.3/ext/pdo_dblib/tests/bug_69592.phpt (revision 74859783)
1--TEST--
2PDO_DBLIB: PDO::DBLIB_ATTR_SKIP_EMPTY_ROWSETS for skip junk resultsets on SET NOCOUNT expression
3--EXTENSIONS--
4pdo_dblib
5--SKIPIF--
6<?php
7require __DIR__ . '/config.inc';
8?>
9--FILE--
10<?php
11require __DIR__ . '/config.inc';
12
13$sql = '
14    SET NOCOUNT ON
15    SELECT 0 AS [result]
16';
17
18var_dump($db->getAttribute(PDO::DBLIB_ATTR_SKIP_EMPTY_ROWSETS));
19
20$stmt = $db->query($sql);
21var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
22var_dump($stmt->nextRowset());
23var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
24$stmt->closeCursor();
25
26
27$db->setAttribute(PDO::DBLIB_ATTR_SKIP_EMPTY_ROWSETS, true);
28var_dump($db->getAttribute(PDO::DBLIB_ATTR_SKIP_EMPTY_ROWSETS));
29
30$stmt = $db->query($sql);
31var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
32var_dump($stmt->nextRowset());
33var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
34$stmt->closeCursor();
35var_dump($db->getAttribute(PDO::DBLIB_ATTR_SKIP_EMPTY_ROWSETS));
36
37?>
38--EXPECT--
39bool(false)
40array(0) {
41}
42bool(true)
43array(1) {
44  [0]=>
45  array(1) {
46    ["result"]=>
47    int(0)
48  }
49}
50bool(true)
51array(1) {
52  [0]=>
53  array(1) {
54    ["result"]=>
55    int(0)
56  }
57}
58bool(false)
59array(0) {
60}
61bool(true)
62