execute.phpt 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. --TEST--
  2. PDO_Firebird: prepare/execute/binding
  3. --SKIPIF--
  4. <?php include("skipif.inc"); ?>
  5. <?php function_exists("ibase_query") or die("skip"); ?>
  6. --INI--
  7. ibase.timestampformat=%Y-%m-%d %H:%M:%S
  8. --FILE--
  9. <?php /* $Id$ */
  10. require("testdb.inc");
  11. $db = new PDO("firebird:dbname=$test_base",$user,$password) or die;
  12. var_dump($db->getAttribute(PDO::ATTR_CONNECTION_STATUS));
  13. $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
  14. $db->exec("CREATE TABLE ddl (id SMALLINT NOT NULL PRIMARY KEY, text VARCHAR(32),
  15. datetime TIMESTAMP DEFAULT '2000-02-12' NOT NULL)");
  16. $db->exec("INSERT INTO ddl (id,text) VALUES (1,'bla')");
  17. $s = $db->prepare("SELECT * FROM ddl WHERE id=? FOR UPDATE");
  18. $id = 0;
  19. $s->bindParam(1,$id);
  20. $var = null;
  21. $s->bindColumn("TEXT",$var);
  22. $id = 1;
  23. $s->execute();
  24. $s->setAttribute(PDO::ATTR_CURSOR_NAME, "c");
  25. var_dump($id);
  26. var_dump($s->fetch());
  27. var_dump($var);
  28. var_dump($db->exec("UPDATE ddl SET id=2 WHERE CURRENT OF c"));
  29. var_dump($s->fetch());
  30. unset($s);
  31. unset($db);
  32. echo "done\n";
  33. ?>
  34. --EXPECT--
  35. bool(true)
  36. int(1)
  37. array(6) {
  38. ["ID"]=>
  39. string(1) "1"
  40. [0]=>
  41. string(1) "1"
  42. ["TEXT"]=>
  43. string(3) "bla"
  44. [1]=>
  45. string(3) "bla"
  46. ["DATETIME"]=>
  47. string(19) "2000-02-12 00:00:00"
  48. [2]=>
  49. string(19) "2000-02-12 00:00:00"
  50. }
  51. string(3) "bla"
  52. int(1)
  53. bool(false)
  54. done