Annotation of embedaddon/php/ext/pdo_firebird/tests/rowCount.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: PDO_Firebird: rowCount
! 3: --SKIPIF--
! 4: <?php extension_loaded("pdo_firebird") or die("skip"); ?>
! 5: --FILE--
! 6: <?php /* $Id: rowCount.phpt 316542 2011-09-12 13:43:42Z mariuz $ */
! 7:
! 8: require("testdb.inc");
! 9:
! 10: $dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die;
! 11:
! 12: @$dbh->exec('DROP TABLE testz');
! 13: $dbh->exec('CREATE TABLE testz (A VARCHAR(10))');
! 14: $dbh->exec("INSERT INTO testz VALUES ('A')");
! 15: $dbh->exec("INSERT INTO testz VALUES ('A')");
! 16: $dbh->exec("INSERT INTO testz VALUES ('B')");
! 17: $dbh->commit();
! 18:
! 19: $query = "SELECT * FROM testz WHERE A = ?";
! 20:
! 21: $stmt = $dbh->prepare($query);
! 22: $stmt->execute(array('A'));
! 23: $rows = $stmt->fetch();
! 24: $rows = $stmt->fetch();
! 25: var_dump($stmt->fetch());
! 26: var_dump($stmt->rowCount());
! 27:
! 28: $stmt = $dbh->prepare('UPDATE testZ SET A="A" WHERE A != ?');
! 29: $stmt->execute(array('A'));
! 30: var_dump($stmt->rowCount());
! 31: $dbh->commit();
! 32:
! 33: $stmt = $dbh->prepare('DELETE FROM testz');
! 34: $stmt->execute();
! 35: var_dump($stmt->rowCount());
! 36:
! 37: $dbh->commit();
! 38:
! 39: $dbh->exec('DROP TABLE testz');
! 40:
! 41: unset($stmt);
! 42: unset($dbh);
! 43:
! 44: ?>
! 45: --EXPECT--
! 46: bool(false)
! 47: int(2)
! 48: int(1)
! 49: int(3)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>