tony2001 Tue Mar 21 15:07:15 2006 UTC
Modified files:
/php-src/ext/oci8 oci8_lob.c
Log:
reimplement php_oci_lob_read() and fix PECL bug #5995
now the function dosn't try to read data by blocks, as this is nearly
impossible
to do with Unicode and regular LOBs in the same time
http://cvs.php.net/viewcvs.cgi/php-src/ext/oci8/oci8_lob.c?r1=1.10&r2=1.11&diff_format=u
Index: php-src/ext/oci8/oci8_lob.c
diff -u php-src/ext/oci8/oci8_lob.c:1.10 php-src/ext/oci8/oci8_lob.c:1.11
--- php-src/ext/oci8/oci8_lob.c:1.10 Sun Feb 19 00:55:20 2006
+++ php-src/ext/oci8/oci8_lob.c Tue Mar 21 15:07:14 2006
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_lob.c,v 1.10 2006/02/19 00:55:20 andi Exp $ */
+/* $Id: oci8_lob.c,v 1.11 2006/03/21 15:07:14 tony2001 Exp $ */
@@ -150,7 +150,6 @@
{
php_oci_connection *connection = descriptor->connection;
ub4 length = 0;
- ub4 block_length = PHP_OCI_LOB_BUFFER_SIZE;
int bytes_read, bytes_total = 0, offset = 0, data_len_chars = 0;
int requested_len = read_length; /* this is by default */
@@ -178,14 +177,10 @@
requested_len = length - initial_offset;
}
- if (requested_len == 0) {
+ if (requested_len <= 0) {
return 0;
}
- if (requested_len < block_length) {
- block_length = requested_len;
- }
-
if (descriptor->type == OCI_DTYPE_FILE) {
connection->errcode = PHP_OCI_CALL(OCILobFileOpen,
(connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
@@ -196,10 +191,14 @@
}
}
- *data = (char *)emalloc(block_length + 1);
- bytes_read = block_length;
+ *data = (char *)emalloc(requested_len + 1);
+ bytes_read = requested_len;
offset = initial_offset;
+ /* TODO
+ * We need to make sure this function works with Unicode LOBs
+ * */
+
do {
connection->errcode = PHP_OCI_CALL(OCILobRead,
(
@@ -209,7 +208,7 @@
&bytes_read,
/* IN/OUT bytes toread/read */
offset + 1,
/* offset (starts with 1) */
(dvoid *) ((char *) *data + *data_len),
- block_length,
/* size of buffer */
+ requested_len,
/* size of buffer */
(dvoid *)0,
(OCICallbackLobRead) 0,
/* callback... */
(ub2) connection->charset, /* The
character set ID of the buffer data. */
@@ -225,7 +224,6 @@
offset = initial_offset + data_len_chars;
*data_len += bytes_read;
- block_length = PHP_OCI_LOB_BUFFER_SIZE;
if (connection->errcode != OCI_NEED_DATA) {
break;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php