File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / pgsql / tests / bug37100.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 08:02:28 2013 UTC (10 years, 9 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, HEAD
v 5.4.20

--TEST--
Bug #37100 (data is returned truncated with BINARY CURSOR)
--SKIPIF--
<?php
include("skipif.inc");
skip_bytea_not_escape();
?>
--FILE--
<?php

include 'config.inc';

$db = pg_connect($conn_str);
@pg_query("SET bytea_output = 'escape'");

@pg_query('DROP TABLE test_bug');

pg_query('CREATE TABLE test_bug (binfield byteA) ;');
pg_query("INSERT INTO test_bug VALUES (decode('0103AA000812','hex'))");


$data = pg_query("SELECT binfield FROM test_bug");
$res = pg_fetch_result($data,0);
var_dump($res);
var_dump(bin2hex(pg_unescape_bytea($res)));

$sql = "BEGIN; DECLARE mycursor BINARY CURSOR FOR SELECT binfield FROM test_bug; FETCH ALL IN mycursor;";

$data = pg_query($sql);
$res = pg_fetch_result($data,0);

var_dump(strlen($res));
var_dump(bin2hex($res));

pg_close($db);

$db = pg_connect($conn_str);
pg_query('DROP TABLE test_bug');
pg_close($db);


?>
--EXPECT--
string(24) "\001\003\252\000\010\022"
string(12) "0103aa000812"
int(6)
string(12) "0103aa000812"

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