mirror of
https://github.com/php/php-src.git
synced 2025-08-20 09:24:05 +02:00
OCI8: Remove macros obsoleted by rev 1.71 when Oracle 8 support was dropped
This commit is contained in:
parent
307edab6ee
commit
ae46d3ca77
9 changed files with 34 additions and 240 deletions
|
@ -11,6 +11,9 @@ Installing OCI8
|
||||||
1. Common requirements
|
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
|
If you use a common Oracle Client installation that comes with the
|
||||||
Oracle server installation, you MUST set at least the ORACLE_HOME
|
Oracle server installation, you MUST set at least the ORACLE_HOME
|
||||||
environment variable and make it visible for your web-server BEFORE it
|
environment variable and make it visible for your web-server BEFORE it
|
||||||
|
|
|
@ -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
|
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
|
||||||
OCI8_ORACLE_VERSION=11.1
|
OCI8_ORACLE_VERSION=11.1
|
||||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
|
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
|
OCI8_ORACLE_VERSION=10.1
|
||||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
|
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
|
OCI8_ORACLE_VERSION=9.0
|
||||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
|
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
|
||||||
OCI8_ORACLE_VERSION=8.1
|
OCI8_ORACLE_VERSION=8.1
|
||||||
|
@ -97,7 +99,7 @@ AC_DEFUN([AC_OCI8_ORACLE_VERSION],[
|
||||||
OCI8_ORACLE_VERSION=8.1
|
OCI8_ORACLE_VERSION=8.1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR(Oracle-OCI8 needed libraries not found)
|
AC_MSG_ERROR(Oracle client libraries not found)
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT($OCI8_ORACLE_VERSION)
|
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
|
case $OCI8_ORACLE_VERSION in
|
||||||
7.3|8.0|8.1)
|
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)
|
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, OCIEnvNlsCreate,
|
||||||
[
|
[
|
||||||
PHP_CHECK_LIBRARY(clntsh, OCINlsCharSetNameToId,
|
OCI8_ORACLE_VERSION=9.2
|
||||||
[
|
],
|
||||||
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,[ ])
|
AC_MSG_ERROR([Oracle client libraries < 9.2 are not supported.])
|
||||||
], [], [
|
], [
|
||||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
|
||||||
])
|
|
||||||
|
|
||||||
PHP_CHECK_LIBRARY(clntsh, OCIStmtPrepare2,
|
|
||||||
[
|
|
||||||
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,[ ])
|
|
||||||
], [], [
|
|
||||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||||
])
|
])
|
||||||
;;
|
;;
|
||||||
|
|
||||||
11.1|10.1)
|
10.1|11.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,[ ])
|
|
||||||
AC_DEFINE(HAVE_OCI_LOB_READ2,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
|
esac
|
||||||
|
|
||||||
dnl
|
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
|
||||||
dnl Check if we need to add -locijdbc8
|
PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD)
|
||||||
dnl
|
PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared)
|
||||||
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
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFINE(HAVE_OCI8,1,[ ])
|
AC_DEFINE(HAVE_OCI8,1,[ ])
|
||||||
|
|
||||||
PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
|
PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
|
||||||
|
@ -359,7 +296,7 @@ dnl Header directory for manual installation
|
||||||
|
|
||||||
AC_OCI8IC_VERSION($PHP_OCI8_INSTANT_CLIENT)
|
AC_OCI8IC_VERSION($PHP_OCI8_INSTANT_CLIENT)
|
||||||
case $OCI8_ORACLE_VERSION in
|
case $OCI8_ORACLE_VERSION in
|
||||||
11.1|10.1)
|
10.1|11.1)
|
||||||
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
|
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
|
||||||
PHP_ADD_LIBPATH($PHP_OCI8_INSTANT_CLIENT, OCI8_SHARED_LIBADD)
|
PHP_ADD_LIBPATH($PHP_OCI8_INSTANT_CLIENT, OCI8_SHARED_LIBADD)
|
||||||
;;
|
;;
|
||||||
|
@ -370,12 +307,7 @@ dnl Header directory for manual installation
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_DEFINE(HAVE_OCI_INSTANT_CLIENT,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_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)
|
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,[ ])
|
AC_DEFINE(HAVE_OCI8,1,[ ])
|
||||||
|
|
|
@ -13,15 +13,10 @@ if (PHP_OCI8 != "no") {
|
||||||
|
|
||||||
AC_DEFINE('HAVE_OCI8', 1);
|
AC_DEFINE('HAVE_OCI8', 1);
|
||||||
AC_DEFINE('HAVE_OCI_INSTANT_CLIENT', 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_OCI_LOB_READ2', 1);
|
||||||
AC_DEFINE('HAVE_OCI8_TEMP_LOB', 1);
|
|
||||||
AC_DEFINE('PHP_OCI8_HAVE_COLLECTIONS', 1);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
WARNING("oci8 not enabled; libraries and headers not found");
|
WARNING("oci8 not enabled; Oracle Database libraries or Oracle 10g Instant Client not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
132
ext/oci8/oci8.c
132
ext/oci8/oci8.c
|
@ -52,14 +52,10 @@ int le_pconnection;
|
||||||
int le_statement;
|
int le_statement;
|
||||||
int le_descriptor;
|
int le_descriptor;
|
||||||
int le_psessionpool;
|
int le_psessionpool;
|
||||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
|
||||||
int le_collection;
|
int le_collection;
|
||||||
#endif
|
|
||||||
|
|
||||||
zend_class_entry *oci_lob_class_entry_ptr;
|
zend_class_entry *oci_lob_class_entry_ptr;
|
||||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
|
||||||
zend_class_entry *oci_coll_class_entry_ptr;
|
zend_class_entry *oci_coll_class_entry_ptr;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SQLT_BFILEE
|
#ifndef SQLT_BFILEE
|
||||||
#define SQLT_BFILEE 114
|
#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_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_descriptor_list_dtor (zend_rsrc_list_entry * TSRMLS_DC);
|
||||||
static void php_oci_spool_list_dtor(zend_rsrc_list_entry *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);
|
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);
|
static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC);
|
||||||
#ifdef ZTS
|
#ifdef ZTS
|
||||||
|
@ -186,11 +180,8 @@ PHP_FUNCTION(oci_lob_read);
|
||||||
PHP_FUNCTION(oci_lob_eof);
|
PHP_FUNCTION(oci_lob_eof);
|
||||||
PHP_FUNCTION(oci_lob_seek);
|
PHP_FUNCTION(oci_lob_seek);
|
||||||
PHP_FUNCTION(oci_lob_size);
|
PHP_FUNCTION(oci_lob_size);
|
||||||
#ifdef HAVE_OCI8_TEMP_LOB
|
|
||||||
PHP_FUNCTION(oci_lob_write_temporary);
|
PHP_FUNCTION(oci_lob_write_temporary);
|
||||||
PHP_FUNCTION(oci_lob_close);
|
PHP_FUNCTION(oci_lob_close);
|
||||||
#endif
|
|
||||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
|
||||||
PHP_FUNCTION(oci_new_collection);
|
PHP_FUNCTION(oci_new_collection);
|
||||||
PHP_FUNCTION(oci_free_collection);
|
PHP_FUNCTION(oci_free_collection);
|
||||||
PHP_FUNCTION(oci_collection_append);
|
PHP_FUNCTION(oci_collection_append);
|
||||||
|
@ -200,7 +191,6 @@ PHP_FUNCTION(oci_collection_assign);
|
||||||
PHP_FUNCTION(oci_collection_size);
|
PHP_FUNCTION(oci_collection_size);
|
||||||
PHP_FUNCTION(oci_collection_max);
|
PHP_FUNCTION(oci_collection_max);
|
||||||
PHP_FUNCTION(oci_collection_trim);
|
PHP_FUNCTION(oci_collection_trim);
|
||||||
#endif
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ extension definition structures
|
/* {{{ extension definition structures
|
||||||
|
@ -264,7 +254,6 @@ static const zend_function_entry php_oci_functions[] = {
|
||||||
PHP_FE(oci_new_descriptor, NULL)
|
PHP_FE(oci_new_descriptor, NULL)
|
||||||
PHP_FE(oci_set_prefetch, NULL)
|
PHP_FE(oci_set_prefetch, NULL)
|
||||||
PHP_FE(oci_password_change, NULL)
|
PHP_FE(oci_password_change, NULL)
|
||||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
|
||||||
PHP_FE(oci_free_collection, NULL)
|
PHP_FE(oci_free_collection, NULL)
|
||||||
PHP_FE(oci_collection_append, NULL)
|
PHP_FE(oci_collection_append, NULL)
|
||||||
PHP_FE(oci_collection_element_get, 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_max, NULL)
|
||||||
PHP_FE(oci_collection_trim, NULL)
|
PHP_FE(oci_collection_trim, NULL)
|
||||||
PHP_FE(oci_new_collection, NULL)
|
PHP_FE(oci_new_collection, NULL)
|
||||||
#endif
|
|
||||||
|
|
||||||
PHP_FALIAS(oci_free_cursor, oci_free_statement, NULL)
|
PHP_FALIAS(oci_free_cursor, oci_free_statement, NULL)
|
||||||
PHP_FALIAS(ocifreecursor, 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(ocinewdescriptor, oci_new_descriptor, NULL)
|
||||||
PHP_FALIAS(ocisetprefetch, oci_set_prefetch, NULL)
|
PHP_FALIAS(ocisetprefetch, oci_set_prefetch, NULL)
|
||||||
PHP_FALIAS(ocipasswordchange, oci_password_change, NULL)
|
PHP_FALIAS(ocipasswordchange, oci_password_change, NULL)
|
||||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
|
||||||
PHP_FALIAS(ocifreecollection, oci_free_collection, NULL)
|
PHP_FALIAS(ocifreecollection, oci_free_collection, NULL)
|
||||||
PHP_FALIAS(ocinewcollection, oci_new_collection, NULL)
|
PHP_FALIAS(ocinewcollection, oci_new_collection, NULL)
|
||||||
PHP_FALIAS(ocicollappend, oci_collection_append, 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(ocicollsize, oci_collection_size, NULL)
|
||||||
PHP_FALIAS(ocicollmax, oci_collection_max, NULL)
|
PHP_FALIAS(ocicollmax, oci_collection_max, NULL)
|
||||||
PHP_FALIAS(ocicolltrim, oci_collection_trim, NULL)
|
PHP_FALIAS(ocicolltrim, oci_collection_trim, NULL)
|
||||||
#endif
|
|
||||||
{NULL,NULL,NULL}
|
{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(writetofile, oci_lob_export, NULL)
|
||||||
PHP_FALIAS(export, oci_lob_export, NULL)
|
PHP_FALIAS(export, oci_lob_export, NULL)
|
||||||
PHP_FALIAS(import, oci_lob_import, NULL)
|
PHP_FALIAS(import, oci_lob_import, NULL)
|
||||||
#ifdef HAVE_OCI8_TEMP_LOB
|
|
||||||
PHP_FALIAS(writetemporary, oci_lob_write_temporary, NULL)
|
PHP_FALIAS(writetemporary, oci_lob_write_temporary, NULL)
|
||||||
PHP_FALIAS(close, oci_lob_close, NULL)
|
PHP_FALIAS(close, oci_lob_close, NULL)
|
||||||
#endif
|
|
||||||
PHP_FALIAS(save, oci_lob_save, NULL)
|
PHP_FALIAS(save, oci_lob_save, NULL)
|
||||||
PHP_FALIAS(savefile, oci_lob_import, NULL)
|
PHP_FALIAS(savefile, oci_lob_import, NULL)
|
||||||
PHP_FALIAS(free, oci_free_descriptor, NULL)
|
PHP_FALIAS(free, oci_free_descriptor, NULL)
|
||||||
{NULL,NULL,NULL}
|
{NULL,NULL,NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
|
||||||
static const zend_function_entry php_oci_coll_class_functions[] = {
|
static const zend_function_entry php_oci_coll_class_functions[] = {
|
||||||
PHP_FALIAS(append, oci_collection_append, NULL)
|
PHP_FALIAS(append, oci_collection_append, NULL)
|
||||||
PHP_FALIAS(getelem, oci_collection_element_get, 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)
|
PHP_FALIAS(free, oci_free_collection, NULL)
|
||||||
{NULL,NULL,NULL}
|
{NULL,NULL,NULL}
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
zend_module_entry oci8_module_entry = {
|
zend_module_entry oci8_module_entry = {
|
||||||
STANDARD_MODULE_HEADER,
|
STANDARD_MODULE_HEADER,
|
||||||
|
@ -415,7 +397,7 @@ static void php_oci_init_global_handles(TSRMLS_D)
|
||||||
sb4 error_code = 0;
|
sb4 error_code = 0;
|
||||||
text tmp_buf[PHP_OCI_ERRBUF_LEN];
|
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) {
|
if (errcode == OCI_ERROR) {
|
||||||
goto oci_error;
|
goto oci_error;
|
||||||
|
@ -483,15 +465,9 @@ static PHP_GINIT_FUNCTION(oci)
|
||||||
PHP_MINIT_FUNCTION(oci)
|
PHP_MINIT_FUNCTION(oci)
|
||||||
{
|
{
|
||||||
zend_class_entry oci_lob_class_entry;
|
zend_class_entry oci_lob_class_entry;
|
||||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
|
||||||
zend_class_entry oci_coll_class_entry;
|
zend_class_entry oci_coll_class_entry;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
|
||||||
#define PHP_OCI_INIT_MODE_TMP OCI_DEFAULT | OCI_OBJECT
|
#define PHP_OCI_INIT_MODE_TMP OCI_DEFAULT | OCI_OBJECT
|
||||||
#else
|
|
||||||
#define PHP_OCI_INIT_MODE_TMP OCI_DEFAULT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ZTS
|
#ifdef ZTS
|
||||||
#define PHP_OCI_INIT_MODE PHP_OCI_INIT_MODE_TMP | OCI_THREADED
|
#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
|
#define PHP_OCI_INIT_MODE PHP_OCI_INIT_MODE_TMP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !HAVE_OCI_ENV_CREATE
|
|
||||||
OCIInitialize(PHP_OCI_INIT_MODE, NULL, NULL, NULL, NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
REGISTER_INI_ENTRIES();
|
REGISTER_INI_ENTRIES();
|
||||||
|
|
||||||
le_statement = zend_register_list_destructors_ex(php_oci_statement_list_dtor, NULL, "oci8 statement", module_number);
|
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_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_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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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! */
|
/* 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);
|
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);
|
REGISTER_LONG_CONSTANT("SQLT_BFLOAT",SQLT_BFLOAT, CONST_CS | CONST_PERSISTENT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
|
||||||
REGISTER_LONG_CONSTANT("OCI_B_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("OCI_B_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("SQLT_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);
|
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_BFILE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("OCI_B_CFILEE",SQLT_CFILEE, 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);
|
REGISTER_LONG_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT);
|
||||||
|
|
||||||
/* for OCIWriteTemporaryLob */
|
/* 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_CLOB",OCI_TEMP_CLOB, CONST_CS | CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("OCI_TEMP_BLOB",OCI_TEMP_BLOB, CONST_CS | CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("OCI_TEMP_BLOB",OCI_TEMP_BLOB, CONST_CS | CONST_PERSISTENT);
|
||||||
#endif
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -632,10 +594,6 @@ PHP_MSHUTDOWN_FUNCTION(oci)
|
||||||
php_oci_cleanup_global_handles(TSRMLS_C);
|
php_oci_cleanup_global_handles(TSRMLS_C);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !HAVE_OCI_ENV_CREATE
|
|
||||||
OCITerminate(OCI_DEFAULT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,9 +603,7 @@ PHP_RSHUTDOWN_FUNCTION(oci)
|
||||||
|
|
||||||
#ifdef ZTS
|
#ifdef ZTS
|
||||||
zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_descriptor TSRMLS_CC);
|
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);
|
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)) {
|
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);
|
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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_OCI8_TEMP_LOB
|
|
||||||
php_info_print_table_row(2, "Temporary Lob support", "enabled");
|
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");
|
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();
|
php_info_print_table_end();
|
||||||
|
|
||||||
DISPLAY_INI_ENTRIES();
|
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);
|
php_oci_lob_free(descriptor TSRMLS_CC);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
|
||||||
/* {{{ php_oci_collection_list_dtor()
|
/* {{{ php_oci_collection_list_dtor()
|
||||||
*
|
*
|
||||||
* Collection destructor
|
* 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 *collection = (php_oci_collection *)entry->ptr;
|
||||||
php_oci_collection_close(collection TSRMLS_CC);
|
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 use_spool = 1; /* Default is to use client-side session pool */
|
||||||
zend_bool ping_done = 0;
|
zend_bool ping_done = 0;
|
||||||
|
|
||||||
#if HAVE_OCI_ENV_NLS_CREATE
|
|
||||||
ub2 charsetid = 0;
|
ub2 charsetid = 0;
|
||||||
ub2 charsetid_nls_lang = 0;
|
ub2 charsetid_nls_lang = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (session_mode) {
|
switch (session_mode) {
|
||||||
case OCI_DEFAULT:
|
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);
|
php_oci_init_global_handles(TSRMLS_C);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_OCI_ENV_NLS_CREATE
|
|
||||||
if (!UG(unicode)) {
|
if (!UG(unicode)) {
|
||||||
if (charset.s && *charset.s) {
|
if (charset.s && *charset.s) {
|
||||||
PHP_OCI_CALL_RETURN(charsetid, OCINlsCharSetNameToId, (OCI_G(env), (CONST oratext *)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);
|
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);
|
timestamp = time(NULL);
|
||||||
|
|
||||||
smart_str_append_unsigned_ex(&hashed_details, session_mode, 0);
|
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);
|
smart_str_free_ex(&hashed_details, 0);
|
||||||
|
|
||||||
#if HAVE_OCI_ENV_NLS_CREATE
|
|
||||||
if (charsetid) {
|
if (charsetid) {
|
||||||
connection->charset = charsetid;
|
connection->charset = charsetid;
|
||||||
} else {
|
} else {
|
||||||
connection->charset = charsetid_nls_lang;
|
connection->charset = charsetid_nls_lang;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Old session creation semantics when session pool cannot be used Eg: privileged
|
/* Old session creation semantics when session pool cannot be used Eg: privileged
|
||||||
* connect/password change
|
* 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_read(descriptor, -1, 0, &lob_buffer, &lob_length TSRMLS_CC);
|
||||||
lob_fetch_status |= (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC) > 0);
|
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);
|
php_oci_temp_lob_close(descriptor TSRMLS_CC);
|
||||||
#endif
|
|
||||||
if (lob_fetch_status) {
|
if (lob_fetch_status) {
|
||||||
ZVAL_FALSE(value);
|
ZVAL_FALSE(value);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2193,34 +2123,18 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC)
|
||||||
{
|
{
|
||||||
OCIEnv *retenv = NULL;
|
OCIEnv *retenv = NULL;
|
||||||
|
|
||||||
/* allocate environment handle */
|
/* create an environment using the character set id */
|
||||||
#if HAVE_OCI_ENV_NLS_CREATE
|
|
||||||
#define PHP_OCI_INIT_FUNC_NAME "OCIEnvNlsCreate"
|
|
||||||
|
|
||||||
/* create an environment using the character set id, Oracle 9i+ ONLY */
|
|
||||||
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));
|
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) {
|
if (OCI_G(errcode) != OCI_SUCCESS) {
|
||||||
#ifdef HAVE_OCI_INSTANT_CLIENT
|
#ifdef HAVE_OCI_INSTANT_CLIENT
|
||||||
# ifdef PHP_WIN32
|
# 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
|
# 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
|
# endif
|
||||||
#else
|
#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
|
#endif
|
||||||
return NULL;
|
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)
|
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)) {
|
if (OCI_G(debug_mode)) {
|
||||||
php_printf ("OCI8 DEBUG: Bypassing client-side session pool for session create at (%s:%d) \n", __FILE__, __LINE__);
|
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 {{{ */
|
/* start the session {{{ */
|
||||||
switch (session_mode) {
|
switch (session_mode) {
|
||||||
case OCI_DEFAULT:
|
case OCI_DEFAULT:
|
||||||
#if HAVE_OCI_STMT_PREPARE2
|
|
||||||
/* statement caching is suported only in Oracle 9+ */
|
/* 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));
|
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;
|
break;
|
||||||
case OCI_SYSDBA:
|
case OCI_SYSDBA:
|
||||||
case OCI_SYSOPER:
|
case OCI_SYSOPER:
|
||||||
|
@ -2375,18 +2286,12 @@ static int php_oci_old_create_session(php_oci_connection *connection, zstr dbnam
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_OCI_STMT_PREPARE2
|
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)));
|
||||||
{
|
|
||||||
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);
|
||||||
if (OCI_G(errcode) != OCI_SUCCESS) {
|
return 1;
|
||||||
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Successfully created session */
|
/* Successfully created session */
|
||||||
return 0;
|
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 */
|
ub4 purity = -2; /* Illegal value to initialize */
|
||||||
#endif
|
#endif
|
||||||
time_t timestamp = time(NULL);
|
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 */
|
/* Persistent connections have private session pools */
|
||||||
if (connection->is_persistent && !connection->private_spool &&
|
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 */
|
} /* If ping applicable */
|
||||||
} while (!(connection->svc));
|
} while (!(connection->svc));
|
||||||
|
|
||||||
#if HAVE_OCI_STMT_PREPARE2
|
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)));
|
||||||
{
|
|
||||||
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);
|
||||||
if (OCI_G(errcode) != OCI_SUCCESS) {
|
return 1;
|
||||||
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 */
|
/* Session is now taken from the session pool and attached and open */
|
||||||
connection->is_stub = 0;
|
connection->is_stub = 0;
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include "ext/standard/info.h"
|
#include "ext/standard/info.h"
|
||||||
#include "php_ini.h"
|
#include "php_ini.h"
|
||||||
|
|
||||||
#if HAVE_OCI8 && PHP_OCI8_HAVE_COLLECTIONS
|
#if HAVE_OCI8
|
||||||
|
|
||||||
#include "php_oci8.h"
|
#include "php_oci8.h"
|
||||||
#include "php_oci8_int.h"
|
#include "php_oci8_int.h"
|
||||||
|
|
|
@ -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
|
/* {{{ proto bool oci_lob_write_temporary(string var [, int lob_type]) U
|
||||||
Writes temporary blob */
|
Writes temporary blob */
|
||||||
PHP_FUNCTION(oci_lob_write_temporary)
|
PHP_FUNCTION(oci_lob_write_temporary)
|
||||||
|
@ -1065,7 +1064,6 @@ PHP_FUNCTION(oci_lob_close)
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
#endif
|
|
||||||
|
|
||||||
/* {{{ proto object oci_new_descriptor(resource connection [, int type]) U
|
/* {{{ proto object oci_new_descriptor(resource connection [, int type]) U
|
||||||
Initialize a new empty descriptor LOB/FILE (LOB is default) */
|
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
|
/* {{{ proto bool oci_free_collection() U
|
||||||
Deletes collection object*/
|
Deletes collection object*/
|
||||||
PHP_FUNCTION(oci_free_collection)
|
PHP_FUNCTION(oci_free_collection)
|
||||||
|
@ -2228,8 +2225,6 @@ PHP_FUNCTION(oci_new_collection)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* HAVE_OCI8 */
|
#endif /* HAVE_OCI8 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -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);
|
php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OCI8_TEMP_LOB
|
|
||||||
if (descriptor->type == OCI_DTYPE_LOB) {
|
if (descriptor->type == OCI_DTYPE_LOB) {
|
||||||
php_oci_temp_lob_close(descriptor TSRMLS_CC);
|
php_oci_temp_lob_close(descriptor TSRMLS_CC);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type));
|
PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type));
|
||||||
|
|
||||||
|
|
|
@ -49,19 +49,14 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, zst
|
||||||
|
|
||||||
statement = ecalloc(1,sizeof(php_oci_statement));
|
statement = ecalloc(1,sizeof(php_oci_statement));
|
||||||
|
|
||||||
#if HAVE_OCI_STMT_PREPARE2
|
|
||||||
if (!query_len) {
|
if (!query_len) {
|
||||||
/* do not allocate stmt handle for refcursors, we'll get it from OCIStmtPrepare2() */
|
/* 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));
|
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));
|
PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NULL));
|
||||||
|
|
||||||
if (query_len > 0) {
|
if (query_len > 0) {
|
||||||
#if HAVE_OCI_STMT_PREPARE2
|
|
||||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIStmtPrepare2,
|
PHP_OCI_CALL_RETURN(connection->errcode, OCIStmtPrepare2,
|
||||||
(
|
(
|
||||||
connection->svc,
|
connection->svc,
|
||||||
|
@ -75,19 +70,11 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, zst
|
||||||
OCI_DEFAULT
|
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) {
|
if (connection->errcode != OCI_SUCCESS) {
|
||||||
connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
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(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT));
|
||||||
PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR));
|
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);
|
efree(statement);
|
||||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
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)
|
void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC)
|
||||||
{
|
{
|
||||||
if (statement->stmt) {
|
if (statement->stmt) {
|
||||||
#if HAVE_OCI_STMT_PREPARE2
|
|
||||||
if (statement->last_query_len) { /* FIXME: magical */
|
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));
|
PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT));
|
||||||
} else {
|
} else {
|
||||||
PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT));
|
PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT));
|
|
||||||
#endif
|
|
||||||
statement->stmt = 0;
|
statement->stmt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -937,9 +920,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
|
||||||
Bind zval to the given placeholder */
|
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)
|
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;
|
php_oci_collection *bind_collection = NULL;
|
||||||
#endif
|
|
||||||
php_oci_descriptor *bind_descriptor = NULL;
|
php_oci_descriptor *bind_descriptor = NULL;
|
||||||
php_oci_statement *bind_statement = NULL;
|
php_oci_statement *bind_statement = NULL;
|
||||||
dvoid *oci_desc = 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;
|
sb4 value_sz = -1;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
|
||||||
case SQLT_NTY:
|
case SQLT_NTY:
|
||||||
{
|
{
|
||||||
zval **tmp;
|
zval **tmp;
|
||||||
|
@ -970,7 +950,6 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case SQLT_BFILEE:
|
case SQLT_BFILEE:
|
||||||
case SQLT_CFILEE:
|
case SQLT_CFILEE:
|
||||||
case SQLT_CLOB:
|
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) {
|
if (type == SQLT_NTY) {
|
||||||
/* Bind object */
|
/* Bind object */
|
||||||
PHP_OCI_CALL_RETURN(statement->errcode, OCIBindObject,
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
|
@ -59,16 +59,12 @@ extern int le_connection;
|
||||||
extern int le_pconnection;
|
extern int le_pconnection;
|
||||||
extern int le_statement;
|
extern int le_statement;
|
||||||
extern int le_descriptor;
|
extern int le_descriptor;
|
||||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
|
||||||
extern int le_collection;
|
extern int le_collection;
|
||||||
#endif
|
|
||||||
extern int le_server;
|
extern int le_server;
|
||||||
extern int le_session;
|
extern int le_session;
|
||||||
|
|
||||||
extern zend_class_entry *oci_lob_class_entry_ptr;
|
extern zend_class_entry *oci_lob_class_entry_ptr;
|
||||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
|
||||||
extern zend_class_entry *oci_coll_class_entry_ptr;
|
extern zend_class_entry *oci_coll_class_entry_ptr;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* constants {{{ */
|
/* constants {{{ */
|
||||||
#define PHP_OCI_SEEK_SET 0
|
#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_set_buffering (php_oci_descriptor *, int TSRMLS_DC);
|
||||||
int php_oci_lob_get_buffering (php_oci_descriptor *);
|
int php_oci_lob_get_buffering (php_oci_descriptor *);
|
||||||
int php_oci_lob_copy (php_oci_descriptor *, php_oci_descriptor *, long TSRMLS_DC);
|
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_lob_close (php_oci_descriptor * TSRMLS_DC);
|
||||||
int php_oci_temp_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);
|
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);
|
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_import(php_oci_descriptor *descriptor, char * TSRMLS_DC);
|
||||||
int php_oci_lob_append (php_oci_descriptor *, php_oci_descriptor * TSRMLS_DC);
|
int php_oci_lob_append (php_oci_descriptor *, php_oci_descriptor * TSRMLS_DC);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue