Patch oci_statement.c.diff for PDO OCI Bug #39199
Patch version 2010-12-07 07:42 UTC
Return to Bug #39199 |
Download this patch
Patch Revisions:
Developer: yes@example.com
Index: oci_statement.c
===================================================================
--- oci_statement.c (revision 306044)
+++ oci_statement.c (working copy)
@@ -634,11 +634,14 @@
&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 +667,17 @@
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 >= 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 +685,7 @@
oci_blob_close,
oci_blob_flush,
"pdo_oci blob stream",
- NULL, /*oci_blob_seek,*/
+ oci_blob_seek,
NULL,
NULL,
NULL
|