pg_insert_001.phpt 917 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. PostgreSQL pg_select() - basic test using schema
  3. --EXTENSIONS--
  4. pgsql
  5. --SKIPIF--
  6. <?php include("skipif.inc"); ?>
  7. --FILE--
  8. <?php
  9. include('config.inc');
  10. $conn = pg_connect($conn_str);
  11. pg_query($conn, 'CREATE SCHEMA phptests');
  12. pg_query($conn, 'CREATE TABLE phptests.foo (id INT, id2 INT)');
  13. pg_insert($conn, 'foo', array('id' => 1, 'id2' => 1));
  14. pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2));
  15. var_dump(pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2), PGSQL_DML_STRING));
  16. var_dump(pg_select($conn, 'phptests.foo', array('id' => 1)));
  17. pg_query($conn, 'DROP TABLE phptests.foo');
  18. pg_query($conn, 'DROP SCHEMA phptests');
  19. ?>
  20. --EXPECTF--
  21. Warning: pg_insert(): Table 'foo' doesn't exists in %s on line %d
  22. string(55) "INSERT INTO "phptests"."foo" ("id","id2") VALUES (1,2);"
  23. array(1) {
  24. [0]=>
  25. array(2) {
  26. ["id"]=>
  27. string(1) "1"
  28. ["id2"]=>
  29. string(1) "2"
  30. }
  31. }