Author: byterock
Date: Thu Jul  9 07:02:25 2009
New Revision: 13021

Modified:
   dbd-oracle/branches/rs_array/dbdimp.h
   dbd-oracle/branches/rs_array/oci8.c

Log:
sort of working

Modified: dbd-oracle/branches/rs_array/dbdimp.h
==============================================================================
--- dbd-oracle/branches/rs_array/dbdimp.h       (original)
+++ dbd-oracle/branches/rs_array/dbdimp.h       Thu Jul  9 07:02:25 2009
@@ -113,6 +113,7 @@
        int                             fetch_position;
        int                     prefetch_memory;   /* OCI_PREFETCH_MEMORY*/
        /* array fetch: state variables */
+       int                             row_cache_off;
        bool                    rs_array_on;               /* if array to be 
used */
        int                             rs_array_size;           /* array size 
*/
        int                             rs_array_num_rows;       /* num rows in 
last fetch */

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 07:02:25 2009
@@ -581,6 +581,7 @@
                DBD_ATTRIB_GET_IV(  attribs, "ora_check_sql", 13, svp, 
ora_check_sql);
                DBD_ATTRIB_GET_IV(  attribs, "ora_exe_mode", 12, svp, 
imp_sth->exe_mode);
                DBD_ATTRIB_GET_IV(  attribs, "ora_prefetch_memory",  19, svp, 
imp_sth->prefetch_memory);
+               DBD_ATTRIB_GET_IV(  attribs, "ora_row_cache_off",  17, svp, 
imp_sth->row_cache_off);
                DBD_ATTRIB_GET_IV(  attribs, "ora_verbose",  11, svp, 
dbd_verbose);
                DBD_ATTRIB_GET_IV(  attribs, "ora_oci_success_warn",  20, svp, 
oci_warn);
                DBD_ATTRIB_GET_IV(  attribs, "ora_objects",  11, svp, 
ora_objects);
@@ -2265,14 +2266,14 @@
 void rs_array_init(imp_sth_t *imp_sth)
 {
        dTHX;
-       if (imp_sth->rs_array_on!=1             ||
+/*     if (imp_sth->rs_array_on!=1             ||
                imp_sth->rs_array_size<1        ||
                imp_sth->rs_array_size>128){
 
                imp_sth->rs_array_on=0;
                imp_sth->rs_array_size=1;
 
-       }
+       }*/
        imp_sth->rs_array_num_rows=0;
        imp_sth->rs_array_idx=0;
        imp_sth->rs_array_status=OCI_SUCCESS;
@@ -2361,13 +2362,13 @@
                ++num_errors;
        }
 
-       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 */
+/*     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 */
 
        if (DBIS->debug >= 3 || dbd_verbose >= 3 )
                PerlIO_printf(DBILOGFP,
-                       "       row cache OCI_ATTR_PREFETCH_ROWS %lu, 
OCI_ATTR_PREFETCH_MEMORY %lu\n",
-                       (unsigned long) (cache_rows), (unsigned long) 
(cache_mem));
+                       "       row cache OCI_ATTR_PREFETCH_ROWS %lu, 
OCI_ATTR_PREFETCH_MEMORY %lu cache_rows=%d\n",
+                       (unsigned long) (cache_rows), (unsigned long) 
(cache_mem),cache_rows);
 
        return num_errors;
 }
@@ -3173,26 +3174,35 @@
                                PerlIO_printf(DBILOGFP,"        Scrolling 
Fetch, postion after fetch=%d\n",imp_sth->fetch_position);
 
                } else {
-                       if (imp_sth->rs_array_on) {     /* if array fetch on, 
fetch only if not in cache */
-                               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;
-                       }
-                       else {
+                       if (imp_sth->row_cache_off){ /*Do not use array fetch 
or local cache */
                                OCIStmtFetch_log_stat(imp_sth->stmhp, 
imp_sth->errhp,1,(ub2)OCI_FETCH_NEXT, OCI_DEFAULT, status);
                                imp_sth->rs_array_idx=0;
                        }
+                       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;
+
+                                       }               
+                                               
+                                                       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;
+                       }
                }
        }
 

Reply via email to