xref: /PHP-5.3/ext/sqlite/tests/sqlite_017.phpt (revision 610c7fbe)
1--TEST--
2sqlite: UDF binary handling functions
3--SKIPIF--
4<?php # vim:ft=php
5if (!extension_loaded("sqlite")) print "skip"; ?>
6--FILE--
7<?php
8
9$data = array(
10	"hello there",
11	"this has a \x00 char in the middle",
12	"\x01 this has an 0x01 at the start",
13	"this has \x01 in the middle"
14	);
15
16foreach ($data as $item) {
17	$coded = sqlite_udf_encode_binary($item);
18	echo bin2hex($coded) . "\n";
19	$decoded = sqlite_udf_decode_binary($coded);
20	if ($item != $decoded) {
21		echo "FAIL! $item decoded is $decoded\n";
22	}
23}
24
25echo "OK!\n";
26
27?>
28--EXPECT--
2968656c6c6f207468657265
300101736768721f6760721f601fff1f626760711f686d1f7367641f6c6863636b64
310102ff1e726667711e665f711e5f6c1e2e762e2f1e5f721e7266631e71725f7072
327468697320686173200120696e20746865206d6964646c65
33OK!
34