diff options
author | Felipe Pena <felipe@php.net> | 2010-12-10 00:33:48 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2010-12-10 00:33:48 +0000 |
commit | 573475a8489efa19e0cff69c20bd33bf8ccd79da (patch) | |
tree | dee52b0347f3ea97ffd9c0173bd1bad68af7e97e /ext/pdo_oci/oci_statement.c | |
parent | 7eb70247a32f84b561ed341fecb0532a2997ed48 (diff) | |
download | php-git-573475a8489efa19e0cff69c20bd33bf8ccd79da.tar.gz |
- Fixed bug #39199 (Cannot load Lob data with more than 4000 bytes on ORACLE 10)
patch by: spatar at mail dot nnov dot ru
Diffstat (limited to 'ext/pdo_oci/oci_statement.c')
-rwxr-xr-x | ext/pdo_oci/oci_statement.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c index 8b0452a957..df07327949 100755 --- a/ext/pdo_oci/oci_statement.c +++ b/ext/pdo_oci/oci_statement.c @@ -31,6 +31,8 @@ #include "php_pdo_oci_int.h" #include "Zend/zend_extensions.h" +#define PDO_OCI_LOBMAXSIZE (4294967295UL) /* OCI_LOBMAXSIZE */ + #define STMT_CALL(name, params) \ do { \ S->last_err = name params; \ @@ -634,11 +636,14 @@ static size_t oci_blob_read(php_stream *stream, char *buf, size_t count TSRMLS_D &amt, self->offset, buf, count, NULL, NULL, 0, SQLCS_IMPLICIT); - if (r != OCI_SUCCESS) { + if (r != OCI_SUCCESS && r != OCI_NEED_DATA) { return (size_t)-1; } self->offset += amt; + if (amt < count) { + stream->eof = 1; + } return amt; } @@ -664,14 +669,17 @@ static int oci_blob_flush(php_stream *stream TSRMLS_DC) return 0; } -/* TODO: implement static int oci_blob_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC) { struct oci_lob_self *self = (struct oci_lob_self*)stream->abstract; - return -1; + if (offset >= PDO_OCI_LOBMAXSIZE) { + return -1; + } else { + self->offset = offset + 1; /* Oracle LOBS are 1-based, but PHP is 0-based */ + return 0; + } } -*/ static php_stream_ops oci_blob_stream_ops = { oci_blob_write, @@ -679,7 +687,7 @@ static php_stream_ops oci_blob_stream_ops = { oci_blob_close, oci_blob_flush, "pdo_oci blob stream", - NULL, /*oci_blob_seek,*/ + oci_blob_seek, NULL, NULL, NULL |