1--TEST-- 2PDO_DBLIB: driver supports SET ROWCOUNT and SELECT @@ROWCOUNT in batch statements 3--EXTENSIONS-- 4pdo_dblib 5--SKIPIF-- 6<?php 7require __DIR__ . '/config.inc'; 8 9if (!driver_supports_batch_statements_without_select($db)) die('xfail test will fail with this version of FreeTDS'); 10?> 11--FILE-- 12<?php 13require __DIR__ . '/config.inc'; 14 15$stmt = $db->query( 16"create table #php_pdo(id int); " . 17"set rowcount 2; " . 18"insert into #php_pdo values(1), (2), (3); " . 19"insert into #php_pdo values(4), (5), (6); " . 20"update #php_pdo set id = 4; " . 21"select @@rowcount; " 22); 23 24// check results from the create table 25var_dump($stmt->rowCount()); 26var_dump($stmt->nextRowset()); 27 28// check results from the set rowcount 29var_dump($stmt->rowCount()); 30var_dump($stmt->nextRowset()); 31 32// check results from the first insert 33var_dump($stmt->rowCount()); 34var_dump($stmt->nextRowset()); 35 36// check results from the second insert 37var_dump($stmt->rowCount()); 38var_dump($stmt->nextRowset()); 39 40// check results from the update 41var_dump($stmt->rowCount()); 42var_dump($stmt->nextRowset()); 43 44// check results from the select rowcount 45var_dump($stmt->fetchAll()); 46var_dump($stmt->rowCount()); 47var_dump($stmt->nextRowset()); 48 49// check that there are no more results 50var_dump($stmt->rowCount()); 51var_dump($stmt->nextRowset()); 52 53// now cleanup and check that the results are expected 54$stmt = $db->query("set rowcount 0;" . 55"select * from #php_pdo;" . 56"delete from #php_pdo;" . 57"drop table #php_pdo;" 58); 59 60// check results from set rowcount 61var_dump($stmt->rowCount()); 62var_dump($stmt->nextRowset()); 63 64// check results from the select 65var_dump($stmt->fetchAll()); 66var_dump($stmt->rowCount()); 67var_dump($stmt->nextRowset()); 68 69// check results from the delete 70var_dump($stmt->rowCount()); 71var_dump($stmt->nextRowset()); 72 73// check results from the drop 74var_dump($stmt->rowCount()); 75var_dump($stmt->nextRowset()); 76 77// check that there are no more results 78var_dump($stmt->rowCount()); 79var_dump($stmt->nextRowset()); 80 81?> 82--EXPECT-- 83int(-1) 84bool(true) 85int(-1) 86bool(true) 87int(2) 88bool(true) 89int(2) 90bool(true) 91int(2) 92bool(true) 93array(1) { 94 [0]=> 95 array(2) { 96 ["computed"]=> 97 int(2) 98 [0]=> 99 int(2) 100 } 101} 102int(-1) 103bool(false) 104int(-1) 105bool(false) 106int(-1) 107bool(true) 108array(4) { 109 [0]=> 110 array(2) { 111 ["id"]=> 112 int(4) 113 [0]=> 114 int(4) 115 } 116 [1]=> 117 array(2) { 118 ["id"]=> 119 int(4) 120 [0]=> 121 int(4) 122 } 123 [2]=> 124 array(2) { 125 ["id"]=> 126 int(4) 127 [0]=> 128 int(4) 129 } 130 [3]=> 131 array(2) { 132 ["id"]=> 133 int(5) 134 [0]=> 135 int(5) 136 } 137} 138int(-1) 139bool(true) 140int(4) 141bool(true) 142int(-1) 143bool(false) 144int(-1) 145bool(false) 146