Annotation of embedaddon/php/ext/pgsql/tests/bug37100.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Bug #37100 (data is returned truncated with BINARY CURSOR)
                      3: --SKIPIF--
                      4: <?php
                      5: include("skipif.inc");
1.1.1.2 ! misho       6: skip_bytea_not_escape();
1.1       misho       7: ?>
                      8: --FILE--
                      9: <?php
                     10: 
                     11: include 'config.inc';
                     12: 
                     13: $db = pg_connect($conn_str);
1.1.1.2 ! misho      14: @pg_query("SET bytea_output = 'escape'");
1.1       misho      15: 
                     16: @pg_query('DROP TABLE test_bug');
                     17: 
                     18: pg_query('CREATE TABLE test_bug (binfield byteA) ;');
                     19: pg_query("INSERT INTO test_bug VALUES (decode('0103AA000812','hex'))");
                     20: 
                     21: 
                     22: $data = pg_query("SELECT binfield FROM test_bug");
                     23: $res = pg_fetch_result($data,0);
                     24: var_dump($res);
                     25: var_dump(bin2hex(pg_unescape_bytea($res)));
                     26: 
                     27: $sql = "BEGIN; DECLARE mycursor BINARY CURSOR FOR SELECT binfield FROM test_bug; FETCH ALL IN mycursor;";
                     28: 
                     29: $data = pg_query($sql);
                     30: $res = pg_fetch_result($data,0);
                     31: 
                     32: var_dump(strlen($res));
                     33: var_dump(bin2hex($res));
                     34: 
                     35: pg_close($db);
                     36: 
                     37: $db = pg_connect($conn_str);
                     38: pg_query('DROP TABLE test_bug');
                     39: pg_close($db);
                     40: 
                     41: 
                     42: ?>
                     43: --EXPECT--
                     44: string(24) "\001\003\252\000\010\022"
                     45: string(12) "0103aa000812"
                     46: int(6)
                     47: string(12) "0103aa000812"

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