summaryrefslogtreecommitdiff
path: root/ext/oci8/oci8_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/oci8/oci8_interface.c')
-rw-r--r--ext/oci8/oci8_interface.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index d91a132559..0649575b5b 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -42,6 +42,39 @@
#define OCI_STMT_CALL 10
#endif
+/* {{{ proto bool oci_register_taf_callback( resource connection [, mixed callback] )
+ Register a callback function for Oracle Transparent Application Failover (TAF) */
+PHP_FUNCTION(oci_register_taf_callback)
+{
+ zval *z_connection;
+ php_oci_connection *connection;
+ zval *callback;
+ zend_string *callback_name;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!", &z_connection, &callback) == FAILURE) {
+ return;
+ }
+
+ if (callback) {
+ if (!zend_is_callable(callback, 0, &callback_name)) {
+ php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name));
+ zend_string_release(callback_name);
+ RETURN_FALSE;
+ }
+
+ zend_string_release(callback_name);
+ }
+
+ PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
+
+ if (php_oci_register_taf_callback(connection, callback) == 0) {
+ RETURN_TRUE;
+ } else {
+ RETURN_FALSE;
+ }
+}
+/* }}} */
+
/* {{{ proto bool oci_define_by_name(resource stmt, string name, mixed &var [, int type])
Define a PHP variable to an Oracle column by name */
/* if you want to define a LOB/CLOB etc make sure you allocate it via OCINewDescriptor BEFORE defining!!! */
@@ -1553,6 +1586,9 @@ PHP_FUNCTION(oci_close)
internally Zend engine increments
RefCount value by 1 */
zend_list_close(connection->id);
+
+ /* Disable Oracle TAF */
+ php_oci_disable_taf_callback(connection);
/* ZVAL_NULL(z_connection); */