1--TEST--
2PDO_DBLIB: driver supports a batch of queries containing SELECT, INSERT, UPDATE 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"insert into #php_pdo values(1), (2), (3);" .
18"select * from #php_pdo;" .
19"update #php_pdo set id = 4;" .
20"delete from #php_pdo;" .
21"select * from #php_pdo;" .
22"drop table #php_pdo;"
23);
24
25// check results from the create table
26var_dump($stmt->rowCount());
27var_dump($stmt->nextRowset());
28
29// check results from the first insert
30var_dump($stmt->rowCount());
31var_dump($stmt->nextRowset());
32
33// check results from the select
34var_dump($stmt->rowCount());
35var_dump($stmt->nextRowset());
36
37// check results from the update
38var_dump($stmt->rowCount());
39var_dump($stmt->nextRowset());
40
41// check results from the delete
42var_dump($stmt->rowCount());
43var_dump($stmt->nextRowset());
44
45// check results from the select
46var_dump($stmt->rowCount());
47var_dump($stmt->nextRowset());
48
49// check results from the drop
50var_dump($stmt->rowCount());
51var_dump($stmt->nextRowset());
52
53// check that there are no more results
54var_dump($stmt->rowCount());
55var_dump($stmt->nextRowset());
56
57?>
58--EXPECT--
59int(-1)
60bool(true)
61int(3)
62bool(true)
63int(-1)
64bool(true)
65int(3)
66bool(true)
67int(3)
68bool(true)
69int(0)
70bool(true)
71int(-1)
72bool(false)
73int(-1)
74bool(false)
75