summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThies C. Arntzen <thies@php.net>1999-09-17 08:25:03 +0000
committerThies C. Arntzen <thies@php.net>1999-09-17 08:25:03 +0000
commit128b733ecaf76fa35c9c46017624e895a0439690 (patch)
tree8911ed18b86d0b20641a94a7c2a4fe164b6f5ae5
parent5a5646dce11d5cc3bfbc3feaac5b4f48db6e50f7 (diff)
downloadphp-git-128b733ecaf76fa35c9c46017624e895a0439690.tar.gz
fix #2316 - fetching empty LOBs via OCI8
-rw-r--r--ChangeLog1
-rw-r--r--ext/oci8/oci8.c18
2 files changed, 12 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index eecac500ef..718604eba0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@ PHP 4.0 CHANGE LOG ChangeLog
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ?? 1999, Version 4.0 Beta 3
+- OCI8 fix for fetching empty LOBs (Thies)
- Added user-level callbacks for session module (Sascha)
- Added support for unknown POST content types (Zeev)
- Added "wddx" serialization handler for session module (Sascha)
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index a8bc112b68..18ec63eb5f 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -100,7 +100,6 @@ DLEXPORT php3_module_entry *get_module() { return &oci_module_entry; };
/* }}} */
/* {{{ startup/shutdown/info/internal function prototypes */
-
PHP_MINIT_FUNCTION(oci);
PHP_RINIT_FUNCTION(oci);
PHP_MSHUTDOWN_FUNCTION(oci);
@@ -818,7 +817,7 @@ oci_make_pval(pval *value,oci_statement *statement,oci_out_column *column, char
loblen = oci_loadlob(statement->conn,descr,&buffer);
- if (loblen > 0) {
+ if (loblen >= 0) {
value->type = IS_STRING;
value->value.str.len = loblen;
value->value.str.val = buffer;
@@ -1354,12 +1353,17 @@ oci_loadlob(oci_connection *connection, oci_descriptor *mydescr, char **buffer)
if (connection->error) {
oci_error(connection->pError, "OCILobGetLength", connection->error);
- return 0;
+ return -1;
}
*buffer = emalloc(loblen + 1);
if (! buffer) {
+ return -1;
+ }
+
+ if (loblen == 0) {
+ (*buffer)[ 0 ] = 0;
return 0;
}
@@ -1372,7 +1376,7 @@ oci_loadlob(oci_connection *connection, oci_descriptor *mydescr, char **buffer)
if (connection->error) {
oci_error(connection->pError, "OCILobFileOpen",connection->error);
efree(buffer);
- return 0;
+ return -1;
}
}
@@ -1392,7 +1396,7 @@ oci_loadlob(oci_connection *connection, oci_descriptor *mydescr, char **buffer)
if (connection->error) {
oci_error(connection->pError, "OCILobRead", connection->error);
efree(buffer);
- return 0;
+ return -1;
}
if (mydescr->type == OCI_DTYPE_FILE) {
@@ -1403,7 +1407,7 @@ oci_loadlob(oci_connection *connection, oci_descriptor *mydescr, char **buffer)
if (connection->error) {
oci_error(connection->pError, "OCILobFileClose", connection->error);
efree(buffer);
- return 0;
+ return -1;
}
}
@@ -2624,7 +2628,7 @@ PHP_FUNCTION(ociloadlob)
loblen = oci_loadlob(connection,descr,&buffer);
- if (loblen > 0) {
+ if (loblen >= 0) {
RETURN_STRINGL(buffer,loblen,0);
}
}