rowCount.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --TEST--
  2. PDO_Firebird: rowCount
  3. --SKIPIF--
  4. <?php extension_loaded("pdo_firebird") or die("skip"); ?>
  5. <?php function_exists("ibase_query") or die("skip"); ?>
  6. --FILE--
  7. <?php /* $Id$ */
  8. require("testdb.inc");
  9. $dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die;
  10. @$dbh->exec('DROP TABLE testz');
  11. $dbh->exec('CREATE TABLE testz (A VARCHAR(10))');
  12. $dbh->exec("INSERT INTO testz VALUES ('A')");
  13. $dbh->exec("INSERT INTO testz VALUES ('A')");
  14. $dbh->exec("INSERT INTO testz VALUES ('B')");
  15. $dbh->commit();
  16. $query = "SELECT * FROM testz WHERE A = ?";
  17. $stmt = $dbh->prepare($query);
  18. $stmt->execute(array('A'));
  19. $rows = $stmt->fetch();
  20. $rows = $stmt->fetch();
  21. var_dump($stmt->fetch());
  22. var_dump($stmt->rowCount());
  23. $stmt = $dbh->prepare('UPDATE testZ SET A="A" WHERE A != ?');
  24. $stmt->execute(array('A'));
  25. var_dump($stmt->rowCount());
  26. $dbh->commit();
  27. $stmt = $dbh->prepare('DELETE FROM testz');
  28. $stmt->execute();
  29. var_dump($stmt->rowCount());
  30. $dbh->commit();
  31. $dbh->exec('DROP TABLE testz');
  32. unset($stmt);
  33. unset($dbh);
  34. ?>
  35. --EXPECT--
  36. bool(false)
  37. int(2)
  38. int(1)
  39. int(3)