Author: byterock
Date: Wed Jun 25 12:25:38 2008
New Revision: 11460
Modified:
dbd-oracle/branches/lob_piece/dbdimp.h
dbd-oracle/branches/lob_piece/oci8.c
dbd-oracle/branches/lob_piece/ocitrace.h
Log:
well working well but I see I am still running into the 15meg limit. I will
have to research it a bi more
Modified: dbd-oracle/branches/lob_piece/dbdimp.h
==============================================================================
--- dbd-oracle/branches/lob_piece/dbdimp.h (original)
+++ dbd-oracle/branches/lob_piece/dbdimp.h Wed Jun 25 12:25:38 2008
@@ -72,6 +72,7 @@
ub2 stmt_type; /* OCIAttrGet
OCI_ATTR_STMT_TYPE */
U16 auto_lob; /* use auto lobs*/
int pers_lob; /*use dblink for lobs only
for 10g Release 2. or later*/
+ int clbk_lob; /*use dblink for lobs only
for 10g Release 2. or later*/
int piece_lob; /*use piece fetch for lobs*/
ub4 piece_size; /*used in callback to set
the size of the piece to get*/
int has_lobs; /* Statement has bound LOBS*/
@@ -185,6 +186,7 @@
char *bless; /* for Oracle::OCI style handle data */
void *special; /* hook for special purposes (LOBs etc)
*/
int pers_lob; /*for persistant lobs 10g Release
2. or later*/
+ int clbk_lob; /*for persistant lobs 10g Release
2. or later*/
int piece_lob; /*use piecewise fetch for lobs*/
/* Our storage space for the field data as it's fetched */
sword ftype; /* external datatype we wish to get */
Modified: dbd-oracle/branches/lob_piece/oci8.c
==============================================================================
--- dbd-oracle/branches/lob_piece/oci8.c (original)
+++ dbd-oracle/branches/lob_piece/oci8.c Wed Jun 25 12:25:38 2008
@@ -323,6 +323,7 @@
IV ora_piece_size = 0; /*used only for persistent lobs with 10g Release
2. or later*/
IV ora_pers_lob = 0; /*used only for persistent lobs with 10g Release
2. or later*/
IV ora_piece_lob = 0;
+ IV ora_clbk_lob = 0;
ub4 oparse_lng = 1; /* auto v6 or v7 as suits db connected
to */
int ora_check_sql = 1; /* to force a describe to check SQL */
IV ora_placeholders = 1; /* find and handle placeholders */
@@ -361,11 +362,13 @@
DBD_ATTRIB_GET_IV( attribs, "ora_placeholders", 16, svp,
ora_placeholders);
DBD_ATTRIB_GET_IV( attribs, "ora_auto_lob", 12, svp,
ora_auto_lob);
DBD_ATTRIB_GET_IV( attribs, "ora_pers_lob", 12, svp,
ora_pers_lob);
+ DBD_ATTRIB_GET_IV( attribs, "ora_clbk_lob", 12, svp,
ora_clbk_lob);
DBD_ATTRIB_GET_IV( attribs, "ora_piece_lob", 13, svp,
ora_piece_lob);
DBD_ATTRIB_GET_IV( attribs, "ora_piece_size", 14, svp,
ora_piece_size);
imp_sth->auto_lob = (ora_auto_lob) ? 1 : 0;
imp_sth->pers_lob = (ora_pers_lob) ? 1 : 0;
+ imp_sth->clbk_lob = (ora_clbk_lob) ? 1 : 0;
imp_sth->piece_lob = (ora_piece_lob) ? 1 : 0;
imp_sth->piece_size = (ora_piece_size) ? ora_piece_size : 0;
/* ora_check_sql only works for selects owing to Oracle
behaviour */
@@ -1376,7 +1379,7 @@
fbh_setup_getrefpv(imp_fbh_t *fbh, int desc_t, char *bless)
{
dTHX;
- if (DBIS->debug >= 2 || dbd_verbose >=2)
+ if (DBIS->debug <= 2 || dbd_verbose <=2)
PerlIO_printf(DBILOGFP,
" col %d: otype %d, desctype %d, %s", fbh->field_num,
fbh->dbtype, desc_t, bless);
fbh->ftype = fbh->dbtype;
@@ -2328,7 +2331,6 @@
OCIAttrGet_parmdp(imp_sth, fbh->parmdp, &fbh->dbtype, 0,
OCI_ATTR_DATA_TYPE, status);
OCIAttrGet_parmdp(imp_sth, fbh->parmdp, &fbh->dbsize, 0,
OCI_ATTR_DATA_SIZE, status);
-
#ifdef OCI_ATTR_CHAR_USED
/* 0 means byte-length semantics, 1 means character-length semantics */
OCIAttrGet_parmdp(imp_sth, fbh->parmdp, &fbh->len_char_used, 0,
OCI_ATTR_CHAR_USED, status);
@@ -2435,10 +2437,28 @@
case 113: /* BLOB
*/
case 114: /* BFILE
*/
fbh->ftype = fbh->dbtype;
+
+
/* do we need some addition size logic here? (lab) */
- if (imp_sth->pers_lob){ /*this only works on
10.2 */
+ if (imp_sth->pers_lob){
fbh->pers_lob = 1;
+ fbh->disize =
fbh->disize+long_readlen; /*user set max value for the fetch*/
+ PerlIO_printf(DBILOGFP, " fbh->dbsize
1=%d\n",fbh->dbsize);
+
+ if (fbh->dbtype == 112){
+ fbh->ftype = SQLT_CHR;
+ } else {
+ fbh->ftype = SQLT_BIN; /*other
Binary*/
+ }
+PerlIO_printf(DBILOGFP, " imp_sth->long_readlen=%d\n",long_readlen);
+
+
+PerlIO_printf(DBILOGFP, " fbh->dbsize 2 =%d\n",fbh->dbsize);
+
+ } else if (imp_sth->clbk_lob){ /*this only works on
10.2 */
+
+ fbh->clbk_lob = 1;
fbh->define_mode = OCI_DYNAMIC_FETCH; /*
piecwise fetch*/
fbh->disize = imp_sth->long_readlen;
/*user set max value for the fetch*/
fbh->piece_size = imp_sth->piece_size; /*the
size for each piece*/
@@ -2472,6 +2492,8 @@
} else {
fbh->disize = fbh->dbsize *10 ; /* XXX!
*/
+
+
PerlIO_printf(DBILOGFP,"imp_sth->auto_lob=%d\n",imp_sth->auto_lob);
fbh->fetch_func = (imp_sth->auto_lob) ?
fetch_func_autolob : fetch_func_getrefpv;
fbh->bless = "OCILobLocatorPtr";
fbh->desc_t = OCI_DTYPE_LOB;
@@ -2558,7 +2580,9 @@
sb4 define_len = (ftype==94||ftype==95) ? fbh->disize+4 :
fbh->disize;
fb_ary_t *fb_ary;
- if (fbh->pers_lob || fbh->piece_lob ){/*init the cb_abuf with
this call*/
+ PerlIO_printf(DBILOGFP, " define_len 1=%d\n",define_len);
+
+ if (fbh->clbk_lob || fbh->piece_lob ){/*init the cb_abuf with
this call*/
fbh->fb_ary =
fb_ary_cb_alloc(imp_sth->piece_size,define_len, imp_sth->rs_array_size);
} else {
@@ -2582,7 +2606,7 @@
&fbh->defnp,
imp_sth->errhp,
(ub4) i,
- (fbh->desc_h) ? (dvoid*)&fbh->desc_h : fbh->pers_lob ?
(dvoid *) 0: fbh->piece_lob ? (dvoid *) 0:(dvoid*)fb_ary->abuf,
+ (fbh->desc_h) ? (dvoid*)&fbh->desc_h : fbh->clbk_lob ?
(dvoid *) 0: fbh->piece_lob ? (dvoid *) 0:(dvoid*)fb_ary->abuf,
(fbh->desc_h) ? 0 : define_len,
(ub2)fbh->ftype,
fb_ary->aindp,
@@ -2591,14 +2615,13 @@
fbh->define_mode,
status);
- if (fbh->pers_lob){
-
- /* use a dynamic callback for persistent
binary and char lobs*/
-
OCIDefineDynamic_log_stat(fbh->defnp,imp_sth->errhp,(dvoid *) fbh,status);
- }
+ if (fbh->clbk_lob){
+ /* use a dynamic callback for persistent binary and
char lobs*/
+ OCIDefineDynamic_log_stat(fbh->defnp,imp_sth->errhp,(dvoid
*) fbh,status);
+ }
- if (fbh->ftype == 108) { /* Embedded object bind it
differently*/
+ if (fbh->ftype == 108) { /* Embedded object bind it
differently*/
if (DBIS->debug >= 5 || dbd_verbose >= 5){
PerlIO_printf(DBILOGFP,"Field #%d is a object
or colection of some sort. Using OCIDefineObject and or OCIObjectPin \n",i);
@@ -2789,7 +2812,7 @@
}
if (rc == 0 || /* the normal case*/
- (fbh->pers_lob && rc == 1406 &&
DBIc_has(imp_sth,DBIcf_LongTruncOk))/*or a trunckated record when using 10.2
Persistent Lob interface*/
+ (fbh->clbk_lob && rc == 1406 &&
DBIc_has(imp_sth,DBIcf_LongTruncOk))/*or a trunckated record when using 10.2
Persistent Lob interface*/
) {
if (fbh->fetch_func) {
@@ -2798,7 +2821,7 @@
}
} else {
- if (fbh->pers_lob){
+ if (fbh->clbk_lob){
ub4
actual_bufl=imp_sth->piece_size*(fb_ary->piece_count)+fb_ary->bufl;
if (fb_ary->piece_count==0){
Modified: dbd-oracle/branches/lob_piece/ocitrace.h
==============================================================================
--- dbd-oracle/branches/lob_piece/ocitrace.h (original)
+++ dbd-oracle/branches/lob_piece/ocitrace.h Wed Jun 25 12:25:38 2008
@@ -35,6 +35,27 @@
appropriate an &, thus: "...,&p%ld,...",
If done well the log will read like a compilable program.
*/
+/* OCIStmtGetPieceInfo(fbh->imp_sth->stmhp,
+ fbh->imp_sth->errhp,
&hdlptr, ,
+
&in_out, &iter, &idx, &piece);
+*/
+
+#define
OCIStmtGetPieceInfo_log_stat(stmhp,errhp,hdlptr,hdltyp,in_out,iter,idx,piece,stat)\
+ stat
=OCIStmtGetPieceInfo(stmhp,errhp,hdlptr,hdltyp,in_out,iter,idx,piece);\
+ (DBD_OCI_TRACEON) \
+ ? PerlIO_printf(DBD_OCI_TRACEFP,\
+ "%sOCIStmtGetPieceInfo_log_stat(%p,%p,%d)=%s\n",\
+ OciTp,
(void*)errhp,fbh,piece,oci_status_name(stat)),stat \
+ : stat
+
+
+#define OCIStmtSetPieceInfo_log_stat(ptr,errhp,buf,blen,p,indp,rc,stat)\
+ stat =OCIStmtSetPieceInfo(ptr,OCI_HTYPE_DEFINE,errhp, buf, blen,
p,indp,rc);\
+ (DBD_OCI_TRACEON) \
+ ? PerlIO_printf(DBD_OCI_TRACEFP,\
+ "%sOCIStmtSetPieceInfo_log_stat(%p,%p,%d,%s,%d)=%s\n",\
+ OciTp,
(void*)errhp,fbh,piece,buf,blen,oci_status_name(stat)),stat \
+ : stat
#define OCIDefineDynamic_log_stat(defnp,errhp,fbh,stat)\