12pg_insert_9.phpt 842 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. PostgreSQL pg_insert() (9.0+)
  3. --SKIPIF--
  4. <?php
  5. include("skipif.inc");
  6. skip_bytea_not_hex();
  7. ?>
  8. --FILE--
  9. <?php
  10. error_reporting(E_ALL);
  11. include 'config.inc';
  12. $db = pg_connect($conn_str);
  13. pg_query($db, "SET standard_conforming_strings = 0");
  14. $fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB');
  15. pg_insert($db, $table_name, $fields) or print "Error in test 1\n";
  16. echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n";
  17. echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING|PGSQL_DML_ESCAPE)."\n";
  18. var_dump( pg_insert($db, $table_name, $fields, PGSQL_DML_EXEC) ); // Return resource
  19. echo "Ok\n";
  20. ?>
  21. --EXPECTF--
  22. INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES (1234,E'AAA',E'\\x424242');
  23. INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES ('1234','AAA','BBB');
  24. resource(%d) of type (pgsql result)
  25. Ok