1--TEST--
2PDO_DBLIB: driver supports a batch of queries containing SELECT, INSERT, UPDATE statements
3--SKIPIF--
4<?php
5if (!extension_loaded('pdo_dblib')) die('skip not loaded');
6require dirname(__FILE__) . '/config.inc';
7
8if (!driver_supports_batch_statements_without_select($db)) die('xfail test will fail with this version of FreeTDS');
9?>
10--FILE--
11<?php
12require dirname(__FILE__) . '/config.inc';
13
14$stmt = $db->query(
15"create table #php_pdo(id int);" .
16"insert into #php_pdo values(1), (2), (3);" .
17"select * from #php_pdo;" .
18"update #php_pdo set id = 4;" .
19"delete from #php_pdo;" .
20"select * from #php_pdo;" .
21"drop table #php_pdo;"
22);
23
24// check results from the create table
25var_dump($stmt->rowCount());
26var_dump($stmt->nextRowset());
27
28// check results from the first insert
29var_dump($stmt->rowCount());
30var_dump($stmt->nextRowset());
31
32// check results from the select
33var_dump($stmt->rowCount());
34var_dump($stmt->nextRowset());
35
36// check results from the update
37var_dump($stmt->rowCount());
38var_dump($stmt->nextRowset());
39
40// check results from the delete
41var_dump($stmt->rowCount());
42var_dump($stmt->nextRowset());
43
44// check results from the select
45var_dump($stmt->rowCount());
46var_dump($stmt->nextRowset());
47
48// check results from the drop
49var_dump($stmt->rowCount());
50var_dump($stmt->nextRowset());
51
52// check that there are no more results
53var_dump($stmt->rowCount());
54var_dump($stmt->nextRowset());
55
56?>
57--EXPECT--
58int(-1)
59bool(true)
60int(3)
61bool(true)
62int(-1)
63bool(true)
64int(3)
65bool(true)
66int(3)
67bool(true)
68int(0)
69bool(true)
70int(-1)
71bool(false)
72int(-1)
73bool(false)
74