php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #39199
Patch pdo_oci_stream_1.phpt revision 2010-12-09 02:58 UTC by yes at example dot com
Patch pdo_oci_fread_1.phpt revision 2010-12-09 02:56 UTC by yes at example dot com
Patch pdo_oci_stream_1.php revision 2010-12-07 07:44 UTC by yes at example dot com
Patch oci_statement.c.diff revision 2010-12-07 07:42 UTC by yes at example dot com

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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 07 14:01:27 2024 UTC