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