[svn:dbd-oracle] r15429 - dbd-oracle/branches/FAN
[email protected] Fri, 5 Oct 2012 09:41:57 -0700 (PDT)
| Newsgroups | perl.dbd.oracle.changes |
|---|---|
| Message-ID | <[email protected]> |
Author: byterock
Date: Fri Oct 5 09:41:57 2012
New Revision: 15429
Modified:
dbd-oracle/branches/FAN/dbdimp.c
dbd-oracle/branches/FAN/dbdimp.h
dbd-oracle/branches/FAN/oci8.c
Log:
sum fixes almost running
Modified: dbd-oracle/branches/FAN/dbdimp.c
==============================================================================
--- dbd-oracle/branches/FAN/dbdimp.c (original)
+++ dbd-oracle/branches/FAN/dbdimp.c Fri Oct 5 09:41:57 2012
@@ -61,6 +61,9 @@
};
static sql_fbh_t ora2sql_type _((imp_fbh_t* fbh));
+static void disable_ha(imp_dbh_t *imp_dbh);
+static int enable_ha(SV *dbh, imp_dbh_t *imp_dbh);
+
void ora_free_phs_contents _((phs_t *phs));
static void dump_env_to_trace();
@@ -1115,21 +1118,9 @@
#ifdef ORA_OCI_112
- if (imp_dbh->taf_function){
- disable_taf(imp_dbh);
- }
-
- if (imp_dbh->taf_function) {
- SvREFCNT_dec(imp_dbh->taf_function);
- imp_dbh->taf_function = NULL;
- }
- if (imp_dbh->taf_ctx.dbh_ref) {
- SvREFCNT_dec(SvRV(imp_dbh->taf_ctx.dbh_ref));
- imp_dbh->taf_ctx.dbh_ref = NULL;
- }
if (imp_dbh->ha_function){
- disable_taf(imp_dbh);
+ disable_ha(imp_dbh);
}
@@ -1194,7 +1185,15 @@
imp_dbh->pool_incr = SvIV (valuesv);
}
else if (kl==15 && strEQ(key, "ora_ha_function") ) {
- imp_dbh->ha_function = (char *) SvPV (valuesv, vl );
+ if (imp_dbh->ha_function)
+ SvREFCNT_dec(imp_dbh->ha_function);
+ imp_dbh->ha_function = newSVsv(valuesv);
+
+ if (SvTRUE(valuesv)) {
+ enable_ha(dbh, imp_dbh);
+ } else {
+ disable_ha(imp_dbh);
+ }
}
@@ -4388,13 +4387,15 @@
#ifdef ORA_OCI_112
/* HA functiosn only on 11+ */
+
static void disable_ha(imp_dbh_t *imp_dbh) {
+dTHX;
sword status;
ha_ctx_t *ctx = NULL;
ctx->function = NULL;
ctx->ctx_perl = NULL;
- ctx->imp_dbh = NULL;
+ ctx->dbh_ref = NULL;
OCIAttrSet_log_stat(imp_dbh->envhp, OCI_HTYPE_ENV,ctx,0,OCI_ATTR_EVTCTX, imp_dbh->errhp , status);
@@ -4402,15 +4403,17 @@
}
-static int enable_ha
+static int enable_ha(
SV *dbh,
imp_dbh_t *imp_dbh) {
+dTHX;
+ sword status;
if (DBIS->debug >= 4 || dbd_verbose >= 4 ) {
PerlIO_printf(DBILOGFP,"Setting up HA Event Callback!");
}
- status = reg_ha_callback(imp_dbh);
+ status = reg_ha_callback(dbh,imp_dbh);
if (status != OCI_SUCCESS) {
oci_error(dbh, NULL, status,"Setting HA Event Callback Failed! ");
Modified: dbd-oracle/branches/FAN/dbdimp.h
==============================================================================
--- dbd-oracle/branches/FAN/dbdimp.h (original)
+++ dbd-oracle/branches/FAN/dbdimp.h Fri Oct 5 09:41:57 2012
@@ -408,7 +408,7 @@
ub4 ora_db_version _((SV *dbh, imp_dbh_t *imp_dbh));
sb4 reg_taf_callback _((imp_dbh_t *imp_dbh));
-sb4 reg_ha_callback _((imp_dbh_t *imp_dbh));
+sb4 reg_ha_callback _((SV *dbh, imp_dbh_t *imp_dbh));
/* These defines avoid name clashes for multiple statically linked DBD's */
Modified: dbd-oracle/branches/FAN/oci8.c
==============================================================================
--- dbd-oracle/branches/FAN/oci8.c (original)
+++ dbd-oracle/branches/FAN/oci8.c Fri Oct 5 09:41:57 2012
@@ -1394,7 +1394,7 @@
hv_store(ha_event,"Instances",9,newRV_noinc((SV*)servers),0);
XPUSHs(sv_2mortal(newRV((SV*)ha_event)));
- XPUSHs(SvRV(ctx->dbh_ref));
+ XPUSHs(SvRV(ctx->dbh_ref));
PUTBACK;
call_pv(ctx->function, G_DISCARD);