From: Christopher Jones Date: Thu, 5 Jun 2008 23:40:42 +0000 (+0000) Subject: OCI8: Remove macros obsoleted by rev 1.71 when Oracle 8 support was dropped X-Git-Tag: BEFORE_HEAD_NS_CHANGE~1587 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae46d3ca77cc49016edc77733214872b1007ceaa;p=php OCI8: Remove macros obsoleted by rev 1.71 when Oracle 8 support was dropped --- diff --git a/ext/oci8/README b/ext/oci8/README index de643ee72b..74d1e18c28 100644 --- a/ext/oci8/README +++ b/ext/oci8/README @@ -11,6 +11,9 @@ Installing OCI8 1. Common requirements ---------------------- +This version of PHP OCI8 will build with Oracle 9.2 (or more recent) +client libraries. + If you use a common Oracle Client installation that comes with the Oracle server installation, you MUST set at least the ORACLE_HOME environment variable and make it visible for your web-server BEFORE it diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4 index 78454fc831..33510ca024 100644 --- a/ext/oci8/config.m4 +++ b/ext/oci8/config.m4 @@ -83,8 +83,10 @@ AC_DEFUN([AC_OCI8_ORACLE_VERSION],[ elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then OCI8_ORACLE_VERSION=11.1 elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then + dnl There is no case for Oracle 10.2. Oracle 10.2 libraries have a 10.1 suffix for drop-in compatibility with Oracle 10.1 OCI8_ORACLE_VERSION=10.1 elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then + dnl There is no case for Oracle 9.2. Oracle 9.2 libraries have a 9.0 suffix for drop-in compatibility with Oracle 9.0 OCI8_ORACLE_VERSION=9.0 elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then OCI8_ORACLE_VERSION=8.1 @@ -97,7 +99,7 @@ AC_DEFUN([AC_OCI8_ORACLE_VERSION],[ OCI8_ORACLE_VERSION=8.1 fi else - AC_MSG_ERROR(Oracle-OCI8 needed libraries not found) + AC_MSG_ERROR(Oracle client libraries not found) fi AC_MSG_RESULT($OCI8_ORACLE_VERSION) ]) @@ -204,58 +206,23 @@ if test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then case $OCI8_ORACLE_VERSION in 7.3|8.0|8.1) - AC_MSG_ERROR([Oracle client libraries < 9.0 are not supported any more. Please consider upgrading.]) + AC_MSG_ERROR([Oracle client libraries < 9.2 are not supported.]) ;; 9.0) - PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD) - PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD) - - dnl These functions are only available in version >= 9.2 PHP_CHECK_LIBRARY(clntsh, OCIEnvNlsCreate, [ - PHP_CHECK_LIBRARY(clntsh, OCINlsCharSetNameToId, - [ - AC_DEFINE(HAVE_OCI_ENV_NLS_CREATE,1,[ ]) - OCI8_ORACLE_VERSION=9.2 - ], [], [ - -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD - ]) - ], [], [ - -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD - ]) - - PHP_CHECK_LIBRARY(clntsh, OCIEnvCreate, - [ - AC_DEFINE(HAVE_OCI_ENV_CREATE,1,[ ]) - ], [], [ - -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD - ]) - - PHP_CHECK_LIBRARY(clntsh, OCIStmtPrepare2, + OCI8_ORACLE_VERSION=9.2 + ], [ - AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ]) - ], [], [ - -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD - ]) - - PHP_CHECK_LIBRARY(clntsh, OCILobRead2, - [ - AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ]) - ], [], [ + AC_MSG_ERROR([Oracle client libraries < 9.2 are not supported.]) + ], [ -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD ]) ;; - 11.1|10.1) - PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD) - PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD) - AC_DEFINE(HAVE_OCI_ENV_NLS_CREATE,1,[ ]) - AC_DEFINE(HAVE_OCI_ENV_CREATE,1,[ ]) - AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ]) + 10.1|11.1) AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ]) - AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ]) - AC_DEFINE(PHP_OCI8_HAVE_COLLECTIONS,1,[ ]) ;; *) @@ -263,39 +230,9 @@ if test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then ;; esac - dnl - dnl Check if we need to add -locijdbc8 - dnl - PHP_CHECK_LIBRARY(clntsh, OCILobIsTemporary, - [ - AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ]) - ], [ - PHP_CHECK_LIBRARY(ocijdbc8, OCILobIsTemporary, - [ - PHP_ADD_LIBRARY(ocijdbc8, 1, OCI8_SHARED_LIBADD) - AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ]) - ], [], [ - -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD - ]) - ], [ - -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD - ]) - - dnl - dnl Check if we have collections - dnl - PHP_CHECK_LIBRARY(clntsh, OCICollAssign, - [ - AC_DEFINE(PHP_OCI8_HAVE_COLLECTIONS,1,[ ]) - PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared) - ], - [ - PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_interface.c, $ext_shared) - ], - [ - -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD - ]) - + PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD) + PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD) + PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared) AC_DEFINE(HAVE_OCI8,1,[ ]) PHP_SUBST_OLD(OCI8_SHARED_LIBADD) @@ -359,7 +296,7 @@ dnl Header directory for manual installation AC_OCI8IC_VERSION($PHP_OCI8_INSTANT_CLIENT) case $OCI8_ORACLE_VERSION in - 11.1|10.1) + 10.1|11.1) PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD) PHP_ADD_LIBPATH($PHP_OCI8_INSTANT_CLIENT, OCI8_SHARED_LIBADD) ;; @@ -370,12 +307,7 @@ dnl Header directory for manual installation esac AC_DEFINE(HAVE_OCI_INSTANT_CLIENT,1,[ ]) - AC_DEFINE(HAVE_OCI_ENV_NLS_CREATE,1,[ ]) - AC_DEFINE(HAVE_OCI_ENV_CREATE,1,[ ]) - AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ]) AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ]) - AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ]) - AC_DEFINE(PHP_OCI8_HAVE_COLLECTIONS,1,[ ]) PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared) AC_DEFINE(HAVE_OCI8,1,[ ]) diff --git a/ext/oci8/config.w32 b/ext/oci8/config.w32 index 580e3ff80b..ab53d2f594 100644 --- a/ext/oci8/config.w32 +++ b/ext/oci8/config.w32 @@ -13,15 +13,10 @@ if (PHP_OCI8 != "no") { AC_DEFINE('HAVE_OCI8', 1); AC_DEFINE('HAVE_OCI_INSTANT_CLIENT', 1); - AC_DEFINE('HAVE_OCI_ENV_NLS_CREATE', 1); - AC_DEFINE('HAVE_OCI_ENV_CREATE', 1); - AC_DEFINE('HAVE_OCI_STMT_PREPARE2', 1); AC_DEFINE('HAVE_OCI_LOB_READ2', 1); - AC_DEFINE('HAVE_OCI8_TEMP_LOB', 1); - AC_DEFINE('PHP_OCI8_HAVE_COLLECTIONS', 1); } else { - WARNING("oci8 not enabled; libraries and headers not found"); + WARNING("oci8 not enabled; Oracle Database libraries or Oracle 10g Instant Client not found"); } } diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index d85ce6f3de..6a35231024 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -52,14 +52,10 @@ int le_pconnection; int le_statement; int le_descriptor; int le_psessionpool; -#ifdef PHP_OCI8_HAVE_COLLECTIONS int le_collection; -#endif zend_class_entry *oci_lob_class_entry_ptr; -#ifdef PHP_OCI8_HAVE_COLLECTIONS zend_class_entry *oci_coll_class_entry_ptr; -#endif #ifndef SQLT_BFILEE #define SQLT_BFILEE 114 @@ -83,9 +79,7 @@ static void php_oci_pconnection_list_np_dtor (zend_rsrc_list_entry * TSRMLS_DC); static void php_oci_statement_list_dtor (zend_rsrc_list_entry * TSRMLS_DC); static void php_oci_descriptor_list_dtor (zend_rsrc_list_entry * TSRMLS_DC); static void php_oci_spool_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC); -#ifdef PHP_OCI8_HAVE_COLLECTIONS static void php_oci_collection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC); -#endif static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC); #ifdef ZTS @@ -186,11 +180,8 @@ PHP_FUNCTION(oci_lob_read); PHP_FUNCTION(oci_lob_eof); PHP_FUNCTION(oci_lob_seek); PHP_FUNCTION(oci_lob_size); -#ifdef HAVE_OCI8_TEMP_LOB PHP_FUNCTION(oci_lob_write_temporary); PHP_FUNCTION(oci_lob_close); -#endif -#ifdef PHP_OCI8_HAVE_COLLECTIONS PHP_FUNCTION(oci_new_collection); PHP_FUNCTION(oci_free_collection); PHP_FUNCTION(oci_collection_append); @@ -200,7 +191,6 @@ PHP_FUNCTION(oci_collection_assign); PHP_FUNCTION(oci_collection_size); PHP_FUNCTION(oci_collection_max); PHP_FUNCTION(oci_collection_trim); -#endif /* }}} */ /* {{{ extension definition structures @@ -264,7 +254,6 @@ static const zend_function_entry php_oci_functions[] = { PHP_FE(oci_new_descriptor, NULL) PHP_FE(oci_set_prefetch, NULL) PHP_FE(oci_password_change, NULL) -#ifdef PHP_OCI8_HAVE_COLLECTIONS PHP_FE(oci_free_collection, NULL) PHP_FE(oci_collection_append, NULL) PHP_FE(oci_collection_element_get, NULL) @@ -274,7 +263,6 @@ static const zend_function_entry php_oci_functions[] = { PHP_FE(oci_collection_max, NULL) PHP_FE(oci_collection_trim, NULL) PHP_FE(oci_new_collection, NULL) -#endif PHP_FALIAS(oci_free_cursor, oci_free_statement, NULL) PHP_FALIAS(ocifreecursor, oci_free_statement, NULL) @@ -315,7 +303,6 @@ static const zend_function_entry php_oci_functions[] = { PHP_FALIAS(ocinewdescriptor, oci_new_descriptor, NULL) PHP_FALIAS(ocisetprefetch, oci_set_prefetch, NULL) PHP_FALIAS(ocipasswordchange, oci_password_change, NULL) -#ifdef PHP_OCI8_HAVE_COLLECTIONS PHP_FALIAS(ocifreecollection, oci_free_collection, NULL) PHP_FALIAS(ocinewcollection, oci_new_collection, NULL) PHP_FALIAS(ocicollappend, oci_collection_append, NULL) @@ -324,7 +311,6 @@ static const zend_function_entry php_oci_functions[] = { PHP_FALIAS(ocicollsize, oci_collection_size, NULL) PHP_FALIAS(ocicollmax, oci_collection_max, NULL) PHP_FALIAS(ocicolltrim, oci_collection_trim, NULL) -#endif {NULL,NULL,NULL} }; @@ -346,17 +332,14 @@ static const zend_function_entry php_oci_lob_class_functions[] = { PHP_FALIAS(writetofile, oci_lob_export, NULL) PHP_FALIAS(export, oci_lob_export, NULL) PHP_FALIAS(import, oci_lob_import, NULL) -#ifdef HAVE_OCI8_TEMP_LOB PHP_FALIAS(writetemporary, oci_lob_write_temporary, NULL) PHP_FALIAS(close, oci_lob_close, NULL) -#endif PHP_FALIAS(save, oci_lob_save, NULL) PHP_FALIAS(savefile, oci_lob_import, NULL) PHP_FALIAS(free, oci_free_descriptor, NULL) {NULL,NULL,NULL} }; -#ifdef PHP_OCI8_HAVE_COLLECTIONS static const zend_function_entry php_oci_coll_class_functions[] = { PHP_FALIAS(append, oci_collection_append, NULL) PHP_FALIAS(getelem, oci_collection_element_get, NULL) @@ -368,7 +351,6 @@ static const zend_function_entry php_oci_coll_class_functions[] = { PHP_FALIAS(free, oci_free_collection, NULL) {NULL,NULL,NULL} }; -#endif zend_module_entry oci8_module_entry = { STANDARD_MODULE_HEADER, @@ -415,7 +397,7 @@ static void php_oci_init_global_handles(TSRMLS_D) sb4 error_code = 0; text tmp_buf[PHP_OCI_ERRBUF_LEN]; - errcode = OCIEnvInit (&OCI_G(env), OCI_DEFAULT, 0, NULL); + errcode = OCIEnvNlsCreate(&OCI_G(env), OCI_DEFAULT, 0, NULL, NULL, NULL, 0, NULL, 0, 0); if (errcode == OCI_ERROR) { goto oci_error; @@ -483,15 +465,9 @@ static PHP_GINIT_FUNCTION(oci) PHP_MINIT_FUNCTION(oci) { zend_class_entry oci_lob_class_entry; -#ifdef PHP_OCI8_HAVE_COLLECTIONS zend_class_entry oci_coll_class_entry; -#endif -#ifdef PHP_OCI8_HAVE_COLLECTIONS #define PHP_OCI_INIT_MODE_TMP OCI_DEFAULT | OCI_OBJECT -#else -#define PHP_OCI_INIT_MODE_TMP OCI_DEFAULT -#endif #ifdef ZTS #define PHP_OCI_INIT_MODE PHP_OCI_INIT_MODE_TMP | OCI_THREADED @@ -499,10 +475,6 @@ PHP_MINIT_FUNCTION(oci) #define PHP_OCI_INIT_MODE PHP_OCI_INIT_MODE_TMP #endif -#if !HAVE_OCI_ENV_CREATE - OCIInitialize(PHP_OCI_INIT_MODE, NULL, NULL, NULL, NULL); -#endif - REGISTER_INI_ENTRIES(); le_statement = zend_register_list_destructors_ex(php_oci_statement_list_dtor, NULL, "oci8 statement", module_number); @@ -510,19 +482,13 @@ PHP_MINIT_FUNCTION(oci) le_pconnection = zend_register_list_destructors_ex(php_oci_pconnection_list_np_dtor, php_oci_pconnection_list_dtor, "oci8 persistent connection", module_number); le_psessionpool = zend_register_list_destructors_ex(NULL, php_oci_spool_list_dtor, "oci8 persistent session pool", module_number); le_descriptor = zend_register_list_destructors_ex(php_oci_descriptor_list_dtor, NULL, "oci8 descriptor", module_number); -#ifdef PHP_OCI8_HAVE_COLLECTIONS le_collection = zend_register_list_destructors_ex(php_oci_collection_list_dtor, NULL, "oci8 collection", module_number); -#endif INIT_CLASS_ENTRY(oci_lob_class_entry, "OCI-Lob", php_oci_lob_class_functions); -#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 PHP_OCI8_HAVE_COLLECTIONS oci_coll_class_entry_ptr = zend_register_internal_class(&oci_coll_class_entry TSRMLS_CC); -#endif /* thies@thieso.net 990203 i do not think that we will need all of them - just in here for completeness for now! */ REGISTER_LONG_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); @@ -566,11 +532,9 @@ PHP_MINIT_FUNCTION(oci) REGISTER_LONG_CONSTANT("SQLT_BFLOAT",SQLT_BFLOAT, CONST_CS | CONST_PERSISTENT); #endif -#ifdef PHP_OCI8_HAVE_COLLECTIONS REGISTER_LONG_CONSTANT("OCI_B_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SQLT_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("OCI_SYSDATE","SYSDATE", CONST_CS | CONST_PERSISTENT); -#endif REGISTER_LONG_CONSTANT("OCI_B_BFILE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OCI_B_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); @@ -603,10 +567,8 @@ PHP_MINIT_FUNCTION(oci) REGISTER_LONG_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); /* for OCIWriteTemporaryLob */ -#ifdef HAVE_OCI8_TEMP_LOB REGISTER_LONG_CONSTANT("OCI_TEMP_CLOB",OCI_TEMP_CLOB, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OCI_TEMP_BLOB",OCI_TEMP_BLOB, CONST_CS | CONST_PERSISTENT); -#endif return SUCCESS; } @@ -632,10 +594,6 @@ PHP_MSHUTDOWN_FUNCTION(oci) php_oci_cleanup_global_handles(TSRMLS_C); #endif -#if !HAVE_OCI_ENV_CREATE - OCITerminate(OCI_DEFAULT); -#endif - return SUCCESS; } @@ -645,9 +603,7 @@ PHP_RSHUTDOWN_FUNCTION(oci) #ifdef ZTS zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_descriptor TSRMLS_CC); -#ifdef PHP_OCI8_HAVE_COLLECTIONS zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_collection TSRMLS_CC); -#endif while (OCI_G(num_statements)) { zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_statement TSRMLS_CC); } @@ -698,20 +654,9 @@ PHP_MINFO_FUNCTION(oci) #endif #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 PHP_OCI8_HAVE_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(); - DISPLAY_INI_ENTRIES(); } /* }}} */ @@ -824,7 +769,6 @@ static void php_oci_descriptor_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) php_oci_lob_free(descriptor TSRMLS_CC); } /* }}} */ -#ifdef PHP_OCI8_HAVE_COLLECTIONS /* {{{ php_oci_collection_list_dtor() * * Collection destructor @@ -834,7 +778,6 @@ static void php_oci_collection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) php_oci_collection *collection = (php_oci_collection *)entry->ptr; php_oci_collection_close(collection TSRMLS_CC); } /* }}} */ -#endif /* }}} */ @@ -1128,10 +1071,8 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr zend_bool use_spool = 1; /* Default is to use client-side session pool */ zend_bool ping_done = 0; -#if HAVE_OCI_ENV_NLS_CREATE ub2 charsetid = 0; ub2 charsetid_nls_lang = 0; -#endif switch (session_mode) { case OCI_DEFAULT: @@ -1193,7 +1134,6 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr php_oci_init_global_handles(TSRMLS_C); } -#if HAVE_OCI_ENV_NLS_CREATE if (!UG(unicode)) { if (charset.s && *charset.s) { PHP_OCI_CALL_RETURN(charsetid, OCINlsCharSetNameToId, (OCI_G(env), (CONST oratext *)charset.s)); @@ -1220,12 +1160,6 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr smart_str_append_unsigned_ex(&hashed_details, charsetid, 0); } -#else - if (charset && *charset) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Your version of Oracle Client doesn't support setting the charset; bad or no charset conversions may result"); - } -#endif - timestamp = time(NULL); smart_str_append_unsigned_ex(&hashed_details, session_mode, 0); @@ -1435,13 +1369,11 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr smart_str_free_ex(&hashed_details, 0); -#if HAVE_OCI_ENV_NLS_CREATE if (charsetid) { connection->charset = charsetid; } else { connection->charset = charsetid_nls_lang; } -#endif /* Old session creation semantics when session pool cannot be used Eg: privileged * connect/password change @@ -1839,9 +1771,7 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR lob_fetch_status = php_oci_lob_read(descriptor, -1, 0, &lob_buffer, &lob_length TSRMLS_CC); lob_fetch_status |= (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC) > 0); -#ifdef HAVE_OCI8_TEMP_LOB php_oci_temp_lob_close(descriptor TSRMLS_CC); -#endif if (lob_fetch_status) { ZVAL_FALSE(value); return 1; @@ -2193,34 +2123,18 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC) { OCIEnv *retenv = NULL; - /* allocate environment handle */ -#if HAVE_OCI_ENV_NLS_CREATE -#define PHP_OCI_INIT_FUNC_NAME "OCIEnvNlsCreate" - - /* create an environment using the character set id, Oracle 9i+ ONLY */ + /* create an environment using the character set id */ PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIEnvNlsCreate, (&retenv, OCI_G(events) ? PHP_OCI_INIT_MODE | OCI_EVENTS : PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL, charsetid, charsetid)); -#elif HAVE_OCI_ENV_CREATE -#define PHP_OCI_INIT_FUNC_NAME "OCIEnvCreate" - - /* allocate env handle without NLS support */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIEnvCreate, (&retenv, PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL)); -#else -#define PHP_OCI_INIT_FUNC_NAME "OCIEnvInit" - - /* the simpliest way */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIEnvInit, (&retenv, OCI_DEFAULT, 0, NULL)); -#endif - if (OCI_G(errcode) != OCI_SUCCESS) { #ifdef HAVE_OCI_INSTANT_CLIENT # ifdef PHP_WIN32 - php_error_docref(NULL TSRMLS_CC, E_WARNING, PHP_OCI_INIT_FUNC_NAME "() failed. There is something wrong with your system - please check that PATH includes the directory with Oracle Instant Client libraries"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that PATH includes the directory with Oracle Instant Client libraries"); # else - php_error_docref(NULL TSRMLS_CC, E_WARNING, PHP_OCI_INIT_FUNC_NAME "() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries"); # endif #else - php_error_docref(NULL TSRMLS_CC, E_WARNING, PHP_OCI_INIT_FUNC_NAME "() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory"); #endif return NULL; } @@ -2234,6 +2148,8 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC) */ static int php_oci_old_create_session(php_oci_connection *connection, zstr dbname, int dbname_len, zstr username, int username_len, zstr password, int password_len, zstr new_password, int new_password_len, int session_mode, zend_uchar type TSRMLS_DC) { + ub4 statement_cache_size = (OCI_G(statement_cache_size) > 0) ? OCI_G(statement_cache_size) : 0; + if (OCI_G(debug_mode)) { php_printf ("OCI8 DEBUG: Bypassing client-side session pool for session create at (%s:%d) \n", __FILE__, __LINE__); } @@ -2339,13 +2255,8 @@ static int php_oci_old_create_session(php_oci_connection *connection, zstr dbnam /* start the session {{{ */ switch (session_mode) { case OCI_DEFAULT: -#if HAVE_OCI_STMT_PREPARE2 /* statement caching is suported only in Oracle 9+ */ PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) OCI_STMT_CACHE)); -#else - /* Others cannot use stmt caching, so we call OCISessionBegin() with OCI_DEFAULT */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) OCI_DEFAULT)); -#endif break; case OCI_SYSDBA: case OCI_SYSOPER: @@ -2375,18 +2286,12 @@ static int php_oci_old_create_session(php_oci_connection *connection, zstr dbnam return 1; } -#if HAVE_OCI_STMT_PREPARE2 - { - ub4 statement_cache_size = (OCI_G(statement_cache_size) > 0) ? OCI_G(statement_cache_size) : 0; + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err))); - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err))); - - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - return 1; - } + if (OCI_G(errcode) != OCI_SUCCESS) { + php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + return 1; } -#endif /* Successfully created session */ return 0; @@ -2403,6 +2308,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool ub4 purity = -2; /* Illegal value to initialize */ #endif time_t timestamp = time(NULL); + ub4 statement_cache_size = (OCI_G(statement_cache_size) > 0) ? OCI_G(statement_cache_size) : 0; /* Persistent connections have private session pools */ if (connection->is_persistent && !connection->private_spool && @@ -2535,18 +2441,12 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool } /* If ping applicable */ } while (!(connection->svc)); -#if HAVE_OCI_STMT_PREPARE2 - { - ub4 statement_cache_size = (OCI_G(statement_cache_size) > 0) ? OCI_G(statement_cache_size) : 0; - - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err))); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - return 1; - } + if (OCI_G(errcode) != OCI_SUCCESS) { + php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + return 1; } -#endif /* Session is now taken from the session pool and attached and open */ connection->is_stub = 0; diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index a1ef6630cd..251f7bffca 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -37,7 +37,7 @@ #include "ext/standard/info.h" #include "php_ini.h" -#if HAVE_OCI8 && PHP_OCI8_HAVE_COLLECTIONS +#if HAVE_OCI8 #include "php_oci8.h" #include "php_oci8_int.h" diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 9bf35c5f92..4516601e90 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -1002,7 +1002,6 @@ PHP_FUNCTION(oci_lob_export) } /* }}} */ -#ifdef HAVE_OCI8_TEMP_LOB /* {{{ proto bool oci_lob_write_temporary(string var [, int lob_type]) U Writes temporary blob */ PHP_FUNCTION(oci_lob_write_temporary) @@ -1065,7 +1064,6 @@ PHP_FUNCTION(oci_lob_close) RETURN_TRUE; } /* }}} */ -#endif /* {{{ proto object oci_new_descriptor(resource connection [, int type]) U Initialize a new empty descriptor LOB/FILE (LOB is default) */ @@ -1943,7 +1941,6 @@ PHP_FUNCTION(oci_num_rows) } /* }}} */ -#ifdef PHP_OCI8_HAVE_COLLECTIONS /* {{{ proto bool oci_free_collection() U Deletes collection object*/ PHP_FUNCTION(oci_free_collection) @@ -2228,8 +2225,6 @@ PHP_FUNCTION(oci_new_collection) } /* }}} */ -#endif - #endif /* HAVE_OCI8 */ /* diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c index b6fbe89cf0..dcdf17760f 100644 --- a/ext/oci8/oci8_lob.c +++ b/ext/oci8/oci8_lob.c @@ -682,11 +682,9 @@ void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC) php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE TSRMLS_CC); } -#ifdef HAVE_OCI8_TEMP_LOB if (descriptor->type == OCI_DTYPE_LOB) { php_oci_temp_lob_close(descriptor TSRMLS_CC); } -#endif PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type)); diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index ce41ef2397..2fe2eef168 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -49,19 +49,14 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, zst statement = ecalloc(1,sizeof(php_oci_statement)); -#if HAVE_OCI_STMT_PREPARE2 if (!query_len) { /* do not allocate stmt handle for refcursors, we'll get it from OCIStmtPrepare2() */ PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NULL)); } -#else - PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NULL)); -#endif PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NULL)); if (query_len > 0) { -#if HAVE_OCI_STMT_PREPARE2 PHP_OCI_CALL_RETURN(connection->errcode, OCIStmtPrepare2, ( connection->svc, @@ -75,19 +70,11 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, zst OCI_DEFAULT ) ); -#else - PHP_OCI_CALL_RETURN(connection->errcode, OCIStmtPrepare, (statement->stmt, connection->err, (text *)query, query_len, OCI_NTV_SYNTAX, OCI_DEFAULT)); -#endif if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); -#if HAVE_OCI_STMT_PREPARE2 PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT)); PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR)); -#else - PHP_OCI_CALL(OCIHandleFree,(statement->stmt, OCI_HTYPE_STMT)); - PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR)); -#endif efree(statement); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); @@ -745,15 +732,11 @@ int php_oci_statement_cancel(php_oci_statement *statement TSRMLS_DC) void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC) { if (statement->stmt) { -#if HAVE_OCI_STMT_PREPARE2 if (statement->last_query_len) { /* FIXME: magical */ PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT)); } else { PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT)); } -#else - PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT)); -#endif statement->stmt = 0; } @@ -937,9 +920,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) Bind zval to the given placeholder */ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len, zval* var, long maxlength, long type, zend_uchar uni_type TSRMLS_DC) { -#ifdef PHP_OCI8_HAVE_COLLECTIONS php_oci_collection *bind_collection = NULL; -#endif php_oci_descriptor *bind_descriptor = NULL; php_oci_statement *bind_statement = NULL; dvoid *oci_desc = NULL; @@ -951,7 +932,6 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len, sb4 value_sz = -1; switch (type) { -#ifdef PHP_OCI8_HAVE_COLLECTIONS case SQLT_NTY: { zval **tmp; @@ -970,7 +950,6 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len, } } break; -#endif case SQLT_BFILEE: case SQLT_CFILEE: case SQLT_CLOB: @@ -1116,7 +1095,6 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len, } } -#ifdef PHP_OCI8_HAVE_COLLECTIONS if (type == SQLT_NTY) { /* Bind object */ PHP_OCI_CALL_RETURN(statement->errcode, OCIBindObject, @@ -1137,7 +1115,6 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len, return 1; } } -#endif return 0; } /* }}} */ diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h index e40d44dd54..0ca4083ad8 100644 --- a/ext/oci8/php_oci8_int.h +++ b/ext/oci8/php_oci8_int.h @@ -59,16 +59,12 @@ extern int le_connection; extern int le_pconnection; extern int le_statement; extern int le_descriptor; -#ifdef PHP_OCI8_HAVE_COLLECTIONS extern int le_collection; -#endif extern int le_server; extern int le_session; extern zend_class_entry *oci_lob_class_entry_ptr; -#ifdef PHP_OCI8_HAVE_COLLECTIONS extern zend_class_entry *oci_coll_class_entry_ptr; -#endif /* constants {{{ */ #define PHP_OCI_SEEK_SET 0 @@ -396,11 +392,9 @@ int php_oci_lob_flush (php_oci_descriptor *, long TSRMLS_DC); int php_oci_lob_set_buffering (php_oci_descriptor *, int TSRMLS_DC); int php_oci_lob_get_buffering (php_oci_descriptor *); int php_oci_lob_copy (php_oci_descriptor *, php_oci_descriptor *, long TSRMLS_DC); -#ifdef HAVE_OCI8_TEMP_LOB int php_oci_lob_close (php_oci_descriptor * TSRMLS_DC); int php_oci_temp_lob_close (php_oci_descriptor * TSRMLS_DC); int php_oci_lob_write_tmp (php_oci_descriptor *, ub1, zstr, int TSRMLS_DC); -#endif void php_oci_lob_free(php_oci_descriptor * TSRMLS_DC); int php_oci_lob_import(php_oci_descriptor *descriptor, char * TSRMLS_DC); int php_oci_lob_append (php_oci_descriptor *, php_oci_descriptor * TSRMLS_DC);