Bug #14922 Updated: OCIBindByName forcing length to 1, even though 0 is a valid length
| From: | thies@php.net | Date: | Tue, 08 Jan 2002 19:54:25 +0000 |
| Subject: | Bug #14922 Updated: OCIBindByName forcing length to 1, even though 0 is a valid length | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-76278@lists.php.net to get a copy of this message | ||
ID: 14922
Updated by: thies
Reported By: alester@flr.follett.com
Status: Closed
Bug Type: OCI8 related
Operating System: Solaris
PHP Version: 4.1.0
New Comment:
i'm pretty sure that the "If the value_sz parameter is zero, Oracle
treats the bind variable as a null" is a
new feature > 8.0. the "old" way is to set the indicator to -1 in the
bind-in callback, which is what the
oci8.c does.
i also believe that it makes way more sense to make the decision in the
ociexecute (by looking at the actual
php-variable) and not during bind for various reasons (think of mass
inserts using bound variables).
BTW: you are welcome to contribute the documentation for NULL binds.
Previous Comments:
------------------------------------------------------------------------
[2002-01-08 14:27:50] alester@flr.follett.com
Thies sent this to me:
to pass a null thru a bound variable simply assign the
special value NULL to the bound php-variable. the size
supplied to ocibindbyname is simple the max-length of the
inbound variable.
ocibindbyname($stmt,"NAME",$name,32);
$name = NULL;
ociexecute($stmt);
-> ":NAME" will have the value null in the query
please verify and close the report.
It seems incorrect to me to tweak a value that the underlying API
expects to be able to handle.
Also, this handling of NULL should be documented in the OCIBindByName
doc.
------------------------------------------------------------------------
[2002-01-07 18:37:16] alester@flr.follett.com
It seems that the when oci8.c forces value_sz to 1 if it's 0 is
bypassing a perfectly valid use of a length of 0: To signify a null.
See:
http://download-west.oracle.com/otndoc/oracle9i/901_doc/appdev.901/a89857/oci03typ.htm
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14922&edit=1