oci_bind_by_name() should provide unity length description
| Doc Bug #68537 | oci_bind_by_name() should provide unity length description | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2014-12-02 08:32 UTC | Modified: | 2017-01-28 12:48 UTC |
|
||||||||||
| From: | ikonta at yandex dot ru | Assigned: | sixd (profile) | |||||||||||
| Status: | Assigned | Package: | OCI8 related | |||||||||||
| PHP Version: | 5.4.35 | OS: | Gentoo GNU/Linux | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2014-12-02 08:32 UTC] 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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2014-12-02 22:25 UTC] sixd@php.net
-Assigned To: +Assigned To: sixd
[2014-12-04 10:12 UTC] ikonta at yandex dot ru
[2017-01-28 12:48 UTC] cmb@php.net
-Package: Documentation problem +Package: OCI8 related