Warning: PDOStatement::fetch() [<a href='pdostatement.fetch'>pdostatement.fetch</a>]: column 3 data was too large for buffer and was truncated to fit it in
问题,就是使用PDO_OCI 从Oracle 中取数据,报错或是数据被截取了,显示不完整。像这样……
column XXX data was too large for buffer and was truncated to fit it in XXX
那么有两种方案
1 修改源码 oci_statement.c (估计很多人不敢动)
php-src 中有了一定解答-修改原文件,不过 修改 ext / pdo_oci / oci_statement.c
531-535行 https://github.com/php/php-src/pull/59/files
col->precision = scale;
- col->maxlen = data_size;
+ col->maxlen = ( data_size + 1 ) * sizeof(utext);
col->namelen = namelen;
col->name = estrndup((char *)colname, namelen);
这种方式进行修改。据说是有用的 但是看过https://github.com/php/php-src/pull/59 github上并没有被采纳,说明还是有一定的问题。
2 通过sql 处理
那么,幸好 仔细读了读了找着了https://bugs.php.net/bug.php?id=35003
We found a "solution" to get it work: select cast( tbl.description AS
varchar2(300) )as desc FROM database.table tbl;
使用 oracle 的 cast()函数进行转换 ,这样就可以了 IT Work !
//--------------------------------------------------------------------
其他:关于 utext 是个啥? 或许是吧,就是转ut8用的??
http://code.metager.de/source/xref/WebKit/Source/WebCore/icu/unicode/utext.h
http://userguide.icu-project.org/strings/utext
UText is a text abstraction facility for ICU
The intent is to make it possible to extend ICU to work with text data that is in formats above and beyond those that are native to ICU.
UText makes it possible to extend ICU to work with text that
Is stored in UTF-8 or UTF-32 format.
Is in strings that are stored in discontiguous chunks in memory, or in application-specific representations.
Is in a non-Unicode code page