[svn:dbd-oracle] r14812 - dbd-oracle/branches/TAF
[email protected] Mon, 4 Apr 2011 06:46:51 -0700 (PDT)
| Newsgroups | perl.dbd.oracle.changes |
|---|---|
| Message-ID | <[email protected]> |
Author: byterock
Date: Mon Apr 4 06:46:50 2011
New Revision: 14812
Modified:
dbd-oracle/branches/TAF/dbdimp.h
dbd-oracle/branches/TAF/oci8.c
Log:
working
Modified: dbd-oracle/branches/TAF/dbdimp.h
==============================================================================
--- dbd-oracle/branches/TAF/dbdimp.h (original)
+++ dbd-oracle/branches/TAF/dbdimp.h Mon Apr 4 06:46:50 2011
@@ -8,6 +8,13 @@
/* ====== define data types ====== */
+typedef struct taf_callback_st taf_callback_t;
+
+struct taf_callback_st {
+ char *function; /*User supplied TAF functiomn*/
+ int sleep;
+};
+
typedef struct imp_fbh_st imp_fbh_t;
@@ -53,6 +60,7 @@
char *driver_name;/*driver name user defined*/
ub4 driver_namel;
#endif
+/* taf_callback_t *taf_callback;*/
bool using_taf; /*TAF stuff*/
char *taf_function; /*User supplied TAF functiomn*/
int taf_sleep;
@@ -80,6 +88,7 @@
#define DBH_DUP_LEN (sizeof(struct imp_dbh_st) - sizeof(dbih_dbc_t))
+
typedef struct lob_refetch_st lob_refetch_t; /* Define sth implementor data structure */
Modified: dbd-oracle/branches/TAF/oci8.c
==============================================================================
--- dbd-oracle/branches/TAF/oci8.c (original)
+++ dbd-oracle/branches/TAF/oci8.c Mon Apr 4 06:46:50 2011
@@ -1027,7 +1027,7 @@
DBD_ATTRIB_GET_IV( attribs, "ora_oci_success_warn", 20, svp, oci_warn);
DBD_ATTRIB_GET_IV( attribs, "ora_objects", 11, svp, ora_objects);
DBD_ATTRIB_GET_IV( attribs, "ora_ncs_buff_mtpl", 17, svp,ora_ncs_buff_mtpl);
- DBD_ATTRIB_GET_IV( attribs, "RowCacheSize",12,svp, imp_sth->RowCacheSize);
+ DBD_ATTRIB_GET_IV( attribs, "RowCacheSize",12,svp, imp_sth->RowCacheSize);
if (!dbd_verbose)
DBD_ATTRIB_GET_IV( attribs, "dbd_verbose", 11, svp, dbd_verbose);
@@ -1316,7 +1316,7 @@
taf_cbk(dvoid *svchp, dvoid *envhp, dvoid *fo_ctx,ub4 fo_type, ub4 fo_event )
{
dTHX;
- imp_dbh_t *dbh =(imp_dbh_t*)fo_ctx;
+ taf_callback_t *cb =(taf_callback_t*)fo_ctx;
dSP;
PUSHMARK(SP);
@@ -1324,12 +1324,11 @@
XPUSHs(sv_2mortal(newSViv(fo_type)));
PUTBACK;
- PerlIO_printf(DBILOGFP, "taf_cbk mp_drh=%p\n",dbh);
-PerlIO_printf(DBILOGFP, "taf_cbk ora_taf_function=%s\n",dbh);
-PerlIO_printf(DBILOGFP, " taf_cbk=%s\n",dbh->client_info);
+ PerlIO_printf(DBILOGFP, "taf_cbk mp_drh=%p\n",cb);
+PerlIO_printf(DBILOGFP, "taf_cbk ora_taf_function=%s\n",cb->function);
-PerlIO_printf(DBILOGFP, " taf_sleep=%d\n",dbh->taf_sleep);
- call_pv(dbh->taf_function, G_DISCARD);
+PerlIO_printf(DBILOGFP, " taf_sleep=%d\n",cb->sleep);
+ call_pv(cb->function, G_DISCARD);
switch (fo_event){
@@ -1342,7 +1341,7 @@
}
case OCI_FO_ERROR:
{
- sleep(dbh->taf_sleep);
+ sleep(cb->sleep);
return OCI_FO_RETRY;
break;
}
@@ -1362,21 +1361,28 @@
dTHX;
OCIFocbkStruct tafailover;
sword status;
-
+ taf_callback_t *cb = NULL;
+ Newz(1, cb, 1, taf_callback_t);
+ cb->function= (char*)safemalloc(strlen(imp_dbh->taf_function));
+ cb->sleep = imp_dbh->taf_sleep;
+ strcpy((char *)cb->function,imp_dbh->taf_function);
if (dbd_verbose >= 5 ) {
PerlIO_printf(DBILOGFP, " In reg_taf_callback\n");
}
+
/* set the context up as a pointer to the handle*/
- tafailover.fo_ctx = &imp_dbh;
- tafailover.callback_function = &taf_cbk;
+PerlIO_printf(DBILOGFP, " sizeof(imp_dbh)=%d\n",strlen(imp_dbh->taf_function));
+
+ tafailover.fo_ctx = cb;
-PerlIO_printf(DBILOGFP, " reg_taf_callback=%s\n",imp_dbh->taf_function);
-PerlIO_printf(DBILOGFP, " reg_taf_callback=%s\n",imp_dbh->client_info);
+ tafailover.callback_function = &taf_cbk;
+
+PerlIO_printf(DBILOGFP, " reg_taf_callback=%s\n",cb->function);
PerlIO_printf(DBILOGFP, " reg_taf_callback=%p\n",imp_dbh);
- OCIAttrSet_log_stat(imp_dbh->srvhp, (ub4) OCI_HTYPE_SERVER,
+ OCIAttrSet_log_stat(imp_dbh->srvhp, (ub4) OCI_HTYPE_SERVER,
(dvoid *) &tafailover, (ub4) 0,
- (ub4) OCI_ATTR_FOCBK, imp_dbh->errhp, status);
+ (ub4) OCI_ATTR_FOCBK, imp_dbh->errhp, status);
return status;
}
@@ -4176,6 +4182,7 @@
+
struct lob_refetch_st {
OCIStmt *stmthp;
OCIBind *bindhp;