Author: byterock
Date: Thu Jul 9 09:00:49 2009
New Revision: 13025
Modified:
dbd-oracle/branches/rs_array/oci8.c
Log:
working really well copy
Modified: dbd-oracle/branches/rs_array/oci8.c
==============================================================================
--- dbd-oracle/branches/rs_array/oci8.c (original)
+++ dbd-oracle/branches/rs_array/oci8.c Thu Jul 9 09:00:49 2009
@@ -2294,15 +2294,8 @@
ub4 prefetch_rows = 0; /*Oracle prefetch Row Buffer*/
sb4 cache_rows = 0;/* set high so memory is the limit */
sword status;
- sb4 test_cache_rows = 0;
-
- /* reworked this is little so the user can set up his own cache
- basically if rowcachesize or prefetch_mem is set it uses those values
- otherwise it does it itself
- no sure what happens in the last case but I lwft it in for now
- Also I think in later version of OCI this call does not really do
anything
- */
-
+
+
/* number of rows to cache if using oraperl */
if (SvOK(imp_drh->ora_cache_o)){
imp_sth->cache_rows = SvIV(imp_drh->ora_cache_o);
@@ -2312,43 +2305,7 @@
}
-/* if (imp_sth->is_child || imp_sth->ret_lobs){ /*ref cursors and sp only
one row is allowed
-
- cache_rows =1;
- prefetch_mem =0;
-
- } else if (imp_dbh->RowCacheSize || imp_sth->prefetch_memory){
-PerlIO_printf(DBILOGFP,"HERE a\n");
- /*user set values *
- cache_rows =imp_dbh->RowCacheSize;
- prefetch_mem =imp_sth->prefetch_memory;
-
- } else if (imp_sth->cache_rows >= 0) { /* set cache size by row count
-
-
-PerlIO_printf(DBILOGFP,"HERE b\n");
- /* imp_sth->est_width needs to be set
- prefetch_mem = 0; /* so memory isn't the
limit
-
- cache_rows =
calc_cache_rows(imp_sth->cache_rows,(int)num_fields, imp_sth->est_width,
has_longs);
-
- if (max_cache_rows && cache_rows > (signed long) max_cache_rows)
- cache_rows = max_cache_rows;
-
- imp_sth->cache_rows = cache_rows; /* record updated value
- }
- else { /* set cache size by memory */
- /* not sure if we ever reach
this
- prefetch_mem = -imp_sth->cache_rows; /* cache_mem always +ve
here
- if (max_cache_rows && cache_rows > (signed long)
max_cache_rows) {
- cache_rows = max_cache_rows;
- imp_sth->cache_rows = cache_rows; /* record
updated value only if max_cache_rows
- }
-
- }
-
-*/
if (imp_dbh->RowCacheSize){
cache_rows=imp_dbh->RowCacheSize;
}
@@ -2361,10 +2318,7 @@
cache_rows=calc_cache_rows(imp_sth->cache_rows,(int)num_fields,
imp_sth->est_width, has_longs);
- PerlIO_printf(DBILOGFP,"cache_rows=%d\n",cache_rows);
-
PerlIO_printf(DBILOGFP,"imp_sth->cache_rows=%d\n",imp_sth->cache_rows);
-
- if(!prefetch_rows){
+ if(!prefetch_rows && !prefetch_mem){
prefetch_rows=cache_rows;
}
}
@@ -2373,11 +2327,10 @@
prefetch_mem =-imp_dbh->RowCacheSize; /* cache_mem always
+ve here */
prefetch_rows =0;
cache_rows=calc_cache_rows(imp_sth->cache_rows,(int)num_fields,
imp_sth->est_width, has_longs);
- /*Sill use local cache but it is calulated nothing in
the doc for this so I will use it like this*/
+ /*Sill use local cache but it is calulated nothing in the doc
for this so I will use it like this*/
}
- PerlIO_printf(DBILOGFP,"cache_rows=%d
prefetch_rows=%d,prefetch_mem=%d\n",cache_rows,prefetch_rows,prefetch_mem);
OCIAttrSet_log_stat(imp_sth->stmhp, OCI_HTYPE_STMT,
&prefetch_mem,
sizeof(prefetch_mem), OCI_ATTR_PREFETCH_MEMORY,
@@ -2406,17 +2359,11 @@
else{
}
- /*imp_sth->cache_rows=prefetch_rows;*/
-
-/* if (imp_sth->rs_array_on && cache_rows>0)
- imp_sth->rs_array_size=cache_rows;*>128?128:cache_rows; /*
restrict to 128 for now
- imp_sth->rs_array_size=cache_rows;
- imp_sth->cache_rows=cache_rows;*/
-
+
if (DBIS->debug >= 3 || dbd_verbose >= 3 )
PerlIO_printf(DBILOGFP,
- " row cache OCI_ATTR_PREFETCH_ROWS %lu,
OCI_ATTR_PREFETCH_MEMORY %lu cache_rows=%d\n max_cache_rows=%d",
- (unsigned long) (cache_rows), (unsigned long)
(prefetch_mem),cache_rows,max_cache_rows);
+ " cache settings OCI_ATTR_PREFETCH_ROWS %lu,
OCI_ATTR_PREFETCH_MEMORY %lu Rows per Fetch=%d, Multiple Row Fetch on=%d"
+ (unsigned long) (prefetch_rows), (unsigned long)
(prefetch_mem),cache_rows,imp_sth->row_cache_off);
@@ -3234,27 +3181,22 @@
else { /*Array Fetch the New Noraml Super speedy and
very nice*/
if (DBIS->debug >= 4 || dbd_verbose <= 4 )
PerlIO_printf(DBILOGFP,"rs_array_num_rows=%d rs_array_idx=%d,
rs_array_status=%d
rs_array_size=%d\n",imp_sth->rs_array_num_rows,imp_sth->rs_array_idx,imp_sth->rs_array_status,imp_sth->rs_array_size);
- imp_sth->rs_array_idx++;
- if
(imp_sth->rs_array_num_rows<=imp_sth->rs_array_idx &&
(imp_sth->rs_array_status==OCI_SUCCESS ||
imp_sth->rs_array_status==OCI_SUCCESS_WITH_INFO)) {
- PerlIO_printf(DBILOGFP,"3\n");
-
-
PerlIO_printf(DBILOGFP,"rs_array_size=%d\n",imp_sth->rs_array_size);
-
-
OCIStmtFetch_log_stat(imp_sth->stmhp,imp_sth->errhp,imp_sth->rs_array_size,(ub2)OCI_FETCH_NEXT,OCI_DEFAULT,status);
- PerlIO_printf(DBILOGFP,"4\n");
- imp_sth->rs_array_status=status;
- if (oci_warn &&
(imp_sth->rs_array_status == OCI_SUCCESS_WITH_INFO)) {
- oci_error(sth,
imp_sth->errhp, status, "OCIStmtFetch");
- }
- OCIAttrGet_stmhp_stat(imp_sth,
&imp_sth->rs_array_num_rows,0,OCI_ATTR_ROWS_FETCHED, status);
- imp_sth->rs_array_idx=0;
-
- }
+
+ imp_sth->rs_array_idx++;
+ if
(imp_sth->rs_array_num_rows<=imp_sth->rs_array_idx &&
(imp_sth->rs_array_status==OCI_SUCCESS ||
imp_sth->rs_array_status==OCI_SUCCESS_WITH_INFO)) {
+
OCIStmtFetch_log_stat(imp_sth->stmhp,imp_sth->errhp,imp_sth->rs_array_size,(ub2)OCI_FETCH_NEXT,OCI_DEFAULT,status);
+ imp_sth->rs_array_status=status;
+ if (oci_warn &&
(imp_sth->rs_array_status == OCI_SUCCESS_WITH_INFO)) {
+ oci_error(sth, imp_sth->errhp,
status, "OCIStmtFetch");
+ }
+ OCIAttrGet_stmhp_stat(imp_sth,
&imp_sth->rs_array_num_rows,0,OCI_ATTR_ROWS_FETCHED, status);
+ imp_sth->rs_array_idx=0;
+ }
- if
(imp_sth->rs_array_num_rows>imp_sth->rs_array_idx) /* set status to success
if rows in cache */
-
status=OCI_SUCCESS;
- else
-
status=imp_sth->rs_array_status;
+ if
(imp_sth->rs_array_num_rows>imp_sth->rs_array_idx) /* set status to success
if rows in cache */
+ status=OCI_SUCCESS;
+ else
+ status=imp_sth->rs_array_status;
}
}
}