ID:               27485
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jseverson at myersinternet dot com
-Status:           Open
+Status:           Assigned
-Bug Type:         OCI8 related
+Bug Type:         Feature/Change Request
 Operating System: Redhat Linux kernel 2.4.18-3
 PHP Version:      4.3.4
-Assigned To:      
+Assigned To:      tony2001
 New Comment:

I would classify this as a feature request then, assinging to the the
maintainer, Antony.


Previous Comments:
------------------------------------------------------------------------

[2004-03-05 14:36:00] jseverson at myersinternet dot com

After several more hours of investigating, we have determined that our
first hypothesis was not true. I am not quite sure this is still a PHP
bug or not, as it seems like is more a case of a behavior of Oracle.
Here is a script I've setup to demonstrate the behavior:



http://test1.myersinternet.com/php_test/test_clobs.html



To briefly summarize, a clob can exist in two states, both of which
APPEAR to be "null" when viewing the clob in TOAD, TORA, or SQLPLUS. In
one state, the clob is actually "null", which is the case where the
column is ommitted completely when doing an insert. The second case,
the clob is an "empty locator", which is the case when specifying the
column in the insert, using the empty_clob() function, but then not
performing a save on the oci descriptor. My script demonstrates both of
these cases and their output.



Oracle Documentation explaining this behavior:



http://download-west.oracle.com/docs/cd/A87860_01/doc/appdev.817/a76940/adl02bs5.htm#117091



"You can set an internal LOB -- that is, a LOB column in a table, or a
LOB attribute in an object type defined by you-- to be NULL or empty: 



Setting an Internal LOB to NULL: A LOB set to NULL has no locator. A
NULL value is stored in the row in the table, not a locator. This is
the same process as for all other datatypes. 



Setting an Internal LOB to Empty: By contrast, an empty LOB stored in a
table is a LOB of zero length that has a locator. So, if you SELECT
from an empty LOB column or attribute, you get back a locator which you
can use to populate the LOB with data via one of the six programmatic
environments, such as OCI or PL/SQL(DBMS_LOB)."



It would be NICE if PHP had a method of saving null into your
descriptor so that you can keep your clobs consistent, since the
presence of empty locators behave differently when selecting from them
as compared with null clobs.

------------------------------------------------------------------------

[2004-03-05 02:42:00] [EMAIL PROTECTED]

The same results(i.e. allright) with 4.3.4.

By the way, PHP 4.3.4 was released before all these changes you're
talking about, in the early november, 2003.

------------------------------------------------------------------------

[2004-03-04 12:22:05] jseverson at myersinternet dot com

Can you please try PHP version 4.3.4? We looked at the CVS log for the
OCI changes done and it looks like a lot of work was done in December,
2003 dealing with LOBs, which wouldn't be present in 4.3.3.



Thanks

------------------------------------------------------------------------

[2004-03-04 01:59:26] [EMAIL PROTECTED]

I can't get your results with this code.

In both cases I get empty arrays, if OCI_RETURN_NULLS wasn't used or
array of NULLs, if it was.

Tested with PHP5-cvs, PHP4-cvs, PHP4.3.3.

------------------------------------------------------------------------

[2004-03-03 19:27:08] jseverson at myersinternet dot com

That does make it so that the var_dump at least shows the null clob
column being captured in my result set, but the value of that column is
"Null" rather than an Object:



array(1) {

  ["CLOB_1"]=>

  NULL

}

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/27485

-- 
Edit this bug report at http://bugs.php.net/?id=27485&edit=1

Reply via email to