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