Doc #68537 [Opn]: oci_bind_by_name() should provide unity length description

From: Date: Tue, 02 Dec 2014 22:25:55 +0000
Subject: Doc #68537 [Opn]: oci_bind_by_name() should provide unity length description
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-11716@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68537&edit=1 ID: 68537 Updated by: sixd@php.net Reported by: ikonta at yandex dot ru Summary: oci_bind_by_name() should provide unity length description Status: Open Type: Documentation Problem Package: Documentation problem Operating System: Gentoo GNU/Linux PHP Version: 5.4.35 -Assigned To: +Assigned To: sixd Block user comment: N Private report: N New Comment: The PHP OCI8 bind lengths are bytes, as you noted. The underlying Oracle OCI C library documents this appropriately "This size is always expected to be the size in bytes". (http://docs.oracle.com/database/121/LNOCI/oci16rel003.htm#LNOCI17140) The PHP OCI8 doc needs to have similar wording. There are no plans to allow PHP OCI8 specify the size in characters. Previous Comments: ------------------------------------------------------------------------ [2014-12-02 08:32:49] ikonta at yandex dot ru Description: ------------ After migrating to UTF8, database provides two-way semantics for text data types: byte (for single byte encodings is a synonim of char) and char. http://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT012 Length field in oci_bind_by_name() function forcely expect byte data size. For now we should update documentation noting it. For future development, ma be it is reasonable to add a modifier to switch between char and byte semantics. SQL> CREATE TABLE EXAMPLE ( MESSAGE VARCHAR2(16 CHAR) NOT NULL ); Oracle's client locale is: NLS_LANG=RUSSIAN_RUSSIA.AL32UTF8 Test script: --------------- <?php require_once("../inc/conn.inc"); $conn = conn("UPO"); $var = "тест-тест"; $stid = oci_parse($conn, 'INSERT INTO EXAMPLE VALUES (:bv)'); oci_bind_by_name($stid, ':bv', $var, 9); if (oci_execute($stid)) { echo ("insert OK"); oci_free_statement($stid); oci_close($conn); } else echo ("insert failed"); ?> Expected result: ---------------- If client's locale is NLS_LANG=RUSSIAN_CIS.CL8ISO8859P5 properly encoded (translated from UTF8 back to ISO-8859-5) script works fine. I expect the same for modern UTF8 locale. Or at least proper description of issued function: what and how should be corrected. Actual result: -------------- If client is configured to use UTF8 locale, quoted script failes with ORA-01461 (can bind a LONG value only for insert into a LONG column) error. Originally it was find for binding output variables for call of PL/SQL procedure. In that case the error message was ORA-06525: Length Mismatch for CHAR or RAW data ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68537&edit=1

« previous php.doc.bugs (#11716) next »