diff options
author | SVN Migration <svn@php.net> | 2004-01-25 12:03:25 +0000 |
---|---|---|
committer | SVN Migration <svn@php.net> | 2004-01-25 12:03:25 +0000 |
commit | 22476b36ce621bdd115493bab84cbe706e422a7c (patch) | |
tree | 1124d1c5af68860a78c2252bb0dac63c9f18156e /ext/pgsql/tests/08escape.phpt | |
parent | eb7aca4ea896b09cb9afc2466a46f4720acc4a4e (diff) | |
download | php-git-php_ibase_before_split.tar.gz |
This commit was manufactured by cvs2svn to create tagphp_ibase_before_split
'php_ibase_before_split'.
Diffstat (limited to 'ext/pgsql/tests/08escape.phpt')
-rw-r--r-- | ext/pgsql/tests/08escape.phpt | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/ext/pgsql/tests/08escape.phpt b/ext/pgsql/tests/08escape.phpt deleted file mode 100644 index c5a3877e37..0000000000 --- a/ext/pgsql/tests/08escape.phpt +++ /dev/null @@ -1,69 +0,0 @@ ---TEST-- -PostgreSQL escape functions ---SKIPIF-- -<?php include("skipif.inc"); ?> ---FILE-- -<?php - -include 'config.inc'; -define('FILE_NAME', dirname(__FILE__) . '/php.gif'); - -// pg_escape_string() test -$before = "ABC\\ABC\'"; -$expect = "ABC\\\\ABC\\'"; -$after = pg_escape_string($before); -if ($expect === $after) { - echo "pg_escape_string() is Ok\n"; -} -else { - echo "pg_escape_string() is NOT Ok\n"; - var_dump($before); - var_dump($after); - var_dump($expect); -} - -// pg_escape_bytea() test -$before = "ABC\\ABC"; -$expect = "ABC\\\\\\\\ABC"; -$after = pg_escape_bytea($before); -if ($expect === $after) { - echo "pg_escape_bytea() is Ok\n"; -} -else { - echo "pg_escape_byte() is NOT Ok\n"; - var_dump($before); - var_dump($after); - var_dump($expect); -} - -// Test using database -$data = file_get_contents(FILE_NAME); -$db = pg_connect($conn_str); - -// Insert binary to DB -$escaped_data = pg_escape_bytea($data); -pg_query("DELETE FROM ".$table_name." WHERE num = -9999;"); -$sql = "INSERT INTO ".$table_name." (num, bin) VALUES (-9999, CAST ('".$escaped_data."' AS BYTEA));"; -pg_query($db, $sql); - -// Retrieve binary from DB -$sql = "SELECT bin::bytea FROM ".$table_name." WHERE num = -9999"; -$result = pg_query($db, $sql); -$row = pg_fetch_array($result, 0, PGSQL_ASSOC); - -// Compare -// Need to wait PostgreSQL 7.3.x for PQunescapeBytea() -// if ($data === pg_unescape_bytea($row['bin'])) { -// echo "pg_escape_bytea() actually works with databse\n"; -// } -// else { -// echo "pg_escape_bytea() is broken\n"; -// } - -?> ---EXPECT-- -pg_escape_string() is NOT Ok -string(9) "ABC\ABC\'" -string(12) "ABC\\ABC\\''" -string(10) "ABC\\ABC\'" -pg_escape_bytea() is Ok |