CGridView (through PDO) is not able to fetch simple data set from Oracle DB

I have a very simple test user table (36 columns and 12 records) in my Oracle database. Column no 24 is a simple description defined as VARCHAR2(100 BYTE) nullable. For this table I’ve generated basic CRUD set using gii.

I’m put a string around 99-100 characters length, containing some national characters, using Oracle SQL Developer and simple UPDATE SQL query.

When I go to index containing CGridView, generated by gii, I’m getting exception “PDOStatement::fetchAll() [pdostatement.fetchall]: column 24 data was too large for buffer and was truncated to fit it”.

I did some research and found out that this error is specifically related with national characters. When I put string containing 100 "x" letters, the same way as above, I got not exception at all.

What surprised me the most, is though exception message suggest that it is PDO, not Yii problem, it turned out that I’m getting this exception only for CGridView. Using exactly the same dataset in CDetailView (view action out of generated gii CRUD set) all the data is perfectly retrieved and displayed.

Can anyone tell me, what could cause this situation and why it only relates to CGridView, not all Yii components? And does anyone have any idea for a workaround for this?

And finally, forgive me for a dumb question, but what the heck this error message exactly means? If “data was too large for buffer and was truncated to fit it” then, why the hell I’m getting exception instead of truncated dataset? What, in my opinion, this error message suggests.

This PHP bug report contains possible solution (patch) to described problem:

# diff -u oci_statement.c 

--- oci_statement.c 	2011-08-06 01:07:53.000000000 -0700

+++ 2011-08-06 01:08:03.000000000 -0700

@@ -529,7 +529,7 @@

                    	(param, OCI_DTYPE_PARAM, &colname, &namelen, OCI_ATTR_NAME, S->err));


    	col->precision = scale;

-   	col->maxlen = data_size;

+   	col->maxlen = ( data_size + 1 ) * sizeof(utext);

    	col->namelen = namelen;

    	col->name = estrndup((char *)colname, namelen);

Though it requires C/C++ compiler and recompilation of oci.dll, therefore I was not able to test it live.