1--TEST--
2PDO_Firebird: rowCount
3--EXTENSIONS--
4pdo_firebird
5--SKIPIF--
6<?php require('skipif.inc'); ?>
7--XLEAK--
8A bug in firebird causes a memory leak when calling `isc_attach_database()`.
9See https://github.com/FirebirdSQL/firebird/issues/7849
10--FILE--
11<?php
12
13require("testdb.inc");
14
15$dbh = getDbConnection();
16$dbh->exec('CREATE TABLE test_rowcount (A VARCHAR(10))');
17$dbh->exec("INSERT INTO test_rowcount VALUES ('A')");
18$dbh->exec("INSERT INTO test_rowcount VALUES ('A')");
19$dbh->exec("INSERT INTO test_rowcount VALUES ('B')");
20
21$query = "SELECT * FROM test_rowcount WHERE A = ?";
22
23$stmt = $dbh->prepare($query);
24$stmt->execute(array('A'));
25$rows = $stmt->fetch();
26$rows = $stmt->fetch();
27var_dump($stmt->fetch());
28var_dump($stmt->rowCount());
29
30$stmt = $dbh->prepare('UPDATE test_rowcount SET A="A" WHERE A != ?');
31$stmt->execute(array('A'));
32var_dump($stmt->rowCount());
33
34$stmt = $dbh->prepare('DELETE FROM test_rowcount');
35$stmt->execute();
36var_dump($stmt->rowCount());
37
38unset($stmt);
39unset($dbh);
40
41?>
42--CLEAN--
43<?php
44require 'testdb.inc';
45$dbh = getDbConnection();
46@$dbh->exec('DROP TABLE test_rowcount');
47unset($dbh);
48--EXPECT--
49bool(false)
50int(2)
51int(1)
52int(3)
53