Patch Lobfecthing for OCI8 related Bug #66875
Patch version 2014-03-10 09:41 UTC
Return to Bug #66875 |
Download this patch
Patch Revisions:
Developer: perrier.p@gmail.com
From 5ef9ff7b28f84f1c5468aec8e97c1e91528ca5bd Mon Sep 17 00:00:00 2001
From: tripollite <perrier.p@gmail.Com>
Date: Mon, 10 Mar 2014 10:28:39 +0100
Subject: [PATCH] Encrease lob fetching by x2
---
ext/oci8/oci8.c | 18 +++++++++++++++++-
ext/oci8/oci8_lob.c | 17 ++++++++---------
ext/oci8/php_oci8_int.h | 1 +
3 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 44bfa71..5d34fda 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -2522,8 +2522,24 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
if (column->data_type != SQLT_RDD && (mode & PHP_OCI_RETURN_LOBS)) {
/* PHP_OCI_RETURN_LOBS means that we want the content of the LOB back instead of the locator */
-
+ if(column->chunk_size)
+ descriptor->chunk_size = column->chunk_size;
+ if(column->charset_id)
+ descriptor->charset_id = column->charset_id;
+ if (OCI_G(debug_mode)) {
+ php_printf ("OCI8 DEBUG COLUMN: %s#%i ( len:%d size:%d chfr:%d chid:%d chunk:%d ) at (%s:%d) \n",
+ column->name,
+ column,
+ column->name_len,
+ column->data_size,
+ column->charset_form,
+ column->charset_id,
+ column->chunk_size,
+ __FILE__, __LINE__);
+ }
lob_fetch_status = php_oci_lob_read(descriptor, -1, 0, &lob_buffer, &lob_length TSRMLS_CC);
+ if(descriptor->chunk_size)
+ column->chunk_size = descriptor->chunk_size;
php_oci_temp_lob_close(descriptor TSRMLS_CC);
if (lob_fetch_status) {
ZVAL_FALSE(value);
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index d05e053..2db4592 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -294,17 +294,16 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
return 1;
}
} else {
- ub2 charset_id = 0;
+ if(!descriptor->charset_id){
+ PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &descriptor->charset_id));
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id));
-
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
- PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
- return 1;
+ if (connection->errcode != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
+ return 1;
+ }
}
-
- if (charset_id > 0) { /* charset_id is always > 0 for [N]CLOBs */
+ if (descriptor->charset_id > 0) { /* charset_id is always > 0 for [N]CLOBs */
is_clob = 1;
}
}
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index 155e57d..db6f73a 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -249,6 +249,7 @@ typedef struct { /* php_oci_out_column {{{ */
sb2 precision; /* column precision */
ub1 charset_form; /* charset form, required for NCLOBs */
ub2 charset_id; /* charset ID */
+ ub4 chunk_size; /* LOB chunk size */
} php_oci_out_column; /* }}} */
/* {{{ macros */
--
1.8.5.2.msysgit.0
|