summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/oci8/README3
-rw-r--r--ext/oci8/config.m494
-rw-r--r--ext/oci8/config.w325
-rw-r--r--ext/oci8/oci8.c136
-rw-r--r--ext/oci8/oci8_collection.c2
-rw-r--r--ext/oci8/oci8_interface.c5
-rw-r--r--ext/oci8/oci8_lob.c2
-rw-r--r--ext/oci8/oci8_statement.c23
-rw-r--r--ext/oci8/php_oci8_int.h6
9 files changed, 35 insertions, 241 deletions
diff --git a/ext/oci8/README b/ext/oci8/README
index cca3c40a97..cc369f833d 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 d97f95c5ca..6fcfc81938 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 bf92afcbae..c6487d6a18 100644
--- a/ext/oci8/config.w32
+++ b/ext/oci8/config.w32
@@ -13,12 +13,7 @@ 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; Oracle Database libraries or Oracle 10g Instant Client not found");
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index e9c13f7d27..7d21b34de3 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -60,14 +60,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
@@ -91,9 +87,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
@@ -194,11 +188,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);
@@ -208,7 +199,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
@@ -277,7 +267,6 @@ 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)
@@ -287,7 +276,6 @@ 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)
@@ -328,7 +316,6 @@ 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)
@@ -337,7 +324,6 @@ 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}
};
@@ -364,17 +350,14 @@ 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
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 2) || (PHP_MAJOR_VERSION > 5)
/* This "if" allows PECL builds from this file to be portable to older PHP releases */
@@ -391,7 +374,6 @@ 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,
@@ -443,7 +425,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;
@@ -516,15 +498,9 @@ static void php_oci_init_globals(zend_oci_globals *oci_globals TSRMLS_DC)
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
@@ -532,10 +508,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
-
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
/* This check allows PECL builds from this file to be portable to older PHP releases */
/* this is handled by new globals management code */
@@ -549,19 +521,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);
@@ -605,11 +571,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);
@@ -625,7 +589,7 @@ PHP_MINIT_FUNCTION(oci)
REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_COLUMN", PHP_OCI_FETCHSTATEMENT_BY_COLUMN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_ROW", PHP_OCI_FETCHSTATEMENT_BY_ROW, CONST_CS | CONST_PERSISTENT);
-/* for OCIFetchInto & OCIResult */
+/* for OCIFetchInto & OCIResult */
REGISTER_LONG_CONSTANT("OCI_ASSOC",PHP_OCI_ASSOC, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_NUM",PHP_OCI_NUM, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_BOTH",PHP_OCI_BOTH, CONST_CS | CONST_PERSISTENT);
@@ -642,10 +606,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;
}
@@ -671,10 +633,6 @@ PHP_MSHUTDOWN_FUNCTION(oci)
php_oci_cleanup_global_handles(TSRMLS_C);
#endif
-#if !HAVE_OCI_ENV_CREATE
- OCITerminate(OCI_DEFAULT);
-#endif
-
return SUCCESS;
}
@@ -684,9 +642,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);
}
@@ -737,20 +693,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();
}
/* }}} */
@@ -863,7 +808,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
@@ -873,7 +817,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
/* }}} */
@@ -1137,10 +1080,8 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
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:
@@ -1205,7 +1146,6 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
php_oci_init_global_handles(TSRMLS_C);
}
-#if HAVE_OCI_ENV_NLS_CREATE
if (charset && *charset) {
PHP_OCI_CALL_RETURN(charsetid, OCINlsCharSetNameToId, (OCI_G(env), (CONST oratext *)charset));
if (!charsetid) {
@@ -1226,11 +1166,6 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
}
smart_str_append_unsigned_ex(&hashed_details, charsetid_nls_lang, 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);
@@ -1438,13 +1373,11 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
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
@@ -1835,9 +1768,7 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
/* PHP_OCI_RETURN_LOBS means that we want the content of the LOB back instead of the locator */
lob_fetch_status = php_oci_lob_read(descriptor, -1, 0, &lob_buffer, &lob_length TSRMLS_CC);
-#ifdef HAVE_OCI8_TEMP_LOB
php_oci_temp_lob_close(descriptor TSRMLS_CC);
-#endif
if (lob_fetch_status) {
ZVAL_FALSE(value);
return 1;
@@ -2177,34 +2108,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;
}
@@ -2218,6 +2133,8 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC)
*/
static int php_oci_old_create_session(php_oci_connection *connection, char *dbname, int dbname_len, char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, int session_mode 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__);
}
@@ -2323,13 +2240,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna
/* 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:
@@ -2359,18 +2270,12 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna
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;
@@ -2387,6 +2292,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 &&
@@ -2519,18 +2425,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)));
-
- if (OCI_G(errcode) != OCI_SUCCESS) {
- php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
- return 1;
- }
+ 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;
}
-#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 7308ddd4ce..75f9dc0ba5 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 dd3a8e30bd..7b872ed894 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -963,7 +963,6 @@ PHP_FUNCTION(oci_lob_export)
}
/* }}} */
-#ifdef HAVE_OCI8_TEMP_LOB
/* {{{ proto bool oci_lob_write_temporary(string var [, int lob_type])
Writes temporary blob */
PHP_FUNCTION(oci_lob_write_temporary)
@@ -1025,7 +1024,6 @@ PHP_FUNCTION(oci_lob_close)
RETURN_TRUE;
}
/* }}} */
-#endif
/* {{{ proto object oci_new_descriptor(resource connection [, int type])
Initialize a new empty descriptor LOB/FILE (LOB is default) */
@@ -1903,7 +1901,6 @@ PHP_FUNCTION(oci_num_rows)
}
/* }}} */
-#ifdef PHP_OCI8_HAVE_COLLECTIONS
/* {{{ proto bool oci_free_collection()
Deletes collection object*/
PHP_FUNCTION(oci_free_collection)
@@ -2188,8 +2185,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 7002d2cf6e..b0be54020c 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -677,11 +677,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 91533f6aa7..9edad57978 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, cha
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, cha
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);
@@ -732,15 +719,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;
}
@@ -902,9 +885,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, char *name, int name_len, zval* var, long maxlength, long 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;
@@ -916,7 +897,6 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
sb4 value_sz = -1;
switch (type) {
-#ifdef PHP_OCI8_HAVE_COLLECTIONS
case SQLT_NTY:
{
zval **tmp;
@@ -935,7 +915,6 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
}
}
break;
-#endif
case SQLT_BFILEE:
case SQLT_CFILEE:
case SQLT_CLOB:
@@ -1071,7 +1050,6 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
}
}
-#ifdef PHP_OCI8_HAVE_COLLECTIONS
if (type == SQLT_NTY) {
/* Bind object */
PHP_OCI_CALL_RETURN(statement->errcode, OCIBindObject,
@@ -1092,7 +1070,6 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *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 13e3149c4f..0a1eab2843 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
@@ -385,11 +381,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, char *, 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);