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