[svn:dbd-oracle] r15359 - in dbd-oracle/trunk: . lib/DBD t
[email protected] Mon, 6 Aug 2012 07:44:03 -0700 (PDT)
| Newsgroups | perl.dbd.oracle.changes |
|---|---|
| Message-ID | <[email protected]> |
Author: mjevans
Date: Mon Aug 6 07:44:02 2012
New Revision: 15359
Modified:
dbd-oracle/trunk/Changes
dbd-oracle/trunk/dbdimp.c
dbd-oracle/trunk/lib/DBD/Oracle.pm
dbd-oracle/trunk/t/38taf.t
Log:
add more some simple TAF tests
continue fix for taf_function leaking and corruption - should be ok now
added note that taf_sleep will be withdrawn
added note that TAF only works at connect time and reported
as RT 78811
Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes (original)
+++ dbd-oracle/trunk/Changes Mon Aug 6 07:44:02 2012
@@ -18,9 +18,16 @@
- fix RT46739 if a connection breaks the environment handle is
not thrown away (Martin J. Evans)
+ [CHANGE IN BEHAVIOUR]
+
+ - In future versions taf_sleep will be withdrawn as you can simply
+ sleep in your own callback.
+
[MISCELLANEOUS]
- - hide dr, db and st packages from PAUSE
+ - hide dr, db and st packages from PAUSE (Martin J. Evans)
+
+ - added a few more simple TAF tests (Martin J. Evans)
1.47_00 2012-07-11
Modified: dbd-oracle/trunk/dbdimp.c
==============================================================================
--- dbd-oracle/trunk/dbdimp.c (original)
+++ dbd-oracle/trunk/dbdimp.c Mon Aug 6 07:44:02 2012
@@ -1205,7 +1205,16 @@
imp_dbh->using_taf = 1;
}
else if (kl==16 && strEQ(key, "ora_taf_function") ) {
- imp_dbh->taf_function = (char *) SvPV (valuesv, vl );
+ STRLEN svp_len;
+ char *fn;
+
+ if (imp_dbh->taf_function) {
+ Safefree(imp_dbh->taf_function);
+ }
+
+ fn = SvPV(valuesv, svp_len);
+ imp_dbh->taf_function = (char *)safemalloc(svp_len + 1);
+ strcpy(imp_dbh->taf_function, fn);
}
else if (kl==13 && strEQ(key, "ora_taf_sleep") ) {
imp_dbh->taf_sleep = SvIV (valuesv);
Modified: dbd-oracle/trunk/lib/DBD/Oracle.pm
==============================================================================
--- dbd-oracle/trunk/lib/DBD/Oracle.pm (original)
+++ dbd-oracle/trunk/lib/DBD/Oracle.pm Mon Aug 6 07:44:02 2012
@@ -1380,9 +1380,9 @@
event of a failure of the instance. The reconnect happens
automatically from within the OCI (Oracle Call Interface) library.
DBD::Oracle now supports a callback function that will fire when a TAF
-event takes place. The main use of the callback is to give your
-program the opportunity to inform the user that a failover is taking
-place.
+event takes place. You may use the callback to inform the
+user a failover is taking place or to setup the session again
+once the failover has succeeded.
You will have to set up TAF on your instance before you can use this
callback. You can test your instance to see if you can use TAF
@@ -1390,7 +1390,11 @@
$dbh->ora_can_taf();
-If you try to set up a callback without it being enabled DBD::Oracle will croak.
+If you try to set up a callback without it being enabled DBD::Oracle
+will croak.
+
+NOTE: Currently, you must enable TAF during DBI's connect. However
+once enabled you can change the TAF settings.
It is outside the scope of this document to go through all of the
possible TAF situations you might want to set up but here is a simple
@@ -1548,6 +1552,10 @@
If your Oracle instance has been configured to use TAF events you can
enable the TAF callback by setting this option to any I<true> value.
+NOTE: All the ora_taf* attributes must currently be set in the connect
+method if you want TAF enabled at the moment i.e., after connect you
+can change the callback but you cannot disable TAF.
+
=head4 ora_taf_function
The name of the Perl subroutine that will be called from OCI when a
@@ -1573,6 +1581,10 @@
successive failover events when the event is OCI_FO_ERROR and OCI_FO_RETRY
is returned from the TAF handler.
+NOTE: This attribute will be withdrawn in the future so I suggest you
+don't use it and if you want to sleep, add it to your own callback
+sub.
+
=head4 ora_session_mode
The ora_session_mode attribute can be used to connect with SYSDBA,
Modified: dbd-oracle/trunk/t/38taf.t
==============================================================================
--- dbd-oracle/trunk/t/38taf.t (original)
+++ dbd-oracle/trunk/t/38taf.t Mon Aug 6 07:44:02 2012
@@ -19,8 +19,6 @@
my $dbh = eval { DBI->connect($dsn, $dbuser, '',) }
or plan skip_all => "Unable to connect to Oracle";
-plan tests => 1;
-
$dbh->disconnect;
if ( !$dbh->ora_can_taf ){
@@ -38,7 +36,11 @@
ok $dbh = DBI->connect($dsn, $dbuser, '',
{ora_taf=>1, ora_taf_sleep=>15,
ora_taf_function=>'taf'});
-
+ is($dbh->{ora_taf}, 1, 'TAF enabled');
+ is($dbh->{ora_taf_sleep}, 15, 'TAF sleep set');
+ is($dbh->{ora_taf_function}, 'taf', 'TAF callback');
}
$dbh->disconnect;
+
+done_testing();