summaryrefslogtreecommitdiff
path: root/ext/pdo_firebird/tests/rowCount.phpt
blob: bf0950f29bafdcb8bcd0a25335389ed96371f1e2 (plain)
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
--TEST--
PDO_Firebird: rowCount
--SKIPIF--
<?php extension_loaded("pdo_firebird") or die("skip"); ?>
<?php function_exists("ibase_query") or die("skip"); ?>
--FILE--
<?php

require("testdb.inc");

$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die;

@$dbh->exec('DROP TABLE testz');
$dbh->exec('CREATE TABLE testz (A VARCHAR(10))');
$dbh->exec("INSERT INTO testz VALUES ('A')");
$dbh->exec("INSERT INTO testz VALUES ('A')");
$dbh->exec("INSERT INTO testz VALUES ('B')");
$dbh->commit();

$query = "SELECT * FROM testz 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 testZ SET A="A" WHERE A != ?');
$stmt->execute(array('A'));
var_dump($stmt->rowCount());
$dbh->commit();

$stmt = $dbh->prepare('DELETE FROM testz');
$stmt->execute();
var_dump($stmt->rowCount());

$dbh->commit();

$dbh->exec('DROP TABLE testz');

unset($stmt);
unset($dbh);

?>
--EXPECT--
bool(false)
int(2)
int(1)
int(3)