Annotation of embedaddon/php/ext/pgsql/tests/18pg_escape_bytea_before.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: PostgreSQL pg_escape_bytea() functions (before connection)
        !             3: --SKIPIF--
        !             4: <?php include("skipif.inc"); ?>
        !             5: --FILE--
        !             6: <?php
        !             7: // optional functions
        !             8: 
        !             9: include('config.inc');
        !            10: 
        !            11: $image = file_get_contents(dirname(__FILE__) . '/php.gif');
        !            12: $esc_image = pg_escape_bytea($image);
        !            13: 
        !            14: $db = pg_connect($conn_str);
        !            15: @pg_query($db, "SET bytea_output = 'escape'");
        !            16: 
        !            17: pg_query($db, 'INSERT INTO '.$table_name.' (num, bin) VALUES (9876, E\''.$esc_image.'\');');
        !            18: $result = pg_query($db, 'SELECT * FROM '.$table_name.' WHERE num = 9876');
        !            19: $rows = pg_fetch_all($result);
        !            20: $unesc_image = pg_unescape_bytea($rows[0]['bin']);
        !            21: 
        !            22: if ($unesc_image !== $image) {
        !            23:        echo "NG";
        !            24: }
        !            25: else {
        !            26:        echo "OK";
        !            27: }
        !            28: ?>
        !            29: --EXPECT--
        !            30: OK

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>