<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Register a user-defined callback function for Oracle Database TAF</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.oci-pconnect.html">oci_pconnect</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.oci-result.html">oci_result</a></div> <div class="up"><a href="ref.oci8.html">OCI8 Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.oci-register-taf-callback" class="refentry"> <div class="refnamediv"> <h1 class="refname">oci_register_taf_callback</h1> <p class="verinfo">(PHP 7.0 >= 7.0.21, PHP 7 >= 7.1.7, PECL OCI8 >= 2.1.7)</p><p class="refpurpose"><span class="refname">oci_register_taf_callback</span> — <span class="dc-title">Register a user-defined callback function for Oracle Database TAF</span></p> </div> <div class="refsect1 description" id="refsect1-function.oci-register-taf-callback-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>oci_register_taf_callback</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$connection</code></span> [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$callbackFn</code></span> ] )</div> <p class="para rdfs-comment"> Registers a user-defined callback function to <code class="parameter">connection</code>. If <code class="parameter">connection</code> fails due to instance or network failure, the registered callback function will be invoked for several times during failover. See <a href="oci8.taf.html" class="link">OCI8 Transparent Application Failover (TAF) Support</a> for information. </p> <p class="para"> When <span class="function"><strong>oci_register_taf_callback()</strong></span> is called multiple times, each registration overwrites the previous one. </p> <p class="para"> Use <span class="function"><a href="function.oci-unregister-taf-callback.html" class="function">oci_unregister_taf_callback()</a></span> to explicitly unregister a user-defined callback. </p> <p class="para"> TAF callback registration will NOT be saved across persistent connections, therefore the callback needs to be re-registered for a new persistent connection. </p> </div> <div class="refsect1 parameters" id="refsect1-function.oci-register-taf-callback-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <code class="parameter">connection</code></dt> <dd> <p class="para"> An Oracle connection identifier. </p> </dd> <dt> <code class="parameter">callbackFn</code></dt> <dd> <p class="para"> A user-defined callback to register for Oracle TAF. It can be a string of the function name or a Closure (anonymous function). </p> <p class="para"> The interface of a TAF user-defined callback function is as follows: </p> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><strong>userCallbackFn</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$connection</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$event</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$type</code></span> )</div> <p class="para"> See the parameter description and an example on <a href="oci8.taf.html" class="link"> OCI8 Transparent Application Failover (TAF) Support</a> page. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.oci-register-taf-callback-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 seealso" id="refsect1-function.oci-register-taf-callback-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><span class="function"><a href="function.oci-unregister-taf-callback.html" class="function" rel="rdfs-seeAlso">oci_unregister_taf_callback()</a> - Unregister a user-defined callback function for Oracle Database TAF</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.oci-pconnect.html">oci_pconnect</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.oci-result.html">oci_result</a></div> <div class="up"><a href="ref.oci8.html">OCI8 Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>