summaryrefslogtreecommitdiff
path: root/ext/pgsql/tests
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2008-10-13 13:44:32 +0000
committerFelipe Pena <felipe@php.net>2008-10-13 13:44:32 +0000
commit310ac30e5ae0d8634f4f2d0eb458e0ab507c32d5 (patch)
tree4524820701ca4399efe14e427a468199f6541160 /ext/pgsql/tests
parent8f8f18bc181806f3386c94ccfab44843b043c8c5 (diff)
downloadphp-git-310ac30e5ae0d8634f4f2d0eb458e0ab507c32d5.tar.gz
MFH:
- Fixed bug #37100 (data is returned truncated with BINARY CURSOR) Patch by Tony
Diffstat (limited to 'ext/pgsql/tests')
-rw-r--r--ext/pgsql/tests/bug37100.phpt43
1 files changed, 43 insertions, 0 deletions
diff --git a/ext/pgsql/tests/bug37100.phpt b/ext/pgsql/tests/bug37100.phpt
new file mode 100644
index 0000000000..b66149e4a5
--- /dev/null
+++ b/ext/pgsql/tests/bug37100.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Bug #37100 (data is returned truncated with BINARY CURSOR)
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+include 'config.inc';
+
+$db = pg_connect($conn_str);
+
+@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"