ID: 38905 Updated by: [EMAIL PROTECTED] Reported By: david at acz dot org -Status: Open +Status: Feedback Bug Type: OCI8 related Operating System: SuSE Linux PHP Version: 5.1.6 New Comment:
Please try OCI8 from PECL: http://pecl.php.net/oci8 Previous Comments: ------------------------------------------------------------------------ [2006-09-20 18:39:41] david at acz dot org Description: ------------ RAW columns are sometimes returned as binary and sometimes as hex. When this happens seems to be dependent on the driver version, but I don't know of a reliably way to detect this in application code. The 9.2 client returns hex. The 10.2 instant client returns binary. Reproduce code: --------------- echo "PHP " . PHP_VERSION . "\n"; $db = oci_connect($user, $pass, $tns); echo oci_server_version($db) . "\n"; $st = oci_parse($db, "SELECT x FROM raw_test ORDER BY x"); oci_execute($st); echo "type: " . oci_field_type($st, 1) . "\n"; echo "type_raw: " . oci_field_type_raw($st, 1) . "\n"; echo "size: " . oci_field_size($st, 1) . "\n"; oci_fetch_all($st, $x, 0, -1, OCI_FETCHSTATEMENT_BY_ROW | OCI_NUM); foreach ($x as $i) var_dump($i[0]); ob_start(); phpinfo(); $x = strip_tags(ob_get_contents()); ob_end_clean(); $x = explode("\n", $x); foreach ($x as $i) if (substr($i, 0, 7) == "Oracle ") echo "$i\n"; Expected result: ---------------- Create a test table: CREATE TABLE raw_test (x RAW(4) NOT NULL); INSERT INTO raw_test VALUES('54455354'); INSERT INTO raw_test VALUES('424C4148'); INSERT INTO raw_test VALUES('61626364'); Actual result: -------------- First machine: PHP 5.1.2 Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production With the Partitioning, OLAP and Data Mining options type: RAW type_raw: 23 size: 4 string(8) "424C4148" string(8) "54455354" string(8) "61626364" Oracle Version 9.2 Second machine: PHP 5.1.6 Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production With the Partitioning, OLAP and Data Mining options type: RAW type_raw: 23 size: 4 string(4) "BLAH" string(4) "TEST" string(4) "abcd" Oracle Instant Client Version 10.2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38905&edit=1