tony2001 Tue Dec 16 10:58:11 2003 EDT Modified files: /php-src/ext/oci8 config.m4 oci8.c Log: fix bug #26133 (thanks to Harald) rename constant and add library check to config.m4 add info lines to see if Collection & Temp Lob support enabled or not add OCI_THREADED to use thread safe OCI mode with ZTS (should fix bug #26558)
Index: php-src/ext/oci8/config.m4 diff -u php-src/ext/oci8/config.m4:1.47 php-src/ext/oci8/config.m4:1.48 --- php-src/ext/oci8/config.m4:1.47 Fri Oct 3 01:24:25 2003 +++ php-src/ext/oci8/config.m4 Tue Dec 16 10:58:10 2003 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.47 2003/10/03 05:24:25 sniper Exp $ +dnl $Id: config.m4,v 1.48 2003/12/16 15:58:10 tony2001 Exp $ dnl AC_DEFUN(PHP_OCI_IF_DEFINED,[ @@ -138,10 +138,22 @@ -L$OCI8_DIR/lib $OCI8_SHARED_LIBADD ]) + dnl + dnl Check if we have collections + dnl + PHP_CHECK_LIBRARY(clntsh, OCICollAssign, + [ + AC_DEFINE(HAVE_OCI8_COLLECTIONS,1,[ ]) + ], [], [ + -L$OCI8_DIR/lib $OCI8_SHARED_LIBADD + ]) + + PHP_NEW_EXTENSION(oci8, oci8.c, $ext_shared) AC_DEFINE(HAVE_OCI8,1,[ ]) PHP_SUBST_OLD(OCI8_SHARED_LIBADD) PHP_SUBST_OLD(OCI8_DIR) PHP_SUBST_OLD(OCI8_VERSION) + fi Index: php-src/ext/oci8/oci8.c diff -u php-src/ext/oci8/oci8.c:1.222 php-src/ext/oci8/oci8.c:1.223 --- php-src/ext/oci8/oci8.c:1.222 Tue Dec 16 10:48:20 2003 +++ php-src/ext/oci8/oci8.c Tue Dec 16 10:58:10 2003 @@ -22,7 +22,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: oci8.c,v 1.222 2003/12/16 15:48:20 tony2001 Exp $ */ +/* $Id: oci8.c,v 1.223 2003/12/16 15:58:10 tony2001 Exp $ */ /* TODO list: * @@ -66,9 +66,6 @@ #include "ext/standard/info.h" #include "php_ini.h" -/* #define HAVE_OCI8_TEMP_LOB 1 */ -#define WITH_COLLECTIONS 1 - #if HAVE_OCI8 #include "php_oci8.h" @@ -84,13 +81,13 @@ static int le_conn; static int le_stmt; static int le_desc; -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS static int le_coll; #endif static int le_server; static int le_session; static zend_class_entry *oci_lob_class_entry_ptr; -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS static zend_class_entry *oci_coll_class_entry_ptr; #endif @@ -193,7 +190,7 @@ static void _oci_conn_list_dtor(oci_connection *connection TSRMLS_DC); static void _oci_stmt_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC); static void _oci_descriptor_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC); -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS static void _oci_coll_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC); #endif static void _oci_server_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC); @@ -207,7 +204,7 @@ static oci_connection *oci_get_conn(zval ** TSRMLS_DC); static oci_statement *oci_get_stmt(zval ** TSRMLS_DC); static oci_descriptor *oci_get_desc(int TSRMLS_DC); -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS /* Questionable name. Very close to oci_get_col */ static oci_collection *oci_get_coll(int TSRMLS_DC); #endif @@ -297,7 +294,7 @@ PHP_FUNCTION(ociwritetemporarylob); PHP_FUNCTION(ocicloselob); #endif -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS PHP_FUNCTION(ocinewcollection); PHP_FUNCTION(ocifreecollection); PHP_FUNCTION(ocicollappend); @@ -327,7 +324,7 @@ RETURN_FALSE; \ } -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS #define OCI_GET_COLL(collection,index) \ collection = oci_get_coll(index TSRMLS_CC); \ if (collection == NULL) { \ @@ -418,7 +415,7 @@ PHP_FE(ocinewdescriptor, NULL) PHP_FE(ocisetprefetch, NULL) PHP_FE(ocipasswordchange, NULL) -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS PHP_FE(ocifreecollection, NULL) PHP_FE(ocicollappend, NULL) PHP_FE(ocicollgetelem, NULL) @@ -461,7 +458,7 @@ {NULL,NULL,NULL} }; -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS static zend_function_entry php_oci_coll_class_functions[] = { PHP_FALIAS(append, ocicollappend, NULL) PHP_FALIAS(getelem, ocicollgetelem, NULL) @@ -534,28 +531,34 @@ PHP_MINIT_FUNCTION(oci) { zend_class_entry oci_lob_class_entry; -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS zend_class_entry oci_coll_class_entry; #endif #ifdef HAVE_OCI8_SHARED_MODE -#ifdef WITH_COLLECTIONS -#define PHP_OCI_INIT_MODE OCI_SHARED | OCI_OBJECT +#ifdef PHP_OCI8_HAVE_COLLECTIONS +#define PHP_OCI_INIT_MODE_TMP OCI_SHARED | OCI_OBJECT #else -#define PHP_OCI_INIT_MODE OCI_SHARED +#define PHP_OCI_INIT_MODE_TMP OCI_SHARED #endif #else -#ifdef WITH_COLLECTIONS -#define PHP_OCI_INIT_MODE OCI_DEFAULT | OCI_OBJECT +#ifdef PHP_OCI8_HAVE_COLLECTIONS +#define PHP_OCI_INIT_MODE_TMP OCI_DEFAULT | OCI_OBJECT #else -#define PHP_OCI_INIT_MODE OCI_DEFAULT +#define PHP_OCI_INIT_MODE_TMP OCI_DEFAULT #endif #endif +#ifdef ZTS +#define PHP_OCI_INIT_MODE PHP_OCI_INIT_MODE_TMP | OCI_THREADED +#else +#define PHP_OCI_INIT_MODE PHP_OCI_INIT_MODE_TMP +#endif + mutex_alloc(mx_lock); persistent_servers = malloc(sizeof(TsHashTable)); @@ -574,19 +577,19 @@ le_stmt = zend_register_list_destructors_ex(_oci_stmt_list_dtor, NULL, "oci8 statement", module_number); le_conn = zend_register_list_destructors_ex(php_oci_free_conn_list, NULL, "oci8 connection", module_number); le_desc = zend_register_list_destructors_ex(_oci_descriptor_list_dtor, NULL, "oci8 descriptor", module_number); -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS le_coll = zend_register_list_destructors_ex(_oci_coll_list_dtor, NULL, "oci8 collection", module_number); #endif le_server = zend_register_list_destructors_ex(_oci_server_list_dtor, NULL, "oci8 server", module_number); le_session = zend_register_list_destructors_ex(_oci_session_list_dtor, NULL, "oci8 session", module_number); INIT_CLASS_ENTRY(oci_lob_class_entry, "OCI-Lob", php_oci_lob_class_functions); -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS INIT_CLASS_ENTRY(oci_coll_class_entry, "OCI-Collection", php_oci_coll_class_functions); #endif oci_lob_class_entry_ptr = zend_register_internal_class(&oci_lob_class_entry TSRMLS_CC); -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS oci_coll_class_entry_ptr = zend_register_internal_class(&oci_coll_class_entry TSRMLS_CC); #endif @@ -611,7 +614,7 @@ REGISTER_LONG_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SQLT_RDD",SQLT_RDD, CONST_CS | CONST_PERSISTENT); -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS REGISTER_LONG_CONSTANT("OCI_B_SQLT_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("OCI_SYSDATE","SYSDATE",CONST_PERSISTENT); #endif @@ -712,7 +715,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "OCI8 Support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.222 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.223 $"); sprintf(buf, "%ld", num_persistent); php_info_print_table_row(2, "Active Persistent Links", buf); @@ -724,6 +727,19 @@ php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_OCI8_DIR ); php_info_print_table_row(2, "Libraries Used", PHP_OCI8_SHARED_LIBADD ); #endif + +#ifdef HAVE_OCI8_TEMP_LOB + php_info_print_table_row(2, "Temporary Lob support", "enabled" ); +#else + php_info_print_table_row(2, "Temporary Lob support", "disabled" ); +#endif + +#ifdef HAVE_OCI8_COLLECTIONS + php_info_print_table_row(2, "Collections support", "enabled" ); +#else + php_info_print_table_row(2, "Collections support", "disabled" ); +#endif + php_info_print_table_end(); } @@ -940,7 +956,7 @@ } /* }}} */ -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS /* {{{ _oci_coll_list_dtor() */ @@ -972,8 +988,6 @@ oci_descriptor *descr = (oci_descriptor *)rsrc->ptr; oci_debug("START _oci_descriptor_list_dtor: %d",descr->id); - zend_list_delete(descr->conn->id); - CALL_OCI(OCIDescriptorFree( descr->ocidescr, Z_TYPE_P(descr))); @@ -1286,7 +1300,7 @@ return descr; } -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS /* {{{ _oci_get_ocicoll() */ @@ -3192,7 +3206,7 @@ oci_statement *bindstmt; oci_bind bind, *bindp; oci_descriptor *descr; -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS oci_collection *coll; dvoid *mycoll = 0; #endif @@ -3221,7 +3235,7 @@ OCI_GET_STMT(statement,stmt); switch (ocitype) { -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS case SQLT_NTY: if(Z_TYPE_PP(var) != IS_OBJECT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variable must be allocated using OCINewCollection()"); @@ -3334,7 +3348,7 @@ } } -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS if (ocitype == SQLT_NTY) { /* Bind object */ CALL_OCI_RETURN(statement->error, OCIBindObject( @@ -5880,7 +5894,7 @@ /* }}} */ -#ifdef WITH_COLLECTIONS +#ifdef PHP_OCI8_HAVE_COLLECTIONS /* {{{ oci_get_coll() */ static oci_collection *oci_get_coll(int ind TSRMLS_DC)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php