diff options
Diffstat (limited to 'ext/oci8')
175 files changed, 0 insertions, 17575 deletions
diff --git a/ext/oci8/CREDITS b/ext/oci8/CREDITS deleted file mode 100644 index 18cad81c3e..0000000000 --- a/ext/oci8/CREDITS +++ /dev/null @@ -1,2 +0,0 @@ -OCI8 -Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson, Maxim Maletsky, Harald Radi, Antony Dovgal, Andi Gutmans, Wez Furlong diff --git a/ext/oci8/README b/ext/oci8/README deleted file mode 100644 index b9df41db3a..0000000000 --- a/ext/oci8/README +++ /dev/null @@ -1,61 +0,0 @@ -Installing OCI8 ---------------- - -1. Common requirements. -2. Installing as shared extension. -3. Installing as statically compiled extension. -4. Installing from PECL. - - -1. Common requirements ----------------------- -In case if you use Oracle Instant Client, you don't have to set ORACLE_HOME and -most of the other environment variables to build PHP with OCI8 support. -The only variables you may have to set are: -LD_LIBRARY_PATH - it must include Instant Client libraries dir -NLS_LANG - in case if you want to change the default encoding used during -interaction with Oracle servers - -If you use common Oracle Client installation that comes along with the Oracle -server installation, you MUST set at least ORACLE_HOME environment variable -and make it visible for your web-server BEFORE it starts. Most appropriate -places to add ORACLE_HOME definition are: -- /etc/profile -- /etc/profile.local -- /etc/profile.d -and others. - -2. Installing as shared extension ---------------------------------- -To install OCI8 as shared extension (i.e. the one you should put into -your php.ini) use the following configure lines to configure PHP: -a) if you use common Oracle Client installation: -./configure --with-oci8=shared,$ORACLE_HOME - -b) with Oracle Instant Client: -./configure --with-oci8=shared,instantclient,/path/to/instant/client/lib -If you use rpm-based installation of Oracle Instant Client, your configure -line will look like this: -./configure --with-oci8=shared,instantclient,/usr/lib/oracle/<OIC version>/client/lib - -Follow the usual building procedure after that and you'll get OCI8 shared -extension (i.e. oci8.so). Add it into the php.ini file like this: -extension=oci8.so -and don't forget to specify the right extension_dir for PHP to be able -to find shared extensions correctly. - -3. Installing as statically compiled extension ----------------------------------------------- -To install OCI8 as statically compiled module use the following configure lines: -a) with common Oracle Client installation -./configure --with-oci8=$ORACLE_HOME - -b) with Oracle Instant Client -./configure --with-oci8=instantclient,/path/to/instant/client/lib - -After successful compile, you don't have to add oci8.so to the php.ini, the module will -be usable without any additional actions. - -4. Installing from PECL ------------------------ -TBD diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4 deleted file mode 100644 index 8e04ee7715..0000000000 --- a/ext/oci8/config.m4 +++ /dev/null @@ -1,405 +0,0 @@ -dnl -dnl $Id$ -dnl - -if test -z "$SED"; then - PHP_OCI8_SED="sed"; -else - PHP_OCI8_SED="$SED"; -fi - -AC_DEFUN([PHP_OCI_IF_DEFINED],[ - old_CPPFLAGS=$CPPFLAGS - CPPFLAGS=$3 - AC_EGREP_CPP(yes,[ -#include <oci.h> -#if defined($1) - yes -#endif - ],[ - CPPFLAGS=$old_CPPFLAGS - $2 - ],[ - CPPFLAGS=$old_CPPFLAGS - ]) -]) - -AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[ - AC_CHECK_SIZEOF(long int, 4) - AC_MSG_CHECKING([checking if we're at 64-bit platform]) - if test "$ac_cv_sizeof_long_int" = "4" ; then - AC_MSG_RESULT([no]) - TMP_OCI8_LIB_DIR=lib32 - else - AC_MSG_RESULT([yes]) - TMP_OCI8_LIB_DIR=lib - fi - - AC_MSG_CHECKING([OCI8 libraries dir]) - if test -d "$OCI8_DIR/lib" -a ! -d "$OCI8_DIR/lib32"; then - OCI8_LIB_DIR=lib - elif ! test -d "$OCI8_DIR/lib" -a -d "$OCI8_DIR/lib32"; then - OCI8_LIB_DIR=lib32 - elif test -d "$OCI8_DIR/lib" -a -d "$OCI8_DIR/lib32"; then - OCI8_LIB_DIR=$TMP_OCI8_LIB_DIR - else - AC_MSG_ERROR([Oracle (OCI8) required libraries not found]) - fi - AC_MSG_RESULT($OCI8_LIB_DIR) -]) - -AC_DEFUN([AC_OCI8IC_VERSION],[ - AC_MSG_CHECKING([Oracle Instant Client version]) - if test -f $PHP_OCI8_INSTANT_CLIENT/libnnz10.$SHLIB_SUFFIX_NAME; then - if test -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then - if test ! -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME; then - AC_MSG_ERROR([Link from $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME to libclntsh.$SHLIB_SUFFIX_NAME.10.1 not found]) - fi - OCI8_VERSION=10.1 - else - AC_MSG_ERROR([Oracle Instant Client library version not supported]) - fi - else - AC_MSG_ERROR([Oracle Instant Client libraries not found]) - fi - AC_MSG_RESULT([$OCI8_VERSION]) -]) - - -AC_DEFUN([AC_OCI8_VERSION],[ - AC_MSG_CHECKING([Oracle version]) - if test -s "$OCI8_DIR/orainst/unix.rgs"; then - OCI8_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | $PHP_OCI8_SED 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4` - test -z "$OCI8_VERSION" && OCI8_VERSION=7.3 - elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then - OCI8_VERSION=10.1 - elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then - OCI8_VERSION=9.0 - elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then - OCI8_VERSION=8.1 - elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then - OCI8_VERSION=8.0 - elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.a; then - if test -f $OCI8_DIR/$OCI8_LIB_DIR/libcore4.a; then - OCI8_VERSION=8.0 - else - OCI8_VERSION=8.1 - fi - else - AC_MSG_ERROR(Oracle-OCI8 needed libraries not found) - fi - AC_MSG_RESULT($OCI8_VERSION) -]) - - -dnl --with-oci8=shared,instantclient,/path/to/client/dir/lib -dnl or -dnl --with-oci8=shared,/path/to/oracle/home -PHP_ARG_WITH(oci8, for Oracle (OCI8) support, -[ --with-oci8[=DIR] Include Oracle (OCI8) support. - The default DIR is ORACLE_HOME. - Use --with-oci8=instantclient,/path/to/oic/lib - to use Oracle Instant Client installation]) - - AC_MSG_CHECKING([checking PHP version]) - - tmp_version=$PHP_VERSION - if test -z "$tmp_version"; then - if test -z "$PHP_CONFIG"; then - AC_MSG_ERROR([php-config not found]) - fi - php_version=`$PHP_CONFIG --version 2>/dev/null|head -n 1|sed -e 's#\([0-9]\.[0-9]*\.[0-9]*\)\(.*\)#\1#'` - else - php_version=`echo "$tmp_version"|sed -e 's#\([0-9]\.[0-9]*\.[0-9]*\)\(.*\)#\1#'` - fi - - if test -z "$php_version"; then - AC_MSG_ERROR([failed to detect PHP version, please report]) - fi - - ac_IFS=$IFS - IFS="." - set $php_version - IFS=$ac_IFS - oci8_php_version=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3` - - if test "$oci8_php_version" -le "4003010"; then - AC_MSG_ERROR([You need at least PHP 4.3.10 to be able to use this version of OCI8. PHP $php_version found]) - else - AC_MSG_RESULT([$php_version, ok]) - fi - - -PHP_OCI8_INSTANT_CLIENT="no" - -if test "`echo $PHP_OCI8 | cut -d, -f2`" = "instantclient"; then - PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f3`" - PHP_OCI8="`echo $PHP_OCI8 | cut -d, -f1,4`" - if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then - PHP_OCI8_INSTANT_CLIENT="yes" - fi -elif test "`echo $PHP_OCI8 | cut -d, -f1`" = "instantclient"; then - PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f2`" - PHP_OCI8="`echo $PHP_OCI8 | cut -d, -f3,4`" - if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then - PHP_OCI8_INSTANT_CLIENT="yes" - fi -fi - -if test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then - - AC_MSG_CHECKING([Oracle Install Directory]) - if test "$PHP_OCI8" = "yes"; then - OCI8_DIR=$ORACLE_HOME - else - OCI8_DIR=$PHP_OCI8 - fi - AC_MSG_RESULT($OCI8_DIR) - - AC_OCI8_CHECK_LIB_DIR($OCI8_DIR) - - if test -d "$OCI8_DIR/rdbms/public"; then - PHP_ADD_INCLUDE($OCI8_DIR/rdbms/public) - OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/rdbms/public" - fi - if test -d "$OCI8_DIR/rdbms/demo"; then - PHP_ADD_INCLUDE($OCI8_DIR/rdbms/demo) - OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/rdbms/demo" - fi - if test -d "$OCI8_DIR/network/public"; then - PHP_ADD_INCLUDE($OCI8_DIR/network/public) - OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/network/public" - fi - if test -d "$OCI8_DIR/plsql/public"; then - PHP_ADD_INCLUDE($OCI8_DIR/plsql/public) - OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/plsql/public" - fi - - if test -f "$OCI8_DIR/$OCI8_LIB_DIR/sysliblist"; then - PHP_EVAL_LIBLINE(`cat $OCI8_DIR/$OCI8_LIB_DIR/sysliblist`, OCI8_SYSLIB) - elif test -f "$OCI8_DIR/rdbms/$OCI8_LIB_DIR/sysliblist"; then - PHP_EVAL_LIBLINE(`cat $OCI8_DIR/rdbms/$OCI8_LIB_DIR/sysliblist`, OCI8_SYSLIB) - fi - - AC_OCI8_VERSION($OCI8_DIR) - - case $OCI8_VERSION in - 8.0) - PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, "", OCI8_SHARED_LIBADD) - PHP_ADD_LIBRARY_WITH_PATH(core4, "", OCI8_SHARED_LIBADD) - PHP_ADD_LIBRARY_WITH_PATH(psa, "", OCI8_SHARED_LIBADD) - PHP_ADD_LIBRARY_WITH_PATH(clntsh, $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, - [ - AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ]) - ], [], [ - -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD - ]) - ;; - - 8.1) - PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD) - PHP_ADD_LIBPATH($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, - [ - AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ]) - ], [], [ - -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD - ]) - - dnl - dnl OCI_ATTR_STATEMENT is not available in all 8.1.x versions - dnl - PHP_OCI_IF_DEFINED(OCI_ATTR_STATEMENT, [AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])], $OCI8_INCLUDES) - ;; - - 9.0) - PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD) - PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD) - AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ]) - - 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_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, - [ - 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 - ]) - - ;; - - 10.1) - PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD) - PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD) - AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,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,[ ]) - ;; - *) - AC_MSG_ERROR([Unsupported Oracle version!]) - ;; - 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 - ]) - - AC_DEFINE(HAVE_OCI8,1,[ ]) - - PHP_SUBST_OLD(OCI8_SHARED_LIBADD) - PHP_SUBST_OLD(OCI8_DIR) - PHP_SUBST_OLD(OCI8_VERSION) - -elif test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" != "no"; then - - AC_MSG_CHECKING([Oracle Instant Client directory]) - if test "$PHP_OCI8_INSTANT_CLIENT" = "yes"; then -dnl Generally the Instant Client can be anywhere so the user must pass in the -dnl directory to the libraries. But on Linux we default to the most recent -dnl version in /usr/lib - PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client/lib 2> /dev/null | tail -1` - if test -z "$PHP_OCI8_INSTANT_CLIENT"; then - AC_MSG_ERROR([Oracle Instant Client directory not found. Try --with-oci8=instantclient,DIR]) - fi - fi - AC_MSG_RESULT($PHP_OCI8_INSTANT_CLIENT) - - OCI8_DIR=$PHP_OCI8_INSTANT_CLIENT - - AC_MSG_CHECKING([Oracle Instant Client SDK header directory]) - -dnl Header directory for Instant Client SDK RPM install - OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!^/usr/lib/oracle/\(.*\)/client/lib[/]*$!/usr/include/oracle/\1/client!'` - -dnl Header directory for Instant Client SDK zip file install - OCISDKZIPINC=$PHP_OCI8_INSTANT_CLIENT/sdk/include - -dnl Header directory for manual installation - OCISDKMANINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!\(.*\)/lib[/]*$!\1/include!'` - - if test -f "$OCISDKRPMINC/oci.h"; then - AC_MSG_RESULT($OCISDKRPMINC) - PHP_ADD_INCLUDE($OCISDKRPMINC) - OCI8INCDIR=$OCISDKRPMINC - elif test -f "$OCISDKZIPINC/oci.h"; then - AC_MSG_RESULT($OCISDKZIPINC) - PHP_ADD_INCLUDE($OCISDKZIPINC) - OCI8INCDIR=$OCISDKZIPINC - elif test -f "$OCISDKMANINC/oci.h"; then - AC_MSG_RESULT($OCISDKMANINC) - PHP_ADD_INCLUDE($OCISDKMANINC) - OCI8INCDIR=$OCISDKMANINC - else - AC_MSG_ERROR([Oracle Instant Client SDK header files not found]) - fi - - OCISYSLIBLIST=`echo "$OCI8INCDIR" | $PHP_OCI8_SED -e 's!\(.*\)/include$!\1/demo/sysliblist!'` - if test -f "$OCISYSLIBLIST"; then - PHP_EVAL_LIBLINE(`cat $OCISYSLIBLIST`, OCI8_SYSLIB) - fi - - AC_OCI8IC_VERSION($PHP_OCI8_INSTANT_CLIENT) - case $OCI8_VERSION in - 10.1) - PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD) - PHP_ADD_LIBPATH($PHP_OCI8_INSTANT_CLIENT, OCI8_SHARED_LIBADD) - ;; - - *) - AC_MSG_ERROR([Unsupported Oracle Instant Client version]) - ;; - esac - - AC_DEFINE(HAVE_OCI_INSTANT_CLIENT,1,[ ]) - AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,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,[ ]) - - PHP_SUBST_OLD(OCI8_SHARED_LIBADD) - PHP_SUBST_OLD(OCI8_DIR) - PHP_SUBST_OLD(OCI8_VERSION) - -fi diff --git a/ext/oci8/config.w32 b/ext/oci8/config.w32 deleted file mode 100644 index 38d1eadf4e..0000000000 --- a/ext/oci8/config.w32 +++ /dev/null @@ -1,28 +0,0 @@ -// $Id$ -// vim:ft=javascript - -ARG_WITH("oci8", "OCI8 support", "no"); - -if (PHP_OCI8 != "no") { - - if (CHECK_HEADER_ADD_INCLUDE("oci.h", "CFLAGS_OCI8", PHP_PHP_BUILD + "\\include\\instantclient;" + PHP_OCI8) && - CHECK_LIB("oci.lib", "oci8", PHP_PHP_BUILD + "\\lib\\instantclient;" + PHP_OCI8) - - ) { - EXTENSION('oci8', 'oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c'); - - AC_DEFINE('HAVE_OCI8', 1); - AC_DEFINE('HAVE_OCI_INSTANT_CLIENT', 1); - AC_DEFINE('HAVE_OCI8_ATTR_STATEMENT', 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"); - } -} - diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c deleted file mode 100644 index 8314e71fe1..0000000000 --- a/ext/oci8/oci8.c +++ /dev/null @@ -1,1819 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Stig Sæther Bakken <ssb@php.net> | - | Thies C. Arntzen <thies@thieso.net> | - | Maxim Maletsky <maxim@maxim.cx> | - | | - | Collection support by Andy Sautins <asautins@veripost.net> | - | Temporary LOB support by David Benson <dbenson@mancala.com> | - | ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> | - | | - | Redesigned by: Antony Dovgal <antony@zend.com> | - | Andi Gutmans <andi@zend.com> | - | Wez Furlong <wez@omniti.com> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ -/* TODO - * - * file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty() with OCI_ATTR_LOBEMPTY - * - * get OCI_ATTR_CHARSET_ID attr of column to detect UTF string and multiply buffer in 4 times - * - * */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "ext/standard/info.h" -#include "php_ini.h" -#include "ext/standard/php_smart_str.h" - -#if HAVE_OCI8 - -#include "php_oci8.h" -#include "php_oci8_int.h" -#include "zend_hash.h" - -ZEND_DECLARE_MODULE_GLOBALS(oci) -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) -static PHP_GINIT_FUNCTION(oci); -#endif - -/* True globals, no need for thread safety */ -int le_connection; -int le_pconnection; -int le_statement; -int le_descriptor; -#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 -#endif -#ifndef SQLT_CFILEE -#define SQLT_CFILEE 115 -#endif - -#define PHP_OCI_ERRBUF_LEN 512 - -#if ZEND_MODULE_API_NO > 20020429 -#define ONUPDATELONGFUNC OnUpdateLong -#else -#define ONUPDATELONGFUNC OnUpdateInt -#endif - -/* static protos {{{ */ -static void php_oci_connection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC); -static void php_oci_pconnection_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_collection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC); - -static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC); -#ifdef ZTS -static int php_oci_list_helper(zend_rsrc_list_entry *le, void *le_type TSRMLS_DC); -#endif -static int php_oci_connection_ping(php_oci_connection * TSRMLS_DC); -static int php_oci_connection_status(php_oci_connection * TSRMLS_DC); -static int php_oci_connection_close(php_oci_connection * TSRMLS_DC); -/* }}} */ - -/* {{{ dynamically loadable module stuff */ -#ifdef COMPILE_DL_OCI8 -ZEND_GET_MODULE(oci8) -#endif /* COMPILE_DL */ -/* }}} */ - -#ifdef ZEND_ENGINE_2 -ZEND_BEGIN_ARG_INFO(oci_second_arg_force_ref, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(1) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(oci_third_arg_force_ref, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(1) -ZEND_END_ARG_INFO() -#else -static unsigned char oci_second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE }; -static unsigned char oci_third_arg_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; -#endif - -/* {{{ extension function prototypes -*/ -PHP_FUNCTION(oci_bind_by_name); -PHP_FUNCTION(oci_bind_array_by_name); -PHP_FUNCTION(oci_define_by_name); -PHP_FUNCTION(oci_field_is_null); -PHP_FUNCTION(oci_field_name); -PHP_FUNCTION(oci_field_size); -PHP_FUNCTION(oci_field_scale); -PHP_FUNCTION(oci_field_precision); -PHP_FUNCTION(oci_field_type); -PHP_FUNCTION(oci_field_type_raw); -PHP_FUNCTION(oci_execute); -PHP_FUNCTION(oci_fetch); -PHP_FUNCTION(oci_cancel); -PHP_FUNCTION(ocifetchinto); -PHP_FUNCTION(oci_fetch_object); -PHP_FUNCTION(oci_fetch_row); -PHP_FUNCTION(oci_fetch_assoc); -PHP_FUNCTION(oci_fetch_array); -PHP_FUNCTION(ocifetchstatement); -PHP_FUNCTION(oci_fetch_all); -PHP_FUNCTION(oci_free_statement); -PHP_FUNCTION(oci_internal_debug); -PHP_FUNCTION(oci_close); -PHP_FUNCTION(oci_connect); -PHP_FUNCTION(oci_new_connect); -PHP_FUNCTION(oci_pconnect); -PHP_FUNCTION(oci_error); -PHP_FUNCTION(oci_free_descriptor); -PHP_FUNCTION(oci_commit); -PHP_FUNCTION(oci_rollback); -PHP_FUNCTION(oci_new_descriptor); -PHP_FUNCTION(oci_num_fields); -PHP_FUNCTION(oci_parse); -PHP_FUNCTION(oci_new_cursor); -PHP_FUNCTION(oci_result); -PHP_FUNCTION(oci_server_version); -PHP_FUNCTION(oci_statement_type); -PHP_FUNCTION(oci_num_rows); -PHP_FUNCTION(oci_set_prefetch); -PHP_FUNCTION(oci_password_change); -PHP_FUNCTION(oci_lob_save); -PHP_FUNCTION(oci_lob_import); -PHP_FUNCTION(oci_lob_export); -PHP_FUNCTION(oci_lob_load); -PHP_FUNCTION(oci_lob_tell); -PHP_FUNCTION(oci_lob_write); -PHP_FUNCTION(oci_lob_append); -PHP_FUNCTION(oci_lob_copy); -PHP_FUNCTION(oci_lob_truncate); -PHP_FUNCTION(oci_lob_erase); -PHP_FUNCTION(oci_lob_flush); -PHP_FUNCTION(ocisetbufferinglob); -PHP_FUNCTION(ocigetbufferinglob); -PHP_FUNCTION(oci_lob_is_equal); -PHP_FUNCTION(oci_lob_rewind); -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); -PHP_FUNCTION(oci_collection_element_get); -PHP_FUNCTION(oci_collection_element_assign); -PHP_FUNCTION(oci_collection_assign); -PHP_FUNCTION(oci_collection_size); -PHP_FUNCTION(oci_collection_max); -PHP_FUNCTION(oci_collection_trim); -#endif -/* }}} */ - -/* {{{ extension definition structures -*/ -static zend_function_entry php_oci_functions[] = { - PHP_FE(oci_define_by_name, oci_third_arg_force_ref) - PHP_FE(oci_bind_by_name, oci_third_arg_force_ref) - PHP_FE(oci_bind_array_by_name, oci_third_arg_force_ref) - PHP_FE(oci_field_is_null, NULL) - PHP_FE(oci_field_name, NULL) - PHP_FE(oci_field_size, NULL) - PHP_FE(oci_field_scale, NULL) - PHP_FE(oci_field_precision, NULL) - PHP_FE(oci_field_type, NULL) - PHP_FE(oci_field_type_raw, NULL) - PHP_FE(oci_execute, NULL) - PHP_FE(oci_cancel, NULL) - PHP_FE(oci_fetch, NULL) - PHP_FE(oci_fetch_object, NULL) - PHP_FE(oci_fetch_row, NULL) - PHP_FE(oci_fetch_assoc, NULL) - PHP_FE(oci_fetch_array, NULL) - PHP_FE(ocifetchinto, oci_second_arg_force_ref) - PHP_FE(oci_fetch_all, oci_second_arg_force_ref) - PHP_FE(oci_free_statement, NULL) - PHP_FE(oci_internal_debug, NULL) - PHP_FE(oci_num_fields, NULL) - PHP_FE(oci_parse, NULL) - PHP_FE(oci_new_cursor, NULL) - PHP_FE(oci_result, NULL) - PHP_FE(oci_server_version, NULL) - PHP_FE(oci_statement_type, NULL) - PHP_FE(oci_num_rows, NULL) - PHP_FE(oci_close, NULL) - PHP_FE(oci_connect, NULL) - PHP_FE(oci_new_connect, NULL) - PHP_FE(oci_pconnect, NULL) - PHP_FE(oci_error, NULL) - PHP_FE(oci_free_descriptor, NULL) - PHP_FE(oci_lob_save, NULL) - PHP_FE(oci_lob_import, NULL) - PHP_FE(oci_lob_size, NULL) - PHP_FE(oci_lob_load, NULL) - PHP_FE(oci_lob_read, NULL) - PHP_FE(oci_lob_eof, NULL) - PHP_FE(oci_lob_tell, NULL) - PHP_FE(oci_lob_truncate, NULL) - PHP_FE(oci_lob_erase, NULL) - PHP_FE(oci_lob_flush, NULL) - PHP_FE(ocisetbufferinglob, NULL) - PHP_FE(ocigetbufferinglob, NULL) - PHP_FE(oci_lob_is_equal, NULL) - PHP_FE(oci_lob_rewind, NULL) - PHP_FE(oci_lob_write, NULL) - PHP_FE(oci_lob_append, NULL) - PHP_FE(oci_lob_copy, NULL) - PHP_FE(oci_lob_export, NULL) - PHP_FE(oci_lob_seek, NULL) - PHP_FE(oci_commit, NULL) - PHP_FE(oci_rollback, NULL) - 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) - PHP_FE(oci_collection_element_assign, NULL) - PHP_FE(oci_collection_assign, NULL) - PHP_FE(oci_collection_size, NULL) - 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) - PHP_FALIAS(ocibindbyname, oci_bind_by_name, oci_third_arg_force_ref) - PHP_FALIAS(ocidefinebyname, oci_define_by_name, oci_third_arg_force_ref) - PHP_FALIAS(ocicolumnisnull, oci_field_is_null, NULL) - PHP_FALIAS(ocicolumnname, oci_field_name, NULL) - PHP_FALIAS(ocicolumnsize, oci_field_size, NULL) - PHP_FALIAS(ocicolumnscale, oci_field_scale, NULL) - PHP_FALIAS(ocicolumnprecision, oci_field_precision, NULL) - PHP_FALIAS(ocicolumntype, oci_field_type, NULL) - PHP_FALIAS(ocicolumntyperaw, oci_field_type_raw, NULL) - PHP_FALIAS(ociexecute, oci_execute, NULL) - PHP_FALIAS(ocicancel, oci_cancel, NULL) - PHP_FALIAS(ocifetch, oci_fetch, NULL) - PHP_FALIAS(ocifetchstatement, oci_fetch_all, oci_second_arg_force_ref) - PHP_FALIAS(ocifreestatement, oci_free_statement, NULL) - PHP_FALIAS(ociinternaldebug, oci_internal_debug, NULL) - PHP_FALIAS(ocinumcols, oci_num_fields, NULL) - PHP_FALIAS(ociparse, oci_parse, NULL) - PHP_FALIAS(ocinewcursor, oci_new_cursor, NULL) - PHP_FALIAS(ociresult, oci_result, NULL) - PHP_FALIAS(ociserverversion, oci_server_version, NULL) - PHP_FALIAS(ocistatementtype, oci_statement_type, NULL) - PHP_FALIAS(ocirowcount, oci_num_rows, NULL) - PHP_FALIAS(ocilogoff, oci_close, NULL) - PHP_FALIAS(ocilogon, oci_connect, NULL) - PHP_FALIAS(ocinlogon, oci_new_connect, NULL) - PHP_FALIAS(ociplogon, oci_pconnect, NULL) - PHP_FALIAS(ocierror, oci_error, NULL) - PHP_FALIAS(ocifreedesc, oci_free_descriptor, NULL) - PHP_FALIAS(ocisavelob, oci_lob_save, NULL) - PHP_FALIAS(ocisavelobfile, oci_lob_import, NULL) - PHP_FALIAS(ociwritelobtofile, oci_lob_export, NULL) - PHP_FALIAS(ociloadlob, oci_lob_load, NULL) - PHP_FALIAS(ocicommit, oci_commit, NULL) - PHP_FALIAS(ocirollback, oci_rollback, NULL) - 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) - PHP_FALIAS(ocicollgetelem, oci_collection_element_get, NULL) - PHP_FALIAS(ocicollassignelem, oci_collection_element_assign, NULL) - 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} -}; - -static zend_function_entry php_oci_lob_class_functions[] = { - PHP_FALIAS(load, oci_lob_load, NULL) - PHP_FALIAS(tell, oci_lob_tell, NULL) - PHP_FALIAS(truncate, oci_lob_truncate, NULL) - PHP_FALIAS(erase, oci_lob_erase, NULL) - PHP_FALIAS(flush, oci_lob_flush, NULL) - PHP_FALIAS(setbuffering,ocisetbufferinglob, NULL) - PHP_FALIAS(getbuffering,ocigetbufferinglob, NULL) - PHP_FALIAS(rewind, oci_lob_rewind, NULL) - PHP_FALIAS(read, oci_lob_read, NULL) - PHP_FALIAS(eof, oci_lob_eof, NULL) - PHP_FALIAS(seek, oci_lob_seek, NULL) - PHP_FALIAS(write, oci_lob_write, NULL) - PHP_FALIAS(append, oci_lob_append, NULL) - PHP_FALIAS(size, oci_lob_size, NULL) - 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 zend_function_entry php_oci_coll_class_functions[] = { - PHP_FALIAS(append, oci_collection_append, NULL) - PHP_FALIAS(getelem, oci_collection_element_get, NULL) - PHP_FALIAS(assignelem, oci_collection_element_assign, NULL) - PHP_FALIAS(assign, oci_collection_assign, NULL) - PHP_FALIAS(size, oci_collection_size, NULL) - PHP_FALIAS(max, oci_collection_max, NULL) - PHP_FALIAS(trim, oci_collection_trim, NULL) - PHP_FALIAS(free, oci_free_collection, NULL) - {NULL,NULL,NULL} -}; -#endif - -zend_module_entry oci8_module_entry = { - STANDARD_MODULE_HEADER, - "oci8", /* extension name */ - php_oci_functions, /* extension function list */ - PHP_MINIT(oci), /* extension-wide startup function */ - PHP_MSHUTDOWN(oci), /* extension-wide shutdown function */ - PHP_RINIT(oci), /* per-request startup function */ - PHP_RSHUTDOWN(oci), /* per-request shutdown function */ - PHP_MINFO(oci), /* information function */ - "1.2.2", -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) - PHP_MODULE_GLOBALS(oci), /* globals descriptor */ - PHP_GINIT(oci), /* globals ctor */ - NULL, /* globals dtor */ - NULL, /* post deactivate */ - STANDARD_MODULE_PROPERTIES_EX -#else - STANDARD_MODULE_PROPERTIES -#endif -}; -/* }}} */ - -/* {{{ PHP_INI */ -PHP_INI_BEGIN() - STD_PHP_INI_ENTRY("oci8.max_persistent", "-1", PHP_INI_SYSTEM, ONUPDATELONGFUNC, max_persistent, zend_oci_globals, oci_globals) - STD_PHP_INI_ENTRY("oci8.persistent_timeout", "-1", PHP_INI_SYSTEM, ONUPDATELONGFUNC, persistent_timeout, zend_oci_globals, oci_globals) - STD_PHP_INI_ENTRY("oci8.ping_interval", "60", PHP_INI_SYSTEM, ONUPDATELONGFUNC, ping_interval, zend_oci_globals, oci_globals) - STD_PHP_INI_BOOLEAN("oci8.privileged_connect", "0", PHP_INI_SYSTEM, OnUpdateBool, privileged_connect, zend_oci_globals, oci_globals) - STD_PHP_INI_ENTRY("oci8.statement_cache_size", "20", PHP_INI_SYSTEM, ONUPDATELONGFUNC, statement_cache_size, zend_oci_globals, oci_globals) - STD_PHP_INI_ENTRY("oci8.default_prefetch", "10", PHP_INI_SYSTEM, ONUPDATELONGFUNC, default_prefetch, zend_oci_globals, oci_globals) - STD_PHP_INI_ENTRY("oci8.old_oci_close_semantics", "0", PHP_INI_SYSTEM, OnUpdateBool, old_oci_close_semantics, zend_oci_globals, oci_globals) -PHP_INI_END() -/* }}} */ - -/* {{{ startup, shutdown and info functions -*/ - -/* {{{ php_oci_init_global_handles() - Initialize global handles only when they are needed -*/ -static void php_oci_init_global_handles(TSRMLS_D) -{ - sword errcode; - sb4 error_code = 0; - text tmp_buf[PHP_OCI_ERRBUF_LEN]; - - errcode = OCIEnvInit (&OCI_G(env), OCI_DEFAULT, 0, NULL); - - if (errcode == OCI_ERROR) { - goto oci_error; - } - - errcode = OCIHandleAlloc (OCI_G(env), (dvoid **)&OCI_G(err), OCI_HTYPE_ERROR, 0, NULL); - - if (errcode == OCI_ERROR || errcode == OCI_SUCCESS_WITH_INFO) { - goto oci_error; - } - - return; - -oci_error: - - OCIErrorGet(OCI_G(env), (ub4)1, NULL, &error_code, tmp_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ERROR); - - if (error_code) { - int tmp_buf_len = strlen(tmp_buf); - - if (tmp_buf_len > 0 && tmp_buf[tmp_buf_len - 1] == '\n') { - tmp_buf[tmp_buf_len - 1] = '\0'; - } - - if (errcode != OCI_SUCCESS_WITH_INFO) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_ERROR: %s", tmp_buf); - - OCIHandleFree((dvoid *) OCI_G(env), OCI_HTYPE_ENV); - - OCI_G(env) = NULL; - OCI_G(err) = NULL; - } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SUCCESS_WITH_INFO: %s", tmp_buf); - } - } -} /* }}} */ - -/* {{{ php_oci_cleanup_global_handles() - Free global handles (if they were initialized before) -*/ -static void php_oci_cleanup_global_handles(TSRMLS_D) -{ - if (OCI_G(err)) { - PHP_OCI_CALL(OCIHandleFree, ((dvoid *) OCI_G(err), OCI_HTYPE_ERROR)); - OCI_G(err) = NULL; - } - - if (OCI_G(env)) { - PHP_OCI_CALL(OCIHandleFree, ((dvoid *) OCI_G(env), OCI_HTYPE_ENV)); - OCI_G(env) = NULL; - } -} /* }}} */ - -/* {{{ PHP_GINIT_FUNCTION - Zerofill globals during module init -*/ -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) -static PHP_GINIT_FUNCTION(oci) -#else -static void php_oci_init_globals(zend_oci_globals *oci_globals TSRMLS_DC) -#endif -{ - memset(oci_globals, 0, sizeof(zend_oci_globals)); -} -/* }}} */ - -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 -#else -#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 is handled by new globals management code */ -#else - ZEND_INIT_MODULE_GLOBALS(oci, php_oci_init_globals, NULL); -#endif - REGISTER_INI_ENTRIES(); - - le_statement = zend_register_list_destructors_ex(php_oci_statement_list_dtor, NULL, "oci8 statement", module_number); - le_connection = zend_register_list_destructors_ex(php_oci_connection_list_dtor, NULL, "oci8 connection", module_number); - le_pconnection = zend_register_list_destructors_ex(NULL, php_oci_pconnection_list_dtor, "oci8 persistent connection", 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); - REGISTER_LONG_CONSTANT("OCI_SYSOPER",OCI_SYSOPER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_SYSDBA",OCI_SYSDBA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT); - -/* for $LOB->seek() */ - REGISTER_LONG_CONSTANT("OCI_SEEK_SET",PHP_OCI_SEEK_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_SEEK_CUR",PHP_OCI_SEEK_CUR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_SEEK_END",PHP_OCI_SEEK_END, CONST_CS | CONST_PERSISTENT); - -/* for $LOB->flush() */ - REGISTER_LONG_CONSTANT("OCI_LOB_BUFFER_FREE",OCI_LOB_BUFFER_FREE, CONST_CS | CONST_PERSISTENT); - -/* for OCIBindByName (real "oci" names + short "php" names*/ - REGISTER_LONG_CONSTANT("SQLT_BFILEE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_RDD",SQLT_RDD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_RSET",SQLT_RSET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_AFC",SQLT_AFC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_CHR",SQLT_CHR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_VCS",SQLT_VCS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_AVC",SQLT_AVC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_STR",SQLT_STR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_LVC",SQLT_LVC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_FLT",SQLT_FLT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_UIN",SQLT_UIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_LNG",SQLT_LNG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_LBI",SQLT_LBI, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_ODT",SQLT_ODT, CONST_CS | CONST_PERSISTENT); -#if defined(HAVE_OCI_INSTANT_CLIENT) || (defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION > 10) - REGISTER_LONG_CONSTANT("SQLT_BDOUBLE",SQLT_BDOUBLE, CONST_CS | CONST_PERSISTENT); - 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); - REGISTER_LONG_CONSTANT("OCI_B_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_ROWID",SQLT_RDD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_CURSOR",SQLT_RSET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); - -/* for OCIFetchStatement */ - 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 */ - 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); - REGISTER_LONG_CONSTANT("OCI_RETURN_NULLS",PHP_OCI_RETURN_NULLS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_RETURN_LOBS",PHP_OCI_RETURN_LOBS, CONST_CS | CONST_PERSISTENT); - -/* for OCINewDescriptor (real "oci" names + short "php" names*/ - REGISTER_LONG_CONSTANT("OCI_DTYPE_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_DTYPE_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_DTYPE_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("OCI_D_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); - 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; -} - -/* ----------------------------------------------------------------- */ - -PHP_RINIT_FUNCTION(oci) -{ - OCI_G(debug_mode) = 0; /* start "fresh" */ - OCI_G(num_links) = OCI_G(num_persistent); - OCI_G(errcode) = 0; - - return SUCCESS; -} - -PHP_MSHUTDOWN_FUNCTION(oci) -{ - OCI_G(shutdown) = 1; - - UNREGISTER_INI_ENTRIES(); - -#ifndef ZTS - php_oci_cleanup_global_handles(TSRMLS_C); -#endif - -#if !HAVE_OCI_ENV_CREATE - OCITerminate(OCI_DEFAULT); -#endif - - return SUCCESS; -} - -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); - 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_statement TSRMLS_CC); -#endif - - /* check persistent connections and do the necessary actions if needed */ - zend_hash_apply(&EG(persistent_list), (apply_func_t) php_oci_persistent_helper TSRMLS_CC); - -#ifdef ZTS - zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_connection TSRMLS_CC); - php_oci_cleanup_global_handles(TSRMLS_C); -#endif - - return SUCCESS; -} - -PHP_MINFO_FUNCTION(oci) -{ - char buf[32]; - - php_info_print_table_start(); - php_info_print_table_row(2, "OCI8 Support", "enabled"); - php_info_print_table_row(2, "Version", "1.2.2"); - php_info_print_table_row(2, "Revision", "$Revision$"); - - sprintf(buf, "%ld", OCI_G(num_persistent)); - php_info_print_table_row(2, "Active Persistent Connections", buf); - sprintf(buf, "%ld", OCI_G(num_links)); - php_info_print_table_row(2, "Active Connections", buf); - -#if !defined(PHP_WIN32) && !defined(HAVE_OCI_INSTANT_CLIENT) - php_info_print_table_row(2, "Oracle Version", PHP_OCI8_VERSION ); - php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_OCI8_DIR ); - php_info_print_table_row(2, "Libraries Used", PHP_OCI8_SHARED_LIBADD ); -#else -# if defined(HAVE_OCI_INSTANT_CLIENT) && defined(OCI_MAJOR_VERSION) && defined(OCI_MINOR_VERSION) - sprintf(buf, "%d.%d", OCI_MAJOR_VERSION, OCI_MINOR_VERSION); - php_info_print_table_row(2, "Oracle Instant Client Version", buf); -# 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(); -} -/* }}} */ - -/* list destructors {{{ */ - -/* {{{ php_oci_connection_list_dtor() - Non-persistent connection destructor */ -static void php_oci_connection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) -{ - php_oci_connection *connection = (php_oci_connection *)entry->ptr; - php_oci_connection_close(connection TSRMLS_CC); - OCI_G(num_links)--; -} /* }}} */ - -/* {{{ php_oci_pconnection_list_dtor() - Persistent connection destructor */ -static void php_oci_pconnection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) -{ - php_oci_connection *connection = (php_oci_connection *)entry->ptr; - php_oci_connection_close(connection TSRMLS_CC); - OCI_G(num_persistent)--; -} /* }}} */ - -/* {{{ php_oci_statement_list_dtor() - Statement destructor */ -static void php_oci_statement_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) -{ - php_oci_statement *statement = (php_oci_statement *)entry->ptr; - php_oci_statement_free(statement TSRMLS_CC); -} /* }}} */ - -/* {{{ php_oci_descriptor_list_dtor() - Descriptor destructor */ -static void php_oci_descriptor_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) -{ - php_oci_descriptor *descriptor = (php_oci_descriptor *)entry->ptr; - php_oci_lob_free(descriptor TSRMLS_CC); -} /* }}} */ - -/* {{{ php_oci_collection_list_dtor() - Collection destructor */ -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); -} /* }}} */ - -/* }}} */ - -/* hash destructors {{{ */ - -/* {{{ php_oci_define_hash_dtor() - Define hash destructor */ -void php_oci_define_hash_dtor(void *data) -{ - php_oci_define *define = (php_oci_define *) data; - - zval_ptr_dtor(&define->zval); - - if (define->name) { - efree(define->name); - define->name = NULL; - } -} -/* }}} */ - -/* {{{ php_oci_bind_hash_dtor() - Bind hash destructor */ -void php_oci_bind_hash_dtor(void *data) -{ - php_oci_bind *bind = (php_oci_bind *) data; - - if (bind->array.elements) { - efree(bind->array.elements); - } - if (bind->array.element_lengths) { - efree(bind->array.element_lengths); - } -/* - if (bind->array.indicators) { - efree(bind->array.indicators); - } - if (bind->array.retcodes) { - efree(bind->array.retcodes); - } -*/ - - zval_ptr_dtor(&bind->zval); -} -/* }}} */ - -/* {{{ php_oci_column_hash_dtor() - Column hash destructor */ -void php_oci_column_hash_dtor(void *data) -{ - php_oci_out_column *column = (php_oci_out_column *) data; - TSRMLS_FETCH(); - - if (column->stmtid) { - zend_list_delete(column->stmtid); - } - - if (column->is_descr) { - zend_list_delete(column->descid); - } - - if (column->data) { - efree(column->data); - } - - if (column->name) { - efree(column->name); - } -} -/* }}} */ - -/* {{{ php_oci_descriptor_flush_hash_dtor() - Flush descriptors on commit */ -void php_oci_descriptor_flush_hash_dtor(void *data) -{ - php_oci_descriptor *descriptor = *(php_oci_descriptor **)data; - TSRMLS_FETCH(); - - if (descriptor && descriptor->buffering == PHP_OCI_LOB_BUFFER_USED && (descriptor->type == OCI_DTYPE_LOB || descriptor->type == OCI_DTYPE_FILE)) { - php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE TSRMLS_CC); - descriptor->buffering = PHP_OCI_LOB_BUFFER_ENABLED; - } - data = NULL; -} -/* }}} */ - -/* {{{ php_oci_descriptor_delete_from_hash() - Delete descriptor from the hash */ -int php_oci_descriptor_delete_from_hash(void *data, void *id TSRMLS_DC) -{ - php_oci_descriptor *descriptor = *(php_oci_descriptor **)data; - int *desc_id = (int *) id; - - if (descriptor && desc_id && descriptor->id == *desc_id) { - return 1; - } - return 0; -} -/* }}} */ - -/* }}} */ - -/* {{{ php_oci_error() - Fetch & print out error message if we get an error */ -sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC) -{ - text *errbuf = (text *)NULL; - sb4 errcode = 0; - - switch (status) { - case OCI_SUCCESS: - break; - case OCI_SUCCESS_WITH_INFO: - errcode = php_oci_fetch_errmsg(err_p, &errbuf TSRMLS_CC); - if (errbuf) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SUCCESS_WITH_INFO: %s", errbuf); - efree(errbuf); - } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SUCCESS_WITH_INFO: failed to fetch error message"); - } - break; - case OCI_NEED_DATA: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_NEED_DATA"); - break; - case OCI_NO_DATA: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_NO_DATA"); - break; - case OCI_ERROR: - errcode = php_oci_fetch_errmsg(err_p, &errbuf TSRMLS_CC); - if (errbuf) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errbuf); - efree(errbuf); - } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to fetch error message"); - } - break; - case OCI_INVALID_HANDLE: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_INVALID_HANDLE"); - break; - case OCI_STILL_EXECUTING: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_STILL_EXECUTING"); - break; - case OCI_CONTINUE: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_CONTINUE"); - break; - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown OCI error code: %d", status); - break; - } - return errcode; -} -/* }}} */ - -/* {{{ php_oci_fetch_errmsg() - Fetch error message into the buffer from the error handle provided */ -sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC) -{ - sb4 error_code = 0; - text tmp_buf[PHP_OCI_ERRBUF_LEN]; - - tmp_buf[0] = '\0'; - - PHP_OCI_CALL(OCIErrorGet, (error_handle, (ub4)1, NULL, &error_code, tmp_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ERROR)); - - if (error_code) { - int tmp_buf_len = strlen(tmp_buf); - - if (tmp_buf_len && tmp_buf[tmp_buf_len - 1] == '\n') { - tmp_buf[tmp_buf_len - 1] = '\0'; - } - if (tmp_buf_len && error_buf) { - *error_buf = NULL; - *error_buf = estrndup(tmp_buf, tmp_buf_len); - } - } - return error_code; -} /* }}} */ - -#ifdef HAVE_OCI8_ATTR_STATEMENT -/* {{{ php_oci_fetch_sqltext_offset() - Compute offset in the SQL statement */ -int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, ub2 *error_offset TSRMLS_DC) -{ - *sqltext = NULL; - *error_offset = 0; - - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (text *) sqltext, (ub4 *)0, OCI_ATTR_STATEMENT, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - return 1; - } - - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)error_offset, (ub4 *)0, OCI_ATTR_PARSE_ERROR_OFFSET, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - return 1; - } - return 0; -} /* }}} */ -#endif - -/* {{{ php_oci_do_connect() - Connect wrapper */ -void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclusive) -{ - php_oci_connection *connection; - char *username, *password; - char *dbname = NULL, *charset = NULL; - int username_len = 0, password_len = 0; - int dbname_len = 0, charset_len = 0; - long session_mode = OCI_DEFAULT; - - /* if a fourth parameter is handed over, it is the charset identifier (but is only used in Oracle 9i+) */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ssl", &username, &username_len, &password, &password_len, &dbname, &dbname_len, &charset, &charset_len, &session_mode) == FAILURE) { - return; - } - - if (!charset_len) { - charset = NULL; - } - - connection = php_oci_do_connect_ex(username, username_len, password, password_len, NULL, 0, dbname, dbname_len, charset, session_mode, persistent, exclusive TSRMLS_CC); - - if (!connection) { - RETURN_FALSE; - } - RETURN_RESOURCE(connection->rsrc_id); - -} /* }}} */ - -/* {{{ php_oci_do_connect_ex() - * The real connect function. Allocates all the resources needed, establishes the connection and returns the result handle (or NULL) */ -php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC) -{ - zend_rsrc_list_entry *le; - zend_rsrc_list_entry new_le; - php_oci_connection *connection = NULL; - smart_str hashed_details = {0}; - time_t timestamp; -#if HAVE_OCI_ENV_NLS_CREATE - ub2 charsetid = 0; - ub2 charsetid_nls_lang = 0; -#endif - - switch (session_mode) { - case OCI_DEFAULT: - break; - case OCI_SYSOPER: - case OCI_SYSDBA: - if (!OCI_G(privileged_connect)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Privileged connect is disabled. Enable oci8.privileged_connect to be able to connect as SYSOPER or SYSDBA"); - return NULL; - } - break; - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid session mode specified (%ld)", session_mode); - return NULL; - break; - } - - smart_str_appendl_ex(&hashed_details, "oci8___", sizeof("oci8___") - 1, 0); - smart_str_appendl_ex(&hashed_details, username, username_len, 0); - smart_str_appendl_ex(&hashed_details, "__", sizeof("__") - 1, 0); - if (password_len) { - ulong password_hash; - password_hash = zend_inline_hash_func(password, password_len); - smart_str_append_unsigned_ex(&hashed_details, password_hash, 0); - } - smart_str_appendl_ex(&hashed_details, "__", sizeof("__") - 1, 0); - - if (dbname) { - smart_str_appendl_ex(&hashed_details, dbname, dbname_len, 0); - } - smart_str_appendl_ex(&hashed_details, "__", sizeof("__") - 1, 0); - - /* Initialize global handles if the weren't initialized before */ - if (OCI_G(env) == NULL) { - 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), charset)); - if (!charsetid) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid character set name: %s", charset); - } else { - smart_str_append_unsigned_ex(&hashed_details, charsetid, 0); - } - } - - /* use NLS_LANG if no or invalid charset specified */ - if (!charsetid) { - size_t rsize = 0; - sword result; - - PHP_OCI_CALL_RETURN(result, OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize)) - if (result != OCI_SUCCESS) { - charsetid_nls_lang = 0; - } - 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); - - smart_str_append_unsigned_ex(&hashed_details, session_mode, 0); - smart_str_0(&hashed_details); - - /* make it lowercase */ - php_strtolower(hashed_details.c, hashed_details.len); - - if (!exclusive && !new_password) { - zend_bool found = 0; - - if (persistent && zend_hash_find(&EG(persistent_list), hashed_details.c, hashed_details.len+1, (void **) &le) == SUCCESS) { - found = 1; - /* found */ - if (le->type == le_pconnection) { - connection = (php_oci_connection *)le->ptr; - } - } else if (!persistent && zend_hash_find(&EG(regular_list), hashed_details.c, hashed_details.len+1, (void **) &le) == SUCCESS) { - found = 1; - if (le->type == le_index_ptr) { - int type, link; - void *ptr; - - link = (int) le->ptr; - ptr = zend_list_find(link,&type); - if (ptr && (type == le_connection)) { - connection = (php_oci_connection *)ptr; - } - } - } - - if (connection) { - if (connection->is_open) { - /* found an open connection. now ping it */ - if (connection->is_persistent) { - /* check connection liveness in the following order: - * 1) always check OCI_ATTR_SERVER_STATUS - * 2) see if it's time to ping it - * 3) ping it if needed - * */ - if (php_oci_connection_status(connection TSRMLS_CC)) { - /* only ping if: - * 1) next_ping > 0, which means that ping_interval is not -1 (aka "Off") - * 2) current_timestamp > next_ping, which means "it's time to check if it's still alive" - * */ - if ( (connection->next_ping > 0) && (timestamp >= connection->next_ping) && !php_oci_connection_ping(connection TSRMLS_CC)) { - /* server died */ - } else { - int rsrc_type; - - /* okay, the connection is open and the server is still alive */ - connection->used_this_request = 1; - smart_str_free_ex(&hashed_details, 0); - if (zend_list_find(connection->rsrc_id, &rsrc_type) && (rsrc_type == le_pconnection) && zend_list_addref(connection->rsrc_id) == SUCCESS) { - /* do nothing */ - } else { - connection->rsrc_id = zend_list_insert(connection, le_pconnection); - } - return connection; - } - } - /* server died */ - connection->is_open = 0; - zend_hash_del(&EG(persistent_list), hashed_details.c, hashed_details.len+1); - connection = NULL; - goto open; - } else { - /* we do not ping non-persistent connections */ - smart_str_free_ex(&hashed_details, 0); - zend_list_addref(connection->rsrc_id); - return connection; - } - } else { - zend_hash_del(&EG(regular_list), hashed_details.c, hashed_details.len+1); - connection = NULL; - goto open; - } - } else if (found) { - /* found something, but it's not a connection, delete it */ - if (persistent) { - zend_hash_del(&EG(persistent_list), hashed_details.c, hashed_details.len+1); - } else { - zend_hash_del(&EG(regular_list), hashed_details.c, hashed_details.len+1); - } - } - } -open: - if (persistent) { - zend_bool alloc_non_persistent = 0; - - if (OCI_G(max_persistent)!=-1 && OCI_G(num_persistent)>=OCI_G(max_persistent)) { - /* try to find an idle connection and kill it */ - zend_hash_apply(&EG(persistent_list), (apply_func_t) php_oci_persistent_helper TSRMLS_CC); - - if (OCI_G(max_persistent)!=-1 && OCI_G(num_persistent)>=OCI_G(max_persistent)) { - /* all persistent connactions are in use, fallback to non-persistent connection creation */ - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Too many open persistent connections (%ld)", OCI_G(num_persistent)); - alloc_non_persistent = 1; - } - } - - if (alloc_non_persistent) { - connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection)); - connection->hash_key = estrndup(hashed_details.c, hashed_details.len); - connection->is_persistent = 0; - } else { - connection = (php_oci_connection *) calloc(1, sizeof(php_oci_connection)); - connection->hash_key = zend_strndup(hashed_details.c, hashed_details.len); - connection->is_persistent = 1; - } - } else { - connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection)); - connection->hash_key = estrndup(hashed_details.c, hashed_details.len); - connection->is_persistent = 0; - } - - connection->idle_expiry = (OCI_G(persistent_timeout) > 0) ? (timestamp + OCI_G(persistent_timeout)) : 0; - if (OCI_G(ping_interval) >= 0) { - connection->next_ping = timestamp + OCI_G(ping_interval); - } else { - /* -1 means "Off" */ - connection->next_ping = 0; - } - - smart_str_free_ex(&hashed_details, 0); - - /* allocate environment handle */ -#if HAVE_OCI_ENV_NLS_CREATE -#define PHP_OCI_INIT_FUNC_NAME "OCIEnvNlsCreate" - - if (charsetid) { - connection->charset = charsetid; - } else { - connection->charset = charsetid_nls_lang; - } - - /* create an environment using the character set id, Oracle 9i+ ONLY */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIEnvNlsCreate, (&(connection->env), PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL, connection->charset, connection->charset)); - -#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, (&(connection->env), 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, (&(connection->env), 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"); -# 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"); -# 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"); -#endif - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } - - /* allocate our server handle {{{ */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->server), OCI_HTYPE_SERVER, 0, NULL)); - - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } /* }}} */ - - /* attach to the server {{{ */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerAttach, (connection->server, OCI_G(err), (text*)dbname, dbname_len, (ub4) OCI_DEFAULT)); - - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } /* }}} */ - connection->is_attached = 1; - - /* allocate our session handle {{{ */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->session), OCI_HTYPE_SESSION, 0, NULL)); - - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } /* }}} */ - - /* allocate our private error-handle {{{ */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->err), OCI_HTYPE_ERROR, 0, NULL)); - - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } /* }}} */ - - /* allocate our service-context {{{ */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->svc), OCI_HTYPE_SVCCTX, 0, NULL)); - - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } /* }}} */ - - /* set the username {{{ */ - if (username) { - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) username, (ub4) username_len, (ub4) OCI_ATTR_USERNAME, OCI_G(err))); - - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } - }/* }}} */ - - /* set the password {{{ */ - if (password) { - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) password, (ub4) password_len, (ub4) OCI_ATTR_PASSWORD, OCI_G(err))); - - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } - }/* }}} */ - - /* set the server handle in the service handle {{{ */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->server, 0, OCI_ATTR_SERVER, OCI_G(err))); - - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } /* }}} */ - - /* set the authentication handle in the service handle {{{ */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->session, 0, OCI_ATTR_SESSION, OCI_G(err))); - - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } /* }}} */ - - if (new_password) { - /* try to change password if new one was provided {{{ */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPasswordChange, (connection->svc, OCI_G(err), (text *)username, username_len, (text *)password, password_len, (text *)new_password, new_password_len, OCI_AUTH)); - - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } - - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->session), (ub4 *)0, OCI_ATTR_SESSION, OCI_G(err))); - - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } /* }}} */ - } else { - /* 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: - default: - if (username_len == 1 && username[0] == '/' && password_len == 0) { - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_EXT, (ub4) session_mode)); - } else { - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) session_mode)); - } - break; - } - - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - /* OCISessionBegin returns OCI_SUCCESS_WITH_INFO when - * user's password has expired, but is still usable. - * */ - if (OCI_G(errcode) != OCI_SUCCESS_WITH_INFO) { - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } - } /* }}} */ - } - -#if HAVE_OCI_STMT_PREPARE2 - if (connection->is_persistent) { - 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); - php_oci_connection_close(connection TSRMLS_CC); - return NULL; - } - } -#endif - - /* mark it as open */ - connection->is_open = 1; - - /* add to the appropriate hash */ - if (connection->is_persistent) { - new_le.ptr = connection; - new_le.type = le_pconnection; - connection->used_this_request = 1; - connection->rsrc_id = zend_list_insert(connection, le_pconnection); - zend_hash_update(&EG(persistent_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL); - OCI_G(num_persistent)++; - } else if (!exclusive) { - connection->rsrc_id = zend_list_insert(connection, le_connection); - new_le.ptr = (void *)connection->rsrc_id; - new_le.type = le_index_ptr; - zend_hash_update(&EG(regular_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL); - OCI_G(num_links)++; - } else { - connection->rsrc_id = zend_list_insert(connection, le_connection); - OCI_G(num_links)++; - } - return connection; -} -/* }}} */ - -/* {{{ php_oci_connection_ping() - * Ping connection. Uses OCIPing() or OCIServerVersion() depending on the Oracle Client version */ -static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC) -{ - /* OCIPing() crashes Oracle servers older than 10.2 */ -#if 0 - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT)); -#else - char version[256]; - /* use good old OCIServerVersion() by default */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerVersion, (connection->server, OCI_G(err), (text*)version, sizeof(version), OCI_HTYPE_SERVER)); -#endif - - if (OCI_G(errcode) == OCI_SUCCESS) { - return 1; - } - - /* ignore errors here, just return failure - * php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); */ - return 0; -} -/* }}} */ - -/* {{{ php_oci_connection_status() - Check connection status (pre-ping check) */ -static int php_oci_connection_status(php_oci_connection *connection TSRMLS_DC) -{ - ub4 ss = 0; - - /* get OCI_ATTR_SERVER_STATUS */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->server, OCI_HTYPE_SERVER, (dvoid *)&ss, (ub4 *)0, OCI_ATTR_SERVER_STATUS, OCI_G(err))); - - if (OCI_G(errcode) == OCI_SUCCESS && ss == OCI_SERVER_NORMAL) { - return 1; - } - - /* ignore errors here, just return failure - * php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); */ - return 0; -} -/* }}} */ - -/* {{{ php_oci_connection_rollback() - Rollback connection */ -int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC) -{ - PHP_OCI_CALL_RETURN(connection->errcode, OCITransRollback, (connection->svc, connection->err, (ub4) 0)); - connection->needs_commit = 0; - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - return 0; -} /* }}} */ - -/* {{{ php_oci_connection_commit() - Commit connection */ -int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC) -{ - PHP_OCI_CALL_RETURN(connection->errcode, OCITransCommit, (connection->svc, connection->err, (ub4) 0)); - connection->needs_commit = 0; - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - return 0; -} /* }}} */ - -/* {{{ php_oci_connection_close() - Close the connection and free all its resources */ -static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC) -{ - int result = 0; - zend_bool in_call_save = OCI_G(in_call); - - if (connection->descriptors) { - zend_hash_destroy(connection->descriptors); - efree(connection->descriptors); - } - - if (connection->svc) { - /* rollback outstanding transactions */ - if (connection->needs_commit) { - if (php_oci_connection_rollback(connection TSRMLS_CC)) { - /* rollback failed */ - result = 1; - } - } - } - - if (connection->svc && connection->session && connection->is_open) { - PHP_OCI_CALL(OCISessionEnd, (connection->svc, OCI_G(err), connection->session, (ub4) 0)); - } - - if (connection->session) { - PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->session, OCI_HTYPE_SESSION)); - } - - if (connection->is_attached) { - PHP_OCI_CALL(OCIServerDetach, (connection->server, OCI_G(err), OCI_DEFAULT)); - } - - if (connection->svc) { - PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX)); - } - - if (connection->err) { - PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->err, (ub4) OCI_HTYPE_ERROR)); - } - - if (connection->server) { - PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->server, (ub4) OCI_HTYPE_SERVER)); - } - - if (connection->env) { - PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->env, OCI_HTYPE_ENV)); - } - - if (connection->is_persistent) { - if (connection->hash_key) { - free(connection->hash_key); - } - free(connection); - } else { - if (connection->hash_key) { - efree(connection->hash_key); - } - efree(connection); - } - connection = NULL; - OCI_G(in_call) = in_call_save; - return result; -} /* }}} */ - -/* {{{ php_oci_password_change() - Change password for the user with the username given */ -int php_oci_password_change(php_oci_connection *connection, char *user, int user_len, char *pass_old, int pass_old_len, char *pass_new, int pass_new_len TSRMLS_DC) -{ - PHP_OCI_CALL_RETURN(connection->errcode, OCIPasswordChange, (connection->svc, connection->err, (text *)user, user_len, (text *)pass_old, pass_old_len, (text *)pass_new, pass_new_len, OCI_DEFAULT)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - return 0; -} /* }}} */ - -/* {{{ php_oci_server_get_version() - Get Oracle server version */ -int php_oci_server_get_version(php_oci_connection *connection, char **version TSRMLS_DC) -{ - char version_buff[256]; - - PHP_OCI_CALL_RETURN(connection->errcode, OCIServerVersion, (connection->svc, connection->err, (text*)version_buff, sizeof(version_buff), OCI_HTYPE_SVCCTX)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - - *version = estrdup(version_buff); - return 0; -} /* }}} */ - -/* {{{ php_oci_column_to_zval() - Convert php_oci_out_column struct into zval */ -int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSRMLS_DC) -{ - php_oci_descriptor *descriptor; - ub4 lob_length; - int column_size; - char *lob_buffer; - - if (column->indicator == -1) { /* column is NULL */ - ZVAL_NULL(value); - return 0; - } - - if (column->is_cursor) { /* REFCURSOR -> simply return the statement id */ - ZVAL_RESOURCE(value, column->stmtid); - zend_list_addref(column->stmtid); - } else if (column->is_descr) { - - if (column->data_type != SQLT_RDD) { - int rsrc_type; - - /* reset descriptor's length */ - descriptor = (php_oci_descriptor *) zend_list_find(column->descid, &rsrc_type); - - if (!descriptor || rsrc_type != le_descriptor) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find LOB descriptor #%d", column->descid); - return 1; - } - - descriptor->lob_size = -1; - descriptor->lob_current_position = 0; - descriptor->buffering = 0; - } - - if (column->data_type != SQLT_RDD && (mode & PHP_OCI_RETURN_LOBS)) { - /* PHP_OCI_RETURN_LOBS means that we want the content of the LOB back instead of the locator */ - - if (php_oci_lob_read(descriptor, -1, 0, &lob_buffer, &lob_length TSRMLS_CC)) { - ZVAL_FALSE(value); - return 1; - } else { - if (lob_length > 0) { - ZVAL_STRINGL(value, lob_buffer, lob_length, 0); - } else { - ZVAL_EMPTY_STRING(value); - } - return 0; - } - } else { - /* return the locator */ - object_init_ex(value, oci_lob_class_entry_ptr); - add_property_resource(value, "descriptor", column->descid); - zend_list_addref(column->descid); - } - } else { - switch (column->retcode) { - case 0: - /* intact value */ - if (column->piecewise) { - column_size = column->retlen4; - } else { - column_size = column->retlen; - } - break; - - default: - ZVAL_FALSE(value); - return 0; - } - - ZVAL_STRINGL(value, column->data, column_size, 1); - } - return 0; -} -/* }}} */ - -/* {{{ php_oci_fetch_row() - Fetch the next row from the given statement */ -void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_args) -{ - zval *z_statement, *array; - php_oci_statement *statement; - php_oci_out_column *column; - ub4 nrows = 1; - int i; - long fetch_mode = 0; - - if (expected_args > 2) { - /* only for ocifetchinto BC */ - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|l", &z_statement, &array, &fetch_mode) == FAILURE) { - return; - } - - if (ZEND_NUM_ARGS() == 2) { - fetch_mode = mode; - } - } else if (expected_args == 2) { - /* only for oci_fetch_array() */ - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_statement, &fetch_mode) == FAILURE) { - return; - } - - if (ZEND_NUM_ARGS() == 1) { - fetch_mode = mode; - } - } else { - /* for all oci_fetch_*() */ - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_statement) == FAILURE) { - return; - } - - fetch_mode = mode; - } - - if (!(fetch_mode & PHP_OCI_NUM) && !(fetch_mode & PHP_OCI_ASSOC)) { - /* none of the modes present, use the default one */ - if (mode & PHP_OCI_ASSOC) { - fetch_mode |= PHP_OCI_ASSOC; - } - if (mode & PHP_OCI_NUM) { - fetch_mode |= PHP_OCI_NUM; - } - } - - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - - if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) { - RETURN_FALSE; - } - - array_init(return_value); - - for (i = 0; i < statement->ncolumns; i++) { - - column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); - - if (column == NULL) { - continue; - } - if ((column->indicator == -1) && ((fetch_mode & PHP_OCI_RETURN_NULLS) == 0)) { - continue; - } - - if (!(column->indicator == -1)) { - zval *element; - - MAKE_STD_ZVAL(element); - php_oci_column_to_zval(column, element, fetch_mode TSRMLS_CC); - - if (fetch_mode & PHP_OCI_NUM || !(fetch_mode & PHP_OCI_ASSOC)) { - add_index_zval(return_value, i, element); - } - if (fetch_mode & PHP_OCI_ASSOC) { - if (fetch_mode & PHP_OCI_NUM) { - ZVAL_ADDREF(element); - } - add_assoc_zval(return_value, column->name, element); - } - - } else { - if (fetch_mode & PHP_OCI_NUM || !(fetch_mode & PHP_OCI_ASSOC)) { - add_index_null(return_value, i); - } - if (fetch_mode & PHP_OCI_ASSOC) { - add_assoc_null(return_value, column->name); - } - } - } - - if (expected_args > 2) { - /* only for ocifetchinto BC - * in all other cases we return array, not long - */ - REPLACE_ZVAL_VALUE(&array, return_value, 1); /* copy return_value to given reference */ - zval_dtor(return_value); - RETURN_LONG(statement->ncolumns); - } -} -/* }}} */ - -/* {{{ php_oci_persistent_helper() - Helper function to close/rollback persistent connections at the end of request */ -static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC) -{ - time_t timestamp; - php_oci_connection *connection; - - timestamp = time(NULL); - - if (le->type == le_pconnection) { - connection = (php_oci_connection *)le->ptr; - - if (connection->used_this_request) { - if ((PG(connection_status) & PHP_CONNECTION_TIMEOUT) || OCI_G(in_call)) { - return 1; - } - - if (connection->descriptors) { - zend_hash_destroy(connection->descriptors); - efree(connection->descriptors); - connection->descriptors = NULL; - } - - if (connection->needs_commit) { - php_oci_connection_rollback(connection TSRMLS_CC); - } - - if (OCI_G(persistent_timeout) > 0) { - connection->idle_expiry = timestamp + OCI_G(persistent_timeout); - } - - if (OCI_G(ping_interval) >= 0) { - connection->next_ping = timestamp + OCI_G(ping_interval); - } else { - /* ping_interval is -1 */ - connection->next_ping = 0; - } - - connection->used_this_request = 0; - } else if (OCI_G(persistent_timeout) != -1) { - if (connection->idle_expiry < timestamp) { - /* connection has timed out */ - return 1; - } - } - } - return 0; -} /* }}} */ - -#ifdef ZTS -/* {{{ php_oci_list_helper() - Helper function to destroy data on thread shutdown in ZTS mode */ -static int php_oci_list_helper(zend_rsrc_list_entry *le, void *le_type TSRMLS_DC) -{ - int type = (int) le_type; - - if (le->type == type) { - if (le->ptr != NULL) { - return 1; - } - } - return 0; -} /* }}} */ -#endif - -#endif /* HAVE_OCI8 */ diff --git a/ext/oci8/oci8.dsp b/ext/oci8/oci8.dsp deleted file mode 100644 index f0b27fa824..0000000000 --- a/ext/oci8/oci8.dsp +++ /dev/null @@ -1,133 +0,0 @@ -# Microsoft Developer Studio Project File - Name="oci8" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=oci8 - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "oci8.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "oci8.mak" CFG="oci8 - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "oci8 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "oci8 - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "oci8 - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\include\instantclient" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OCI8=1 /D HAVE_OCI8_TEMP_LOB=1 /D HAVE_OCI8_ATTR_STATEMENT=1 /D COMPILE_DL_OCI8=1 /D PHP_OCI8_HAVE_COLLECTIONS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib oci.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_oci8.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\lib\instantclient" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "oci8 - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\include\instantclient" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FTP_EXPORTS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OCI8=1 /D HAVE_OCI8_TEMP_LOB=1 /D HAVE_OCI8_ATTR_STATEMENT=1 /D COMPILE_DL_OCI8=1 /D PHP_OCI8_HAVE_COLLECTIONS=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib oci.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_oci8.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\lib\instantclient"
-
-!ENDIF
-
-# Begin Target
-
-# Name "oci8 - Win32 Release_TS"
-# Name "oci8 - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\oci8.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oci8_collection.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oci8_interface.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oci8_lob.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oci8_statement.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_oci8.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_oci8_int.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c deleted file mode 100644 index dbbaff6184..0000000000 --- a/ext/oci8/oci8_collection.c +++ /dev/null @@ -1,743 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Stig Sæther Bakken <ssb@php.net> | - | Thies C. Arntzen <thies@thieso.net> | - | | - | Collection support by Andy Sautins <asautins@veripost.net> | - | Temporary LOB support by David Benson <dbenson@mancala.com> | - | ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> | - | | - | Redesigned by: Antony Dovgal <antony@zend.com> | - | Andi Gutmans <andi@zend.com> | - | Wez Furlong <wez@omniti.com> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "ext/standard/info.h" -#include "php_ini.h" - -#if HAVE_OCI8 && PHP_OCI8_HAVE_COLLECTIONS - -#include "php_oci8.h" -#include "php_oci8_int.h" - -/* {{{ php_oci_collection_create() - Create and return connection handle */ -php_oci_collection * php_oci_collection_create(php_oci_connection* connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC) -{ - dvoid *dschp1; - dvoid *parmp1; - dvoid *parmp2; - php_oci_collection *collection; - - collection = emalloc(sizeof(php_oci_collection)); - - collection->connection = connection; - collection->collection = NULL; - - /* get type handle by name */ - PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByName, - ( - connection->env, - connection->err, - connection->svc, - (text *) schema, - (ub4) schema_len, - (text *) tdo, - (ub4) tdo_len, - (CONST text *) 0, - (ub4) 0, - OCI_DURATION_SESSION, - OCI_TYPEGET_ALL, - &(collection->tdo) - ) - ); - - if (connection->errcode) { - goto CLEANUP; - } - - /* allocate describe handle */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0)); - - if (connection->errcode) { - goto CLEANUP; - } - - /* describe TDO */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIDescribeAny, - ( - connection->svc, - connection->err, - (dvoid *) collection->tdo, - (ub4) 0, - OCI_OTYPE_PTR, - (ub1) OCI_DEFAULT, - (ub1) OCI_PTYPE_TYPE, - dschp1 - ) - ); - - if (connection->errcode) { - goto CLEANUP; - } - - /* get first parameter handle */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err)); - - if (connection->errcode) { - goto CLEANUP; - } - - /* get the collection type code of the attribute */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, - ( - (dvoid*) parmp1, - (ub4) OCI_DTYPE_PARAM, - (dvoid*) &(collection->coll_typecode), - (ub4 *) 0, - (ub4) OCI_ATTR_COLLECTION_TYPECODE, - connection->err - ) - ); - - if (connection->errcode) { - goto CLEANUP; - } - - switch(collection->coll_typecode) { - case OCI_TYPECODE_TABLE: - case OCI_TYPECODE_VARRAY: - /* get collection element handle */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, - ( - (dvoid*) parmp1, - (ub4) OCI_DTYPE_PARAM, - (dvoid*) &parmp2, - (ub4 *) 0, - (ub4) OCI_ATTR_COLLECTION_ELEMENT, - connection->err - ) - ); - - if (connection->errcode) { - goto CLEANUP; - } - - /* get REF of the TDO for the type */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, - ( - (dvoid*) parmp2, - (ub4) OCI_DTYPE_PARAM, - (dvoid*) &(collection->elem_ref), - (ub4 *) 0, - (ub4) OCI_ATTR_REF_TDO, - connection->err - ) - ); - - if (connection->errcode) { - goto CLEANUP; - } - - /* get the TDO (only header) */ - PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByRef, - ( - connection->env, - connection->err, - collection->elem_ref, - OCI_DURATION_SESSION, - OCI_TYPEGET_HEADER, - &(collection->element_type) - ) - ); - - if (connection->errcode) { - goto CLEANUP; - } - - /* get typecode */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, - ( - (dvoid*) parmp2, - (ub4) OCI_DTYPE_PARAM, - (dvoid*) &(collection->element_typecode), - (ub4 *) 0, - (ub4) OCI_ATTR_TYPECODE, - connection->err - ) - ); - - if (connection->errcode) { - goto CLEANUP; - } - break; - /* we only support VARRAYs and TABLEs */ - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCINewCollection - Unknown Type %d", collection->coll_typecode); - break; - } - - /* Create object to hold return table */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectNew, - ( - connection->env, - connection->err, - connection->svc, - OCI_TYPECODE_TABLE, - collection->tdo, - (dvoid *)0, - OCI_DURATION_DEFAULT, - TRUE, - (dvoid **) &(collection->collection) - ) - ); - - if (connection->errcode) { - goto CLEANUP; - } - - PHP_OCI_REGISTER_RESOURCE(collection, le_collection); - return collection; - -CLEANUP: - - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - php_oci_collection_close(collection TSRMLS_CC); - return NULL; -} /* }}} */ - -/* {{{ php_oci_collection_size() - Return size of the collection */ -int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC) -{ - php_oci_connection *connection = collection->connection; - - PHP_OCI_CALL_RETURN(connection->errcode, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - return 0; -} /* }}} */ - -/* {{{ php_oci_collection_max() - Return max number of elements in the collection */ -int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC) -{ - php_oci_connection *connection = collection->connection; - - PHP_OCI_CALL_RETURN(*max, OCICollMax, (connection->env, collection->collection)); - - /* error handling is not necessary here? */ - return 0; -} /* }}} */ - -/* {{{ php_oci_collection_trim() - Trim collection to the given number of elements */ -int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC) -{ - php_oci_connection *connection = collection->connection; - - PHP_OCI_CALL_RETURN(connection->errcode, OCICollTrim, (connection->env, connection->err, trim_size, collection->collection)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - return 0; -} /* }}} */ - -/* {{{ php_oci_collection_append_null() - Append NULL element to the end of the collection */ -int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC) -{ - OCIInd null_index = OCI_IND_NULL; - php_oci_connection *connection = collection->connection; - - /* append NULL element */ - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - return 0; -} /* }}} */ - -/* {{{ php_oci_collection_append_date() - Append DATE element to the end of the collection (use "DD-MON-YY" format) */ -int php_oci_collection_append_date(php_oci_collection *collection, char *date, int date_len TSRMLS_DC) -{ - OCIInd new_index = OCI_IND_NOTNULL; - OCIDate oci_date; - php_oci_connection *connection = collection->connection; - - /* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, date, date_len, NULL, 0, NULL, 0, &oci_date)); - - if (connection->errcode != OCI_SUCCESS) { - /* failed to convert string to date */ - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, - ( - connection->env, - connection->err, - (dvoid *) &oci_date, - (dvoid *) &new_index, - (OCIColl *) collection->collection - ) - ); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - - return 0; -} /* }}} */ - -/* {{{ php_oci_collection_append_number() - Append NUMBER to the end of the collection */ -int php_oci_collection_append_number(php_oci_collection *collection, char *number, int number_len TSRMLS_DC) -{ - OCIInd new_index = OCI_IND_NOTNULL; - double element_double; - OCINumber oci_number; - php_oci_connection *connection = collection->connection; - - element_double = zend_strtod(number, NULL); - - PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, - ( - connection->env, - connection->err, - (dvoid *) &oci_number, - (dvoid *) &new_index, - (OCIColl *) collection->collection - ) - ); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - - return 0; -} /* }}} */ - -/* {{{ php_oci_collection_append_string() - Append STRING to the end of the collection */ -int php_oci_collection_append_string(php_oci_collection *collection, char *element, int element_len TSRMLS_DC) -{ - OCIInd new_index = OCI_IND_NOTNULL; - OCIString *ocistr = (OCIString *)0; - php_oci_connection *connection = collection->connection; - - PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, element, element_len, &ocistr)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, - ( - connection->env, - connection->err, - (dvoid *) ocistr, - (dvoid *) &new_index, - (OCIColl *) collection->collection - ) - ); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - - return 0; -} /* }}} */ - -/* {{{ php_oci_collection_append() - Append wrapper. Appends any supported element to the end of the collection */ -int php_oci_collection_append(php_oci_collection *collection, char *element, int element_len TSRMLS_DC) -{ - if (element_len == 0) { - return php_oci_collection_append_null(collection TSRMLS_CC); - } - - switch(collection->element_typecode) { - case OCI_TYPECODE_DATE: - return php_oci_collection_append_date(collection, element, element_len TSRMLS_CC); - break; - - case OCI_TYPECODE_VARCHAR2 : - return php_oci_collection_append_string(collection, element, element_len TSRMLS_CC); - break; - - case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */ - case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */ - case OCI_TYPECODE_REAL : /* REAL */ - case OCI_TYPECODE_DOUBLE : /* DOUBLE */ - case OCI_TYPECODE_INTEGER : /* INT */ - case OCI_TYPECODE_SIGNED16 : /* SHORT */ - case OCI_TYPECODE_SIGNED32 : /* LONG */ - case OCI_TYPECODE_DECIMAL : /* DECIMAL */ - case OCI_TYPECODE_FLOAT : /* FLOAT */ - case OCI_TYPECODE_NUMBER : /* NUMBER */ - case OCI_TYPECODE_SMALLINT : /* SMALLINT */ - return php_oci_collection_append_number(collection, element, element_len TSRMLS_CC); - break; - - default: - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown or unsupported type of element: %d", collection->element_typecode); - return 1; - break; - } - /* never reached */ - return 1; -} /* }}} */ - -/* {{{ php_oci_collection_element_get() - Get the element with the given index */ -int php_oci_collection_element_get(php_oci_collection *collection, long index, zval **result_element TSRMLS_DC) -{ - php_oci_connection *connection = collection->connection; - dvoid *element; - OCIInd *element_index; - boolean exists; - char buff[1024]; - int buff_len = 1024; - - MAKE_STD_ZVAL(*result_element); - ZVAL_NULL(*result_element); - - PHP_OCI_CALL_RETURN(connection->errcode, OCICollGetElem, - ( - connection->env, - connection->err, - collection->collection, - (ub4)index, - &exists, - &element, - (dvoid **)&element_index - ) - ); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - FREE_ZVAL(*result_element); - return 1; - } - - if (exists == 0) { - /* element doesn't exist */ - FREE_ZVAL(*result_element); - return 1; - } - - if (*element_index == OCI_IND_NULL) { - /* this is not an error, we're returning NULL here */ - return 0; - } - - switch (collection->element_typecode) { - case OCI_TYPECODE_DATE: - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - FREE_ZVAL(*result_element); - return 1; - } - - ZVAL_STRINGL(*result_element, buff, buff_len, 1); - Z_STRVAL_P(*result_element)[buff_len] = '\0'; - - return 0; - break; - - case OCI_TYPECODE_VARCHAR2: - { - OCIString *oci_string = *(OCIString **)element; - text *str; - - PHP_OCI_CALL_RETURN(str, OCIStringPtr, (connection->env, oci_string)); - - if (str) { - ZVAL_STRING(*result_element, str, 1); - } - return 0; - } - break; - - case OCI_TYPECODE_UNSIGNED16: /* UNSIGNED SHORT */ - case OCI_TYPECODE_UNSIGNED32: /* UNSIGNED LONG */ - case OCI_TYPECODE_REAL: /* REAL */ - case OCI_TYPECODE_DOUBLE: /* DOUBLE */ - case OCI_TYPECODE_INTEGER: /* INT */ - case OCI_TYPECODE_SIGNED16: /* SHORT */ - case OCI_TYPECODE_SIGNED32: /* LONG */ - case OCI_TYPECODE_DECIMAL: /* DECIMAL */ - case OCI_TYPECODE_FLOAT: /* FLOAT */ - case OCI_TYPECODE_NUMBER: /* NUMBER */ - case OCI_TYPECODE_SMALLINT: /* SMALLINT */ - { - double double_number; - - PHP_OCI_CALL_RETURN(connection->errcode, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - FREE_ZVAL(*result_element); - return 1; - } - - ZVAL_DOUBLE(*result_element, double_number); - - return 0; - } - break; - default: - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown or unsupported type of element: %d", collection->element_typecode); - FREE_ZVAL(*result_element); - return 1; - break; - } - /* never reached */ - return 1; -} /* }}} */ - -/* {{{ php_oci_collection_element_set_null() - Set the element with the given index to NULL */ -int php_oci_collection_element_set_null(php_oci_collection *collection, long index TSRMLS_DC) -{ - OCIInd null_index = OCI_IND_NULL; - php_oci_connection *connection = collection->connection; - - /* set NULL element */ - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - return 0; -} /* }}} */ - -/* {{{ php_oci_collection_element_set_date() - Change element's value to the given DATE */ -int php_oci_collection_element_set_date(php_oci_collection *collection, long index, char *date, int date_len TSRMLS_DC) -{ - OCIInd new_index = OCI_IND_NOTNULL; - OCIDate oci_date; - php_oci_connection *connection = collection->connection; - - /* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, date, date_len, NULL, 0, NULL, 0, &oci_date)); - - if (connection->errcode != OCI_SUCCESS) { - /* failed to convert string to date */ - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, - ( - connection->env, - connection->err, - (ub4)index, - (dvoid *) &oci_date, - (dvoid *) &new_index, - (OCIColl *) collection->collection - ) - ); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - - return 0; -} /* }}} */ - -/* {{{ php_oci_collection_element_set_number() - Change element's value to the given NUMBER */ -int php_oci_collection_element_set_number(php_oci_collection *collection, long index, char *number, int number_len TSRMLS_DC) -{ - OCIInd new_index = OCI_IND_NOTNULL; - double element_double; - OCINumber oci_number; - php_oci_connection *connection = collection->connection; - - element_double = zend_strtod(number, NULL); - - PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, - ( - connection->env, - connection->err, - (ub4) index, - (dvoid *) &oci_number, - (dvoid *) &new_index, - (OCIColl *) collection->collection - ) - ); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - - return 0; -} /* }}} */ - -/* {{{ php_oci_collection_element_set_string() - Change element's value to the given string */ -int php_oci_collection_element_set_string(php_oci_collection *collection, long index, char *element, int element_len TSRMLS_DC) -{ - OCIInd new_index = OCI_IND_NOTNULL; - OCIString *ocistr = (OCIString *)0; - php_oci_connection *connection = collection->connection; - - PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, element, element_len, &ocistr)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, - ( - connection->env, - connection->err, - (ub4)index, - (dvoid *) ocistr, - (dvoid *) &new_index, - (OCIColl *) collection->collection - ) - ); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - - return 0; -} /* }}} */ - -/* {{{ php_oci_collection_element_set() - Collection element setter */ -int php_oci_collection_element_set(php_oci_collection *collection, long index, char *value, int value_len TSRMLS_DC) -{ - if (value_len == 0) { - return php_oci_collection_element_set_null(collection, index TSRMLS_CC); - } - - switch(collection->element_typecode) { - case OCI_TYPECODE_DATE: - return php_oci_collection_element_set_date(collection, index, value, value_len TSRMLS_CC); - break; - - case OCI_TYPECODE_VARCHAR2 : - return php_oci_collection_element_set_string(collection, index, value, value_len TSRMLS_CC); - break; - - case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */ - case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */ - case OCI_TYPECODE_REAL : /* REAL */ - case OCI_TYPECODE_DOUBLE : /* DOUBLE */ - case OCI_TYPECODE_INTEGER : /* INT */ - case OCI_TYPECODE_SIGNED16 : /* SHORT */ - case OCI_TYPECODE_SIGNED32 : /* LONG */ - case OCI_TYPECODE_DECIMAL : /* DECIMAL */ - case OCI_TYPECODE_FLOAT : /* FLOAT */ - case OCI_TYPECODE_NUMBER : /* NUMBER */ - case OCI_TYPECODE_SMALLINT : /* SMALLINT */ - return php_oci_collection_element_set_number(collection, index, value, value_len TSRMLS_CC); - break; - - default: - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown or unsupported type of element: %d", collection->element_typecode); - return 1; - break; - } - /* never reached */ - return 1; -} /* }}} */ - -/* {{{ php_oci_collection_assign() - Assigns a value to the collection from another collection */ -int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_collection *collection_from TSRMLS_DC) -{ - php_oci_connection *connection = collection_dest->connection; - - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return 1; - } - return 0; -} /* }}} */ - -/* {{{ php_oci_collection_close() - Destroy collection and all associated resources */ -void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC) -{ - php_oci_connection *connection = collection->connection; - - if (collection->collection) { - PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - } - } - - zend_list_delete(collection->connection->rsrc_id); - - efree(collection); - return; -} /* }}} */ - -#endif /* HAVE_OCI8 */ diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c deleted file mode 100644 index ce8fafb478..0000000000 --- a/ext/oci8/oci8_interface.c +++ /dev/null @@ -1,2157 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Stig Sæther Bakken <ssb@php.net> | - | Thies C. Arntzen <thies@thieso.net> | - | | - | Collection support by Andy Sautins <asautins@veripost.net> | - | Temporary LOB support by David Benson <dbenson@mancala.com> | - | ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> | - | | - | Redesigned by: Antony Dovgal <antony@zend.com> | - | Andi Gutmans <andi@zend.com> | - | Wez Furlong <wez@omniti.com> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "ext/standard/info.h" -#include "php_ini.h" - -#if HAVE_OCI8 - -#include "php_oci8.h" -#include "php_oci8_int.h" - -/* {{{ proto bool oci_define_by_name(resource stmt, string name, mixed &var [, int type]) - Define a PHP variable to an Oracle column by name */ -/* if you want to define a LOB/CLOB etc make sure you allocate it via OCINewDescriptor BEFORE defining!!! */ -PHP_FUNCTION(oci_define_by_name) -{ - zval *stmt, *var; - char *name; - int name_len; - long type = SQLT_CHR; - php_oci_statement *statement; - php_oci_define *define, *tmp_define; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz/|l", &stmt, &name, &name_len, &var, &type) == FAILURE) { - return; - } - - if (!name_len) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Column name cannot be empty"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_STATEMENT(stmt, statement); - - if (statement->defines == NULL) { - ALLOC_HASHTABLE(statement->defines); - zend_hash_init(statement->defines, 13, NULL, php_oci_define_hash_dtor, 0); - } - - define = ecalloc(1,sizeof(php_oci_define)); - - if (zend_hash_add(statement->defines, name, name_len, define, sizeof(php_oci_define), (void **)&tmp_define) == SUCCESS) { - efree(define); - define = tmp_define; - } else { - efree(define); - RETURN_FALSE; - } - - define->name = (text*) estrndup(name, name_len); - define->name_len = name_len; - define->type = type; - define->zval = var; - zval_add_ref(&var); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_bind_by_name(resource stmt, string name, mixed &var, [, int maxlength [, int type]]) - Bind a PHP variable to an Oracle placeholder by name */ -/* if you want to bind a LOB/CLOB etc make sure you allocate it via OCINewDescriptor BEFORE binding!!! */ -PHP_FUNCTION(oci_bind_by_name) -{ - ub2 bind_type = SQLT_CHR; /* unterminated string */ - int name_len; - long maxlen = -1, type = 0; - char *name; - zval *z_statement; - zval *bind_var = NULL; - php_oci_statement *statement; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz/|ll", &z_statement, &name, &name_len, &bind_var, &maxlen, &type) == FAILURE) { - return; - } - - if (type) { - bind_type = (ub2) type; - } - - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - - if (php_oci_bind_by_name(statement, name, name_len, bind_var, maxlen, bind_type TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_bind_array_by_name(resource stmt, string name, array &var, int max_table_length [, int max_item_length [, int type ]]) - Bind a PHP array to an Oracle PL/SQL type by name */ -PHP_FUNCTION(oci_bind_array_by_name) -{ - int name_len; - long max_item_len = -1; - long max_array_len = 0; - long type = SQLT_AFC; - char *name; - zval *z_statement; - zval *bind_var = NULL; - php_oci_statement *statement; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz/l|ll", &z_statement, &name, &name_len, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - - if (ZEND_NUM_ARGS() == 5 && max_item_len <= 0) { - max_item_len = -1; - } - - if (max_array_len <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Maximum array length must be greater than zero"); - RETURN_FALSE; - } - - if (php_oci_bind_array_by_name(statement, name, name_len, bind_var, max_array_len, max_item_len, type TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_free_descriptor() - Deletes large object description */ -PHP_FUNCTION(oci_free_descriptor) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - - if (!getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - zend_list_delete(descriptor->id); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_lob_save( string data [, int offset ]) - Saves a large object */ -PHP_FUNCTION(oci_lob_save) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - char *data; - int data_len; - long offset = 0; - ub4 bytes_written; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &offset) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &offset) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (offset < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset parameter must be greater than or equal to 0"); - RETURN_FALSE; - } - - if (php_oci_lob_write(descriptor, offset, data, data_len, &bytes_written TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_lob_import( string filename ) - Loads file into a LOB */ -PHP_FUNCTION(oci_lob_import) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - char *filename; - int filename_len; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (php_oci_lob_import(descriptor, filename TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto string oci_lob_load() - Loads a large object */ -PHP_FUNCTION(oci_lob_load) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - char *buffer = NULL; - ub4 buffer_len; - - if (!getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (php_oci_lob_read(descriptor, -1, 0, &buffer, &buffer_len TSRMLS_CC)) { - RETURN_FALSE; - } - if (buffer_len > 0) { - RETURN_STRINGL(buffer, buffer_len, 0); - } - else { - RETURN_EMPTY_STRING(); - } -} -/* }}} */ - -/* {{{ proto string oci_lob_read( int length ) - Reads particular part of a large object */ -PHP_FUNCTION(oci_lob_read) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - long length; - char *buffer; - ub4 buffer_len; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &length) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &z_descriptor, oci_lob_class_entry_ptr, &length) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (length <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0"); - RETURN_FALSE; - } - - if (php_oci_lob_read(descriptor, length, descriptor->lob_current_position, &buffer, &buffer_len TSRMLS_CC)) { - RETURN_FALSE; - } - if (buffer_len > 0) { - RETURN_STRINGL(buffer, buffer_len, 0); - } - else { - RETURN_EMPTY_STRING(); - } -} -/* }}} */ - -/* {{{ proto bool oci_lob_eof() - Checks if EOF is reached */ -PHP_FUNCTION(oci_lob_eof) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - ub4 lob_length; - - if (!getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (!php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC) && lob_length >= 0) { - if (lob_length == descriptor->lob_current_position) { - RETURN_TRUE; - } - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto int oci_lob_tell() - Tells LOB pointer position */ -PHP_FUNCTION(oci_lob_tell) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - - if (!getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - RETURN_LONG(descriptor->lob_current_position); -} -/* }}} */ - -/* {{{ proto bool oci_lob_rewind() - Rewind pointer of a LOB */ -PHP_FUNCTION(oci_lob_rewind) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - - if (!getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - descriptor->lob_current_position = 0; - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_lob_seek( int offset [, int whence ]) - Moves the pointer of a LOB */ -PHP_FUNCTION(oci_lob_seek) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - long offset, whence = PHP_OCI_SEEK_SET; - ub4 lob_length; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &offset, &whence) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol|l", &z_descriptor, oci_lob_class_entry_ptr, &offset, &whence) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - - if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { - RETURN_FALSE; - } - - switch(whence) { - case PHP_OCI_SEEK_CUR: - descriptor->lob_current_position += offset; - break; - case PHP_OCI_SEEK_END: - if (descriptor->lob_size + offset >= 0) { - descriptor->lob_current_position = descriptor->lob_size + offset; - } - else { - descriptor->lob_current_position = 0; - } - break; - case PHP_OCI_SEEK_SET: - default: - descriptor->lob_current_position = (offset > 0) ? offset : 0; - break; - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int oci_lob_size() - Returns size of a large object */ -PHP_FUNCTION(oci_lob_size) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - ub4 lob_length; - - if (!getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_LONG(lob_length); -} -/* }}} */ - -/* {{{ proto int oci_lob_write( string string [, int length ]) - Writes data to current position of a LOB */ -PHP_FUNCTION(oci_lob_write) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - int data_len; - long write_len = 0; - ub4 bytes_written; - char *data; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &write_len) == FAILURE) { - return; - } - - if (ZEND_NUM_ARGS() == 2) { - data_len = MIN(data_len, write_len); - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &write_len) == FAILURE) { - return; - } - - if (ZEND_NUM_ARGS() == 3) { - data_len = MIN(data_len, write_len); - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (data_len <= 0) { - RETURN_LONG(0); - } - - if (php_oci_lob_write(descriptor, descriptor->lob_current_position, data, data_len, &bytes_written TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_LONG(bytes_written); -} -/* }}} */ - -/* {{{ proto bool oci_lob_append( object lob ) - Appends data from a LOB to another LOB */ -PHP_FUNCTION(oci_lob_append) -{ - zval **tmp_dest, **tmp_from, *z_descriptor_dest = getThis(), *z_descriptor_from; - php_oci_descriptor *descriptor_dest, *descriptor_from; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_descriptor_from, oci_lob_class_entry_ptr) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor"), (void **)&tmp_dest) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object"); - RETURN_FALSE; - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor"), (void **)&tmp_from) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp_dest, descriptor_dest); - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp_from, descriptor_from); - - if (php_oci_lob_append(descriptor_dest, descriptor_from TSRMLS_CC)) { - RETURN_FALSE; - } - /* XXX should we increase lob_size here ? */ - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_lob_truncate( [ int length ]) - Truncates a LOB */ -PHP_FUNCTION(oci_lob_truncate) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - ub4 trim_length = 0; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &trim_length) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &z_descriptor, oci_lob_class_entry_ptr, &trim_length) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (php_oci_lob_truncate(descriptor, trim_length TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int oci_lob_erase( [ int offset [, int length ] ] ) - Erases a specified portion of the internal LOB, starting at a specified offset */ -PHP_FUNCTION(oci_lob_erase) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - ub4 bytes_erased; - long offset = -1, length = -1; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &offset, &length) == FAILURE) { - return; - } - - if (ZEND_NUM_ARGS() > 0 && offset < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset must be greater than or equal to 0"); - RETURN_FALSE; - } - - if (ZEND_NUM_ARGS() > 1 && length < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to 0"); - RETURN_FALSE; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &z_descriptor, oci_lob_class_entry_ptr, &offset, &length) == FAILURE) { - return; - } - - if (ZEND_NUM_ARGS() > 1 && offset < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset must be greater than or equal to 0"); - RETURN_FALSE; - } - - if (ZEND_NUM_ARGS() > 2 && length < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to 0"); - RETURN_FALSE; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (php_oci_lob_erase(descriptor, offset, length, &bytes_erased TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_LONG(bytes_erased); -} -/* }}} */ - -/* {{{ proto bool oci_lob_flush( [ int flag ] ) - Flushes the LOB buffer */ -PHP_FUNCTION(oci_lob_flush) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - ub4 flush_flag = 0; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flush_flag) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &z_descriptor, oci_lob_class_entry_ptr, &flush_flag) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (descriptor->buffering == PHP_OCI_LOB_BUFFER_DISABLED) { - /* buffering wasn't enabled, there is nothing to flush */ - RETURN_FALSE; - } - - if (php_oci_lob_flush(descriptor, flush_flag TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool ocisetbufferinglob( boolean flag ) - Enables/disables buffering for a LOB */ -PHP_FUNCTION(ocisetbufferinglob) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - zend_bool flag; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &flag) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ob", &z_descriptor, oci_lob_class_entry_ptr, &flag) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (php_oci_lob_set_buffering(descriptor, flag TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool ocigetbufferinglob() - Returns current state of buffering for a LOB */ -PHP_FUNCTION(ocigetbufferinglob) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - - if (!getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) { - RETURN_TRUE; - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto bool oci_lob_copy( object lob_to, object lob_from [, int length ] ) - Copies data from a LOB to another LOB */ -PHP_FUNCTION(oci_lob_copy) -{ - zval **tmp_dest, **tmp_from, *z_descriptor_dest, *z_descriptor_from; - php_oci_descriptor *descriptor_dest, *descriptor_from; - long length = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO|l", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr, &length) == FAILURE) { - return; - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor"), (void **)&tmp_dest) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object"); - RETURN_FALSE; - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor"), (void **)&tmp_from) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp_dest, descriptor_dest); - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp_from, descriptor_from); - - if (ZEND_NUM_ARGS() == 3 && length < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0"); - RETURN_FALSE; - } - - if (ZEND_NUM_ARGS() == 2) { - /* indicate that we want to copy from the current position to the end of the LOB */ - length = -1; - } - - if (php_oci_lob_copy(descriptor_dest, descriptor_from, length TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_lob_is_equal( object lob1, object lob2 ) - Tests to see if two LOB/FILE locators are equal */ -PHP_FUNCTION(oci_lob_is_equal) -{ - zval **tmp_first, **tmp_second, *z_descriptor_first, *z_descriptor_second; - php_oci_descriptor *descriptor_first, *descriptor_second; - boolean is_equal; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO", &z_descriptor_first, oci_lob_class_entry_ptr, &z_descriptor_second, oci_lob_class_entry_ptr) == FAILURE) { - return; - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor_first), "descriptor", sizeof("descriptor"), (void **)&tmp_first) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object"); - RETURN_FALSE; - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor_second), "descriptor", sizeof("descriptor"), (void **)&tmp_second) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp_first, descriptor_first); - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp_second, descriptor_second); - - if (php_oci_lob_is_equal(descriptor_first, descriptor_second, &is_equal TSRMLS_CC)) { - RETURN_FALSE; - } - - if (is_equal == TRUE) { - RETURN_TRUE; - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto bool oci_lob_export([string filename [, int start [, int length]]]) - Writes a large object into a file */ -PHP_FUNCTION(oci_lob_export) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - char *filename, *buffer; - int filename_len; - long start = -1, length = -1, block_length; - php_stream *stream; - ub4 lob_length; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &filename, &filename_len, &start, &length) == FAILURE) { - return; - } - - if (ZEND_NUM_ARGS() > 1 && start < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Start parameter must be greater than or equal to 0"); - RETURN_FALSE; - } - if (ZEND_NUM_ARGS() > 2 && length < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than or equal to 0"); - RETURN_FALSE; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) { - return; - } - - if (ZEND_NUM_ARGS() > 2 && start < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Start parameter must be greater than or equal to 0"); - RETURN_FALSE; - } - if (ZEND_NUM_ARGS() > 3 && length < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than or equal to 0"); - RETURN_FALSE; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { - RETURN_FALSE; - } - - if (start == -1) { - start = 0; - } - - if (length == -1) { - length = lob_length - descriptor->lob_current_position; - } - - if (length == 0) { - /* nothing to write, fail silently */ - RETURN_FALSE; - } - - if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { - RETURN_FALSE; - } - - if (php_check_open_basedir(filename TSRMLS_CC)) { - RETURN_FALSE; - } - - stream = php_stream_open_wrapper_ex(filename, "w", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, NULL); - - block_length = PHP_OCI_LOB_BUFFER_SIZE; - if (block_length > length) { - block_length = length; - } - - while(length > 0) { - ub4 tmp_bytes_read = 0; - if (php_oci_lob_read(descriptor, block_length, start, &buffer, &tmp_bytes_read TSRMLS_CC)) { - php_stream_close(stream); - RETURN_FALSE; - } - if (tmp_bytes_read && !php_stream_write(stream, buffer, tmp_bytes_read)) { - php_stream_close(stream); - efree(buffer); - RETURN_FALSE; - } - if (buffer) { - efree(buffer); - } - - length -= tmp_bytes_read; - descriptor->lob_current_position += tmp_bytes_read; - start += tmp_bytes_read; - - if (block_length > length) { - block_length = length; - } - } - - php_stream_close(stream); - RETURN_TRUE; -} -/* }}} */ - -#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) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - char *data; - int data_len; - long type = OCI_TEMP_CLOB; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &type) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &type) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (php_oci_lob_write_tmp(descriptor, type, data, data_len TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_lob_close() - Closes lob descriptor */ -PHP_FUNCTION(oci_lob_close) -{ - zval **tmp, *z_descriptor = getThis(); - php_oci_descriptor *descriptor; - - if (!getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - if (php_oci_lob_close(descriptor TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ -#endif - -/* {{{ proto object oci_new_descriptor(resource connection [, int type]) - Initialize a new empty descriptor LOB/FILE (LOB is default) */ -PHP_FUNCTION(oci_new_descriptor) -{ - zval *z_connection; - php_oci_connection *connection; - php_oci_descriptor *descriptor; - long type = OCI_DTYPE_LOB; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_connection, &type) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - - /* php_oci_lob_create() checks type */ - descriptor = php_oci_lob_create(connection, type TSRMLS_CC); - - if (!descriptor) { - RETURN_NULL(); - } - - object_init_ex(return_value, oci_lob_class_entry_ptr); - add_property_resource(return_value, "descriptor", descriptor->id); -} -/* }}} */ - -/* {{{ proto bool oci_rollback(resource connection) - Rollback the current context */ -PHP_FUNCTION(oci_rollback) -{ - zval *z_connection; - php_oci_connection *connection; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_connection) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - - if (connection->descriptors) { - zend_hash_destroy(connection->descriptors); - efree(connection->descriptors); - connection->descriptors = NULL; - } - - if (php_oci_connection_rollback(connection TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_commit(resource connection) - Commit the current context */ -PHP_FUNCTION(oci_commit) -{ - zval *z_connection; - php_oci_connection *connection; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_connection) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - - if (connection->descriptors) { - zend_hash_destroy(connection->descriptors); - efree(connection->descriptors); - connection->descriptors = NULL; - } - - if (php_oci_connection_commit(connection TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto string oci_field_name(resource stmt, int col) - Tell the name of a column */ -PHP_FUNCTION(oci_field_name) -{ - php_oci_out_column *column; - - if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { - RETURN_STRINGL(column->name, column->name_len, 1); - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto int oci_field_size(resource stmt, int col) - Tell the maximum data size of a column */ -PHP_FUNCTION(oci_field_size) -{ - php_oci_out_column *column; - - if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { - /* Handle data type of LONG */ - if (column->data_type == SQLT_LNG){ - RETURN_LONG(column->storage_size4); - } - RETURN_LONG(column->data_size); - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto int oci_field_scale(resource stmt, int col) - Tell the scale of a column */ -PHP_FUNCTION(oci_field_scale) -{ - php_oci_out_column *column; - - if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { - RETURN_LONG(column->scale); - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto int oci_field_precision(resource stmt, int col) - Tell the precision of a column */ -PHP_FUNCTION(oci_field_precision) -{ - php_oci_out_column *column; - - if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { - RETURN_LONG(column->precision); - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto mixed oci_field_type(resource stmt, int col) - Tell the data type of a column */ -PHP_FUNCTION(oci_field_type) -{ - php_oci_out_column *column; - - column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); - - if (!column) { - RETURN_FALSE; - } - - switch (column->data_type) { -#ifdef SQLT_TIMESTAMP - case SQLT_TIMESTAMP: - RETVAL_STRING("TIMESTAMP",1); - break; -#endif -#ifdef SQLT_TIMESTAMP_TZ - case SQLT_TIMESTAMP_TZ: - RETVAL_STRING("TIMESTAMP_TZ",1); - break; -#endif - case SQLT_DAT: - RETVAL_STRING("DATE",1); - break; - case SQLT_NUM: - RETVAL_STRING("NUMBER",1); - break; - case SQLT_LNG: - RETVAL_STRING("LONG",1); - break; - case SQLT_BIN: - RETVAL_STRING("RAW",1); - break; - case SQLT_LBI: - RETVAL_STRING("LONG RAW",1); - break; - case SQLT_CHR: - RETVAL_STRING("VARCHAR2",1); - break; - case SQLT_RSET: - RETVAL_STRING("REFCURSOR",1); - break; - case SQLT_AFC: - RETVAL_STRING("CHAR",1); - break; - case SQLT_BLOB: - RETVAL_STRING("BLOB",1); - break; - case SQLT_CLOB: - RETVAL_STRING("CLOB",1); - break; - case SQLT_BFILE: - RETVAL_STRING("BFILE",1); - break; - case SQLT_RDD: - RETVAL_STRING("ROWID",1); - break; - default: - RETVAL_LONG(column->data_type); - } -} -/* }}} */ - -/* {{{ proto int oci_field_type_raw(resource stmt, int col) - Tell the raw oracle data type of a column */ -PHP_FUNCTION(oci_field_type_raw) -{ - php_oci_out_column *column; - - column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); - if (column) { - RETURN_LONG(column->data_type); - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto bool oci_field_is_null(resource stmt, int col) - Tell whether a column is NULL */ -PHP_FUNCTION(oci_field_is_null) -{ - php_oci_out_column *column; - - if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { - if (column->indicator == -1) { - RETURN_TRUE; - } - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto void oci_internal_debug(int onoff) - Toggle internal debugging output for the OCI extension */ -PHP_FUNCTION(oci_internal_debug) -{ - zend_bool on_off; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &on_off) == FAILURE) { - return; - } - OCI_G(debug_mode) = on_off; -} -/* }}} */ - -/* {{{ proto bool oci_execute(resource stmt [, int mode]) - Execute a parsed statement */ -PHP_FUNCTION(oci_execute) -{ - zval *z_statement; - php_oci_statement *statement; - long mode = OCI_COMMIT_ON_SUCCESS; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_statement, &mode) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - - if (php_oci_statement_execute(statement, mode TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_cancel(resource stmt) - Cancel reading from a cursor */ -PHP_FUNCTION(oci_cancel) -{ - zval *z_statement; - php_oci_statement *statement; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_statement) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - - if (php_oci_statement_cancel(statement TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_fetch(resource stmt) - Prepare a new row of data for reading */ -PHP_FUNCTION(oci_fetch) -{ - zval *z_statement; - php_oci_statement *statement; - ub4 nrows = 1; /* only one row at a time is supported for now */ - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_statement) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - - if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int ocifetchinto(resource stmt, array &output [, int mode]) - Fetch a row of result data into an array */ -PHP_FUNCTION(ocifetchinto) -{ - php_oci_fetch_row(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_OCI_NUM, 3); -} -/* }}} */ - -/* {{{ proto int oci_fetch_all(resource stmt, array &output[, int skip[, int maxrows[, int flags]]]) - Fetch all rows of result data into an array */ -PHP_FUNCTION(oci_fetch_all) -{ - zval *z_statement, *array, *element, *tmp; - php_oci_statement *statement; - php_oci_out_column **columns; - zval ***outarrs; - ub4 nrows = 1; - int i; - long rows = 0, flags = 0, skip = 0, maxrows = -1; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|lll", &z_statement, &array, &skip, &maxrows, &flags) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - - zval_dtor(array); - array_init(array); - - while (skip--) { - if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) { - RETURN_LONG(0); - } - } - - if (flags & PHP_OCI_FETCHSTATEMENT_BY_ROW) { - columns = safe_emalloc(statement->ncolumns, sizeof(php_oci_out_column *), 0); - - for (i = 0; i < statement->ncolumns; i++) { - columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); - } - - while (!php_oci_statement_fetch(statement, nrows TSRMLS_CC)) { - zval *row; - - MAKE_STD_ZVAL(row); - array_init(row); - - for (i = 0; i < statement->ncolumns; i++) { - MAKE_STD_ZVAL(element); - php_oci_column_to_zval(columns[ i ], element, PHP_OCI_RETURN_LOBS TSRMLS_CC); - - if (flags & PHP_OCI_NUM) { - zend_hash_next_index_insert(Z_ARRVAL_P(row), &element, sizeof(zval*), NULL); - } else { /* default to ASSOC */ - zend_hash_update(Z_ARRVAL_P(row), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL); - } - } - - zend_hash_next_index_insert(Z_ARRVAL_P(array), &row, sizeof(zval*), NULL); - rows++; - - if (maxrows != -1 && rows == maxrows) { - php_oci_statement_cancel(statement TSRMLS_CC); - break; - } - } - efree(columns); - - } else { /* default to BY_COLUMN */ - columns = safe_emalloc(statement->ncolumns, sizeof(php_oci_out_column *), 0); - outarrs = safe_emalloc(statement->ncolumns, sizeof(zval*), 0); - - if (flags & PHP_OCI_NUM) { - for (i = 0; i < statement->ncolumns; i++) { - columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); - - MAKE_STD_ZVAL(tmp); - array_init(tmp); - zend_hash_next_index_insert(Z_ARRVAL_P(array), &tmp, sizeof(zval*), (void **) &(outarrs[ i ])); - } - } else { /* default to ASSOC */ - for (i = 0; i < statement->ncolumns; i++) { - columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); - - MAKE_STD_ZVAL(tmp); - array_init(tmp); - zend_hash_update(Z_ARRVAL_P(array), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ])); - } - } - - while (!php_oci_statement_fetch(statement, nrows TSRMLS_CC)) { - for (i = 0; i < statement->ncolumns; i++) { - MAKE_STD_ZVAL(element); - php_oci_column_to_zval(columns[ i ], element, PHP_OCI_RETURN_LOBS TSRMLS_CC); - zend_hash_index_update((*(outarrs[ i ]))->value.ht, rows, (void *)&element, sizeof(zval*), NULL); - } - - rows++; - - if (maxrows != -1 && rows == maxrows) { - php_oci_statement_cancel(statement TSRMLS_CC); - break; - } - } - - efree(columns); - efree(outarrs); - } - - RETURN_LONG(rows); -} -/* }}} */ - -/* {{{ proto object oci_fetch_object( resource stmt ) - Fetch a result row as an object */ -PHP_FUNCTION(oci_fetch_object) -{ - php_oci_fetch_row(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_OCI_ASSOC | PHP_OCI_RETURN_NULLS, 2); - - if (Z_TYPE_P(return_value) == IS_ARRAY) { - object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value)); - } -} -/* }}} */ - -/* {{{ proto array oci_fetch_row( resource stmt ) - Fetch a result row as an enumerated array */ -PHP_FUNCTION(oci_fetch_row) -{ - php_oci_fetch_row(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_OCI_NUM | PHP_OCI_RETURN_NULLS, 1); -} -/* }}} */ - -/* {{{ proto array oci_fetch_assoc( resource stmt ) - Fetch a result row as an associative array */ -PHP_FUNCTION(oci_fetch_assoc) -{ - php_oci_fetch_row(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_OCI_ASSOC | PHP_OCI_RETURN_NULLS, 1); -} -/* }}} */ - -/* {{{ proto array oci_fetch_array( resource stmt [, int mode ]) - Fetch a result row as an array */ -PHP_FUNCTION(oci_fetch_array) -{ - php_oci_fetch_row(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_OCI_BOTH | PHP_OCI_RETURN_NULLS, 2); -} -/* }}} */ - -/* {{{ proto bool oci_free_statement(resource stmt) - Free all resources associated with a statement */ -PHP_FUNCTION(oci_free_statement) -{ - zval *z_statement; - php_oci_statement *statement; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_statement) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - if (!statement->nested) { - /* nested cursors cannot be freed, they are allocated once and used during the fetch */ - zend_list_delete(statement->id); - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_close(resource connection) - Disconnect from database */ -PHP_FUNCTION(oci_close) -{ - zval *z_connection; - php_oci_connection *connection; - - if (OCI_G(old_oci_close_semantics)) { - /* do nothing to keep BC */ - return; - } - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_connection) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - zend_list_delete(connection->rsrc_id); - ZVAL_NULL(z_connection); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto resource oci_new_connect(string user, string pass [, string db]) - Connect to an Oracle database and log on. Returns a new session. */ -PHP_FUNCTION(oci_new_connect) -{ - php_oci_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, 1); -} -/* }}} */ - -/* {{{ proto resource oci_connect(string user, string pass [, string db [, string charset [, int session_mode ]]) - Connect to an Oracle database and log on. Returns a new session. */ -PHP_FUNCTION(oci_connect) -{ - php_oci_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, 0); -} -/* }}} */ - -/* {{{ proto resource oci_pconnect(string user, string pass [, string db [, string charset ]]) - Connect to an Oracle database using a persistent connection and log on. Returns a new session. */ -PHP_FUNCTION(oci_pconnect) -{ - php_oci_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1, 0); -} -/* }}} */ - -/* {{{ proto array oci_error([resource stmt|connection|global]) - Return the last error of stmt|connection|global. If no error happened returns false. */ -PHP_FUNCTION(oci_error) -{ - zval *arg; - php_oci_statement *statement; - php_oci_connection *connection; - text *errbuf; - sb4 errcode = 0; - sword error = 0; - dvoid *errh = NULL; -#ifdef HAVE_OCI8_ATTR_STATEMENT - ub2 error_offset = 0; - text *sqltext = NULL; -#endif - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &arg) == FAILURE) { - return; - } - - if (ZEND_NUM_ARGS() > 0) { - statement = (php_oci_statement *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_statement); - - if (statement) { - errh = statement->err; - error = statement->errcode; - -#ifdef HAVE_OCI8_ATTR_STATEMENT - if (php_oci_fetch_sqltext_offset(statement, &sqltext, &error_offset TSRMLS_CC)) { - RETURN_FALSE; - } -#endif - } else { - connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_connection); - - if (connection) { - errh = connection->err; - error = connection->errcode; - } - } - } else { - errh = OCI_G(err); - error = OCI_G(errcode); - } - - if (error == OCI_SUCCESS) { /* no error set in the handle */ - RETURN_FALSE; - } - - if (!errh) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIError: unable to find error handle"); - RETURN_FALSE; - } - - errcode = php_oci_fetch_errmsg(errh, &errbuf TSRMLS_CC); - - if (errcode) { - array_init(return_value); - add_assoc_long(return_value, "code", errcode); - add_assoc_string(return_value, "message", (char*) errbuf, 0); -#ifdef HAVE_OCI8_ATTR_STATEMENT - add_assoc_long(return_value, "offset", error_offset); - add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : "", 1); -#endif - } else { - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto int oci_num_fields(resource stmt) - Return the number of result columns in a statement */ -PHP_FUNCTION(oci_num_fields) -{ - zval *z_statement; - php_oci_statement *statement; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_statement) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - - RETURN_LONG(statement->ncolumns); -} -/* }}} */ - -/* {{{ proto resource oci_parse(resource connection, string query) - Parse a query and return a statement */ -PHP_FUNCTION(oci_parse) -{ - zval *z_connection; - php_oci_connection *connection; - php_oci_statement *statement; - char *query; - int query_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &query, &query_len) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - - statement = php_oci_statement_create(connection, query, query_len TSRMLS_CC); - - if (statement) { - RETURN_RESOURCE(statement->id); - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto bool oci_set_prefetch(resource stmt, int prefetch_rows) - Sets the number of rows to be prefetched on execute to prefetch_rows for stmt */ -PHP_FUNCTION(oci_set_prefetch) -{ - zval *z_statement; - php_oci_statement *statement; - long size; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &z_statement, &size) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - - if (php_oci_statement_set_prefetch(statement, size TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_password_change(resource connection, string username, string old_password, string new_password) - Changes the password of an account */ -PHP_FUNCTION(oci_password_change) -{ - zval *z_connection; - text *user, *pass_old, *pass_new, *dbname; - int user_len, pass_old_len, pass_new_len, dbname_len; - php_oci_connection *connection; - - /* Disable in Safe Mode */ - if (PG(safe_mode)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "is disabled in Safe Mode"); - RETURN_FALSE; - } - - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rsss", &z_connection, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) { - PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - - if (!user_len) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "username cannot be empty"); - RETURN_FALSE; - } - if (!pass_old_len) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "old password cannot be empty"); - RETURN_FALSE; - } - if (!pass_new_len) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "new password cannot be empty"); - RETURN_FALSE; - } - - if (php_oci_password_change(connection, user, user_len, pass_old, pass_old_len, pass_new, pass_new_len TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; - } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ssss", &dbname, &dbname_len, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) { - - if (!user_len) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "username cannot be empty"); - RETURN_FALSE; - } - if (!pass_old_len) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "old password cannot be empty"); - RETURN_FALSE; - } - if (!pass_new_len) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "new password cannot be empty"); - RETURN_FALSE; - } - - connection = php_oci_do_connect_ex(user, user_len, pass_old, pass_old_len, pass_new, pass_new_len, dbname, dbname_len, NULL, OCI_DEFAULT, 0, 0 TSRMLS_CC); - if (!connection) { - RETURN_FALSE; - } - RETURN_RESOURCE(connection->rsrc_id); - } - WRONG_PARAM_COUNT; -} -/* }}} */ - -/* {{{ proto resource oci_new_cursor(resource connection) - Return a new cursor (Statement-Handle) - use this to bind ref-cursors! */ -PHP_FUNCTION(oci_new_cursor) -{ - zval *z_connection; - php_oci_connection *connection; - php_oci_statement *statement; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_connection) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - - statement = php_oci_statement_create(connection, NULL, 0 TSRMLS_CC); - - if (statement) { - RETURN_RESOURCE(statement->id); - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto string oci_result(resource stmt, mixed column) - Return a single column of result data */ -PHP_FUNCTION(oci_result) -{ - php_oci_out_column *column; - - column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); - if(column) { - php_oci_column_to_zval(column, return_value, 0 TSRMLS_CC); - } - else { - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto string oci_server_version(resource connection) - Return a string containing server version information */ -PHP_FUNCTION(oci_server_version) -{ - zval *z_connection; - php_oci_connection *connection; - char *version = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_connection) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - - if (php_oci_server_get_version(connection, &version TSRMLS_CC)) { - RETURN_FALSE; - } - - RETURN_STRING(version, 0); -} -/* }}} */ - -/* {{{ proto string oci_statement_type(resource stmt) - Return the query type of an OCI statement */ -PHP_FUNCTION(oci_statement_type) -{ - zval *z_statement; - php_oci_statement *statement; - ub2 type; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_statement) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - - if (php_oci_statement_get_type(statement, &type TSRMLS_CC)) { - RETURN_FALSE; - } - - switch (type) { - case OCI_STMT_SELECT: - RETVAL_STRING("SELECT",1); - break; - case OCI_STMT_UPDATE: - RETVAL_STRING("UPDATE",1); - break; - case OCI_STMT_DELETE: - RETVAL_STRING("DELETE",1); - break; - case OCI_STMT_INSERT: - RETVAL_STRING("INSERT",1); - break; - case OCI_STMT_CREATE: - RETVAL_STRING("CREATE",1); - break; - case OCI_STMT_DROP: - RETVAL_STRING("DROP",1); - break; - case OCI_STMT_ALTER: - RETVAL_STRING("ALTER",1); - break; - case OCI_STMT_BEGIN: - RETVAL_STRING("BEGIN",1); - break; - case OCI_STMT_DECLARE: - RETVAL_STRING("DECLARE",1); - break; - default: - RETVAL_STRING("UNKNOWN",1); - } -} -/* }}} */ - -/* {{{ proto int oci_num_rows(resource stmt) - Return the row count of an OCI statement */ -PHP_FUNCTION(oci_num_rows) -{ - zval *z_statement; - php_oci_statement *statement; - ub4 rowcount; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_statement) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - - if (php_oci_statement_get_numrows(statement, &rowcount TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_LONG(rowcount); -} -/* }}} */ - -#ifdef PHP_OCI8_HAVE_COLLECTIONS -/* {{{ proto bool oci_free_collection() - Deletes collection object*/ -PHP_FUNCTION(oci_free_collection) -{ - zval **tmp, *z_collection = getThis(); - php_oci_collection *collection; - - if (!getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection); - - zend_list_delete(collection->id); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_collection_append(string value) - Append an object to the collection */ -PHP_FUNCTION(oci_collection_append) -{ - zval **tmp, *z_collection = getThis(); - php_oci_collection *collection; - char *value; - int value_len; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &value, &value_len) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &z_collection, oci_coll_class_entry_ptr, &value, &value_len) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection); - - if (php_oci_collection_append(collection, value, value_len TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto string oci_collection_element_get(int ndx) - Retrieve the value at collection index ndx */ -PHP_FUNCTION(oci_collection_element_get) -{ - zval **tmp, *z_collection = getThis(); - php_oci_collection *collection; - long element_index; - zval *value; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &element_index) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &z_collection, oci_coll_class_entry_ptr, &element_index) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection); - - if (php_oci_collection_element_get(collection, element_index, &value TSRMLS_CC)) { - RETURN_FALSE; - } - - *return_value = *value; - zval_copy_ctor(return_value); - zval_ptr_dtor(&value); -} -/* }}} */ - -/* {{{ proto bool oci_collection_assign(object from) - Assign a collection from another existing collection */ -PHP_FUNCTION(oci_collection_assign) -{ - zval **tmp_dest, **tmp_from, *z_collection_dest = getThis(), *z_collection_from; - php_oci_collection *collection_dest, *collection_from; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_collection_from, oci_coll_class_entry_ptr) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO", &z_collection_dest, oci_coll_class_entry_ptr, &z_collection_from, oci_coll_class_entry_ptr) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_collection_dest), "collection", sizeof("collection"), (void **)&tmp_dest) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property. The first argument should be valid collection object"); - RETURN_FALSE; - } - - if (zend_hash_find(Z_OBJPROP_P(z_collection_from), "collection", sizeof("collection"), (void **)&tmp_from) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property. The second argument should be valid collection object"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_COLLECTION(*tmp_dest, collection_dest); - PHP_OCI_ZVAL_TO_COLLECTION(*tmp_from, collection_from); - - if (php_oci_collection_assign(collection_dest, collection_from TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool oci_collection_element_assign(int index, string val) - Assign element val to collection at index ndx */ -PHP_FUNCTION(oci_collection_element_assign) -{ - zval **tmp, *z_collection = getThis(); - php_oci_collection *collection; - int value_len; - long element_index; - char *value; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &element_index, &value, &value_len) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ols", &z_collection, oci_coll_class_entry_ptr, &element_index, &value, &value_len) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection); - - if (php_oci_collection_element_set(collection, element_index, value, value_len TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int oci_collection_size() - Return the size of a collection */ -PHP_FUNCTION(oci_collection_size) -{ - zval **tmp, *z_collection = getThis(); - php_oci_collection *collection; - sb4 size = 0; - - if (!getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection); - - if (php_oci_collection_size(collection, &size TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_LONG(size); -} -/* }}} */ - -/* {{{ proto int oci_collection_max() - Return the max value of a collection. For a varray this is the maximum length of the array */ -PHP_FUNCTION(oci_collection_max) -{ - zval **tmp, *z_collection = getThis(); - php_oci_collection *collection; - long max; - - if (!getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection); - - if (php_oci_collection_max(collection, &max TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_LONG(max); -} -/* }}} */ - -/* {{{ proto bool oci_collection_trim(int num) - Trim num elements from the end of a collection */ -PHP_FUNCTION(oci_collection_trim) -{ - zval **tmp, *z_collection = getThis(); - php_oci_collection *collection; - long trim_size; - - if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &trim_size) == FAILURE) { - return; - } - } - else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &z_collection, oci_coll_class_entry_ptr, &trim_size) == FAILURE) { - return; - } - } - - if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property"); - RETURN_FALSE; - } - - PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection); - - if (php_oci_collection_trim(collection, trim_size TSRMLS_CC)) { - RETURN_FALSE; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto object oci_new_collection(resource connection, string tdo [, string schema]) - Initialize a new collection */ -PHP_FUNCTION(oci_new_collection) -{ - zval *z_connection; - php_oci_connection *connection; - php_oci_collection *collection; - char *tdo, *schema = NULL; - int tdo_len, schema_len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|s", &z_connection, &tdo, &tdo_len, &schema, &schema_len) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - - if ( (collection = php_oci_collection_create(connection, tdo, tdo_len, schema, schema_len TSRMLS_CC)) ) { - object_init_ex(return_value, oci_coll_class_entry_ptr); - add_property_resource(return_value, "collection", collection->id); - } - else { - RETURN_FALSE; - } -} -/* }}} */ - -#endif - -#endif /* HAVE_OCI8 */ diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c deleted file mode 100644 index 326811df71..0000000000 --- a/ext/oci8/oci8_lob.c +++ /dev/null @@ -1,867 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Stig Sæther Bakken <ssb@php.net> | - | Thies C. Arntzen <thies@thieso.net> | - | | - | Collection support by Andy Sautins <asautins@veripost.net> | - | Temporary LOB support by David Benson <dbenson@mancala.com> | - | ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> | - | | - | Redesigned by: Antony Dovgal <antony@zend.com> | - | Andi Gutmans <andi@zend.com> | - | Wez Furlong <wez@omniti.com> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "ext/standard/info.h" -#include "php_ini.h" - -#if HAVE_OCI8 - -#include "php_oci8.h" -#include "php_oci8_int.h" - -/* for import/export functions */ -#include <fcntl.h> - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -/* {{{ php_oci_lob_create() - Create LOB descriptor and allocate all the resources needed */ -php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long type TSRMLS_DC) -{ - php_oci_descriptor *descriptor; - - switch (type) { - case OCI_DTYPE_FILE: - case OCI_DTYPE_LOB: - case OCI_DTYPE_ROWID: - /* these three are allowed */ - break; - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown descriptor type %ld.", type); - return NULL; - break; - } - - descriptor = ecalloc(1, sizeof(php_oci_descriptor)); - descriptor->type = type; - - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0)); - - if (OCI_G(errcode) != OCI_SUCCESS) { - connection->errcode = php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - efree(descriptor); - return NULL; - } - - descriptor->connection = connection; - - PHP_OCI_REGISTER_RESOURCE(descriptor, le_descriptor); - - descriptor->lob_current_position = 0; - descriptor->lob_size = -1; /* we should set it to -1 to know, that it's just not initialized */ - descriptor->buffering = PHP_OCI_LOB_BUFFER_DISABLED; /* buffering is off by default */ - descriptor->charset_form = SQLCS_IMPLICIT; /* default value */ - descriptor->charset_id = connection->charset; - - if (descriptor->type == OCI_DTYPE_LOB || descriptor->type == OCI_DTYPE_FILE) { - /* add Lobs & Files to hash. we'll flush them at the end */ - if (!connection->descriptors) { - ALLOC_HASHTABLE(connection->descriptors); - zend_hash_init(connection->descriptors, 0, NULL, php_oci_descriptor_flush_hash_dtor, 0); - } - - zend_hash_next_index_insert(connection->descriptors,&descriptor,sizeof(php_oci_descriptor *),NULL); - } - return descriptor; - -} /* }}} */ - -/* {{{ php_oci_lob_get_length() - Get length of the LOB. The length is cached so we don't need to ask Oracle every time */ -int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_DC) -{ - php_oci_connection *connection = descriptor->connection; - - *length = 0; - - if (descriptor->lob_size >= 0) { - *length = descriptor->lob_size; - return 0; - } else { - if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - - descriptor->lob_size = *length; - - if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - } - } - return 0; -} /* }}} */ - -/* {{{ php_oci_lob_callback() - Append LOB portion to a memory buffer */ -#if defined(HAVE_OCI_LOB_READ2) -sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp) -#else -sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece) -#endif -{ - ub4 lenp = (ub4) len; - php_oci_lob_ctx *ctx = (php_oci_lob_ctx *)ctxp; - - switch (piece) - { - case OCI_LAST_PIECE: - *(ctx->lob_data) = erealloc(*(ctx->lob_data), (size_t) (*(ctx->lob_len) + lenp + 1)); - memcpy(*(ctx->lob_data) + *(ctx->lob_len), bufxp, (size_t) lenp); - *(ctx->lob_len) += lenp; - *(*(ctx->lob_data) + *(ctx->lob_len)) = 0x00; - return OCI_CONTINUE; - - case OCI_FIRST_PIECE: - case OCI_NEXT_PIECE: - *(ctx->lob_data) = erealloc(*(ctx->lob_data), (size_t) (*(ctx->lob_len) + lenp)); - memcpy(*(ctx->lob_data) + *(ctx->lob_len), bufxp, (size_t) lenp); - *(ctx->lob_len) += lenp; - return OCI_CONTINUE; - - default: { - TSRMLS_FETCH(); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected LOB piece id received (value:%d)", piece); - efree(*(ctx->lob_data)); - *(ctx->lob_data) = NULL; - *(ctx->lob_len) = 0; - return OCI_ERROR; - } - } -} -/* }}} */ - -/* {{{ php_oci_lob_calculate_buffer() */ -static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, long read_length TSRMLS_DC) -{ - php_oci_connection *connection = descriptor->connection; - ub4 chunk_size; - - if (!descriptor->chunk_size) { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return read_length; /* we have to return original length here */ - } - descriptor->chunk_size = chunk_size; - } - - if ((read_length % descriptor->chunk_size) != 0) { - return descriptor->chunk_size * ((read_length / descriptor->chunk_size) + 1); - } - return read_length; -} -/* }}} */ - -/* {{{ php_oci_lob_read() - Read specified portion of the LOB into the buffer */ -int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long initial_offset, char **data, ub4 *data_len TSRMLS_DC) -{ - php_oci_connection *connection = descriptor->connection; - ub4 length = 0; - int buffer_size = PHP_OCI_LOB_BUFFER_SIZE; - php_oci_lob_ctx ctx; - ub1 *bufp; -#if defined(HAVE_OCI_LOB_READ2) - oraub8 bytes_read, offset = 0; - oraub8 requested_len = read_length; /* this is by default */ - oraub8 chars_read = 0; - int is_clob = 0; -#else - int bytes_read, offset = 0; - int requested_len = read_length; /* this is by default */ -#endif - - *data_len = 0; - *data = NULL; - ctx.lob_len = data_len; - ctx.lob_data = data; - - if (php_oci_lob_get_length(descriptor, &length TSRMLS_CC)) { - return 1; - } - - if (length <= 0) { - return 0; - } - - if (initial_offset > length) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset must be less than size of the LOB"); - return 1; - } - - if (read_length == -1) { - requested_len = length; - } - - if (requested_len > (length - initial_offset)) { - requested_len = length - initial_offset; - } - - if (requested_len <= 0) { - return 0; - } - - offset = initial_offset; - - if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - } -#ifdef HAVE_OCI_LOB_READ2 - else { - ub2 charset_id = 0; - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - - if (charset_id > 0) { /* charset_id is always > 0 for [N]CLOBs */ - is_clob = 1; - } - } - - if (is_clob) { - chars_read = requested_len; - bytes_read = 0; - } else { - chars_read = 0; - bytes_read = requested_len; - } - - buffer_size = (requested_len < buffer_size ) ? requested_len : buffer_size; /* optimize buffer size */ - buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC); /* use chunk size */ - - bufp = (ub1 *) ecalloc(1, buffer_size); - PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead2, - ( - connection->svc, - connection->err, - descriptor->descriptor, - (oraub8 *)&bytes_read, /* IN/OUT bytes toread/read */ - (oraub8 *)&chars_read, /* IN/OUT chars toread/read */ - (oraub8) offset + 1, /* offset (starts with 1) */ - (dvoid *) bufp, - (oraub8) buffer_size, /* size of buffer */ - OCI_FIRST_PIECE, - (dvoid *)&ctx, - (OCICallbackLobRead2) php_oci_lob_callback, /* callback... */ - (ub2) descriptor->charset_id, /* The character set ID of the buffer data. */ - (ub1) descriptor->charset_form /* The character set form of the buffer data. */ - ) - ); - - efree(bufp); - - if (is_clob) { - offset = descriptor->lob_current_position + chars_read; - } else { - offset = descriptor->lob_current_position + bytes_read; - } - -#else - - bytes_read = requested_len; - buffer_size = (requested_len < buffer_size ) ? requested_len : buffer_size; /* optimize buffer size */ - buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC); /* use chunk size */ - - bufp = (ub1 *) ecalloc(1, buffer_size); - PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead, - ( - connection->svc, - connection->err, - descriptor->descriptor, - &bytes_read, /* IN/OUT bytes toread/read */ - offset + 1, /* offset (starts with 1) */ - (dvoid *) bufp, - (ub4) buffer_size, /* size of buffer */ - (dvoid *)&ctx, - (OCICallbackLobRead) php_oci_lob_callback, /* callback... */ - (ub2) descriptor->charset_id, /* The character set ID of the buffer data. */ - (ub1) descriptor->charset_form /* The character set form of the buffer data. */ - ) - ); - - efree(bufp); - offset = descriptor->lob_current_position + bytes_read; - -#endif - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - if (*data) { - efree(*data); - *data = NULL; - } - *data_len = 0; - return 1; - } - - descriptor->lob_current_position = (int)offset; - - if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - if (*data) { - efree(*data); - *data = NULL; - } - *data_len = 0; - return 1; - } - } - - return 0; -} /* }}} */ - -/* {{{ php_oci_lob_write() - Write data to the LOB */ -int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, int data_len, ub4 *bytes_written TSRMLS_DC) -{ - OCILobLocator *lob = (OCILobLocator *) descriptor->descriptor; - php_oci_connection *connection = (php_oci_connection *) descriptor->connection; - ub4 lob_length; - - *bytes_written = 0; - if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { - return 1; - } - - if (!data || data_len <= 0) { - return 0; - } - - if (offset < 0) { - offset = 0; - } - - if (offset > descriptor->lob_current_position) { - offset = descriptor->lob_current_position; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobWrite, - ( - connection->svc, - connection->err, - lob, - (ub4 *)&data_len, - (ub4) offset + 1, - (dvoid *) data, - (ub4) data_len, - OCI_ONE_PIECE, - (dvoid *)0, - (OCICallbackLobWrite) 0, - (ub2) descriptor->charset_id, - (ub1) descriptor->charset_form - ) - ); - - if (connection->errcode) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - *bytes_written = 0; - return 1; - } - *bytes_written = data_len; - descriptor->lob_current_position += data_len; - - if (descriptor->lob_current_position > descriptor->lob_size) { - descriptor->lob_size = descriptor->lob_current_position; - } - - /* marking buffer as used */ - if (descriptor->buffering == PHP_OCI_LOB_BUFFER_ENABLED) { - descriptor->buffering = PHP_OCI_LOB_BUFFER_USED; - } - - return 0; -} /* }}} */ - -/* {{{ php_oci_lob_set_buffering() - Turn buffering off/onn for this particular LOB */ -int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS_DC) -{ - php_oci_connection *connection = descriptor->connection; - - if (!on_off && descriptor->buffering == PHP_OCI_LOB_BUFFER_DISABLED) { - /* disabling when it's already off */ - return 0; - } - - if (on_off && descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) { - /* enabling when it's already on */ - return 0; - } - - if (on_off) { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor)); - } else { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor)); - } - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - descriptor->buffering = on_off ? PHP_OCI_LOB_BUFFER_ENABLED : PHP_OCI_LOB_BUFFER_DISABLED; - return 0; -} /* }}} */ - -/* {{{ php_oci_lob_get_buffering() - Return current buffering state for the LOB */ -int php_oci_lob_get_buffering (php_oci_descriptor *descriptor) -{ - if (descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) { - return 1; - } else { - return 0; - } -} /* }}} */ - -/* {{{ php_oci_lob_copy() - Copy one LOB (or its part) to another one */ -int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from, long length TSRMLS_DC) -{ - php_oci_connection *connection = descriptor_dest->connection; - int length_dest, length_from, copy_len; - - if (php_oci_lob_get_length(descriptor_dest, &length_dest TSRMLS_CC)) { - return 1; - } - - if (php_oci_lob_get_length(descriptor_from, &length_from TSRMLS_CC)) { - return 1; - } - - if (length == -1) { - copy_len = length_from - descriptor_from->lob_current_position; - } else { - copy_len = length; - } - - if ((int)copy_len <= 0) { - /* silently fail, there is nothing to copy */ - return 1; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobCopy, - ( - connection->svc, - connection->err, - descriptor_dest->descriptor, - descriptor_from->descriptor, - copy_len, - descriptor_dest->lob_current_position+1, - descriptor_from->lob_current_position+1 - ) - ); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - - return 0; -} /* }}} */ - -/* {{{ php_oci_lob_close() - Close LOB */ -int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC) -{ - php_oci_connection *connection = descriptor->connection; - int is_temporary; - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - - if (is_temporary) { - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - } - return 0; -} /* }}} */ - -/* {{{ php_oci_lob_flush() - Flush buffers for the LOB (only if they have been used) */ -int php_oci_lob_flush(php_oci_descriptor *descriptor, int flush_flag TSRMLS_DC) -{ - OCILobLocator *lob = descriptor->descriptor; - php_oci_connection *connection = descriptor->connection; - - if (!lob) { - return 1; - } - - switch (flush_flag) { - case 0: - case OCI_LOB_BUFFER_FREE: - /* only these two are allowed */ - break; - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid flag value: %d", flush_flag); - return 1; - break; - } - - /* do not really flush buffer, but report success - * to suppress OCI error when flushing not used buffer - * */ - if (descriptor->buffering != PHP_OCI_LOB_BUFFER_USED) { - return 0; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobFlushBuffer, (connection->svc, connection->err, lob, flush_flag)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - - /* marking buffer as enabled and not used */ - descriptor->buffering = PHP_OCI_LOB_BUFFER_ENABLED; - return 0; -} /* }}} */ - -/* {{{ php_oci_lob_free() - Close LOB descriptor and free associated resources */ -void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC) -{ - - if (!descriptor || !descriptor->connection) { - return; - } - - if (descriptor->connection->descriptors) { - /* delete descriptor from the hash */ - zend_hash_apply_with_argument(descriptor->connection->descriptors, php_oci_descriptor_delete_from_hash, (void *)&descriptor->id TSRMLS_CC); - } - - /* flushing Lobs & Files with buffering enabled */ - if ((descriptor->type == OCI_DTYPE_FILE || descriptor->type == OCI_DTYPE_LOB) && descriptor->buffering == PHP_OCI_LOB_BUFFER_USED) { - php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE TSRMLS_CC); - } - - PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type)); - - zend_list_delete(descriptor->connection->rsrc_id); - efree(descriptor); -} /* }}} */ - -/* {{{ php_oci_lob_import() - Import LOB contents from the given file */ -int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC) -{ - int fp, loblen; - OCILobLocator *lob = (OCILobLocator *)descriptor->descriptor; - php_oci_connection *connection = descriptor->connection; - char buf[8192]; - ub4 offset = 1; - - if ((PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC)) { - return 1; - } - - if ((fp = VCWD_OPEN(filename, O_RDONLY|O_BINARY)) == -1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't open file %s", filename); - return 1; - } - - while ((loblen = read(fp, &buf, sizeof(buf))) > 0) { - PHP_OCI_CALL_RETURN(connection->errcode, - OCILobWrite, - ( - connection->svc, - connection->err, - lob, - &loblen, - (ub4) offset, - (dvoid *) &buf, - (ub4) loblen, - OCI_ONE_PIECE, - (dvoid *)0, - (OCICallbackLobWrite) 0, - (ub2) descriptor->charset_id, - (ub1) descriptor->charset_form - ) - ); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - close(fp); - return 1; - } - offset += loblen; - } - close(fp); - - return 0; -} /* }}} */ - -/* {{{ php_oci_lob_append() - Append data to the end of the LOB */ -int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from TSRMLS_DC) -{ - php_oci_connection *connection = descriptor_dest->connection; - OCILobLocator *lob_dest = descriptor_dest->descriptor; - OCILobLocator *lob_from = descriptor_from->descriptor; - ub4 dest_len, from_len; - - if (php_oci_lob_get_length(descriptor_dest, &dest_len TSRMLS_CC)) { - return 1; - } - - if (php_oci_lob_get_length(descriptor_from, &from_len TSRMLS_CC)) { - return 1; - } - - if (from_len <= 0) { - return 0; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - return 0; -} /* }}} */ - -/* {{{ php_oci_lob_truncate() - Truncate LOB to the given length */ -int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TSRMLS_DC) -{ - php_oci_connection *connection = descriptor->connection; - OCILobLocator *lob = descriptor->descriptor; - ub4 lob_length; - - if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { - return 1; - } - - if (lob_length <= 0) { - return 0; - } - - if (new_lob_length < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Size must be greater than or equal to 0"); - return 1; - } - - if (new_lob_length > lob_length) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Size must be less than or equal to the current LOB size"); - return 1; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobTrim, (connection->svc, connection->err, lob, new_lob_length)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - - descriptor->lob_size = new_lob_length; - return 0; -} /* }}} */ - -/* {{{ php_oci_lob_erase() - Erase (or fill with whitespaces, depending on LOB type) the LOB (or its part) */ -int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, long length, ub4 *bytes_erased TSRMLS_DC) -{ - php_oci_connection *connection = descriptor->connection; - OCILobLocator *lob = descriptor->descriptor; - ub4 lob_length; - - *bytes_erased = 0; - - if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { - return 1; - } - - if (offset == -1) { - offset = descriptor->lob_current_position; - } - - if (length == -1) { - length = lob_length; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1)); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - - *bytes_erased = length; - return 0; -} /* }}} */ - -/* {{{ php_oci_lob_is_equal() - Compare two LOB descriptors and figure out if they are pointing to the same LOB */ -int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descriptor *descriptor_second, boolean *result TSRMLS_DC) -{ - php_oci_connection *connection = descriptor_first->connection; - OCILobLocator *first_lob = descriptor_first->descriptor; - OCILobLocator *second_lob = descriptor_second->descriptor; - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsEqual, (connection->env, first_lob, second_lob, result)); - - if (connection->errcode) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - return 0; -} /* }}} */ - -/* {{{ php_oci_lob_write_tmp() - Create temporary LOB and write data to it */ -int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data, int data_len TSRMLS_DC) -{ - php_oci_connection *connection = descriptor->connection; - OCILobLocator *lob = descriptor->descriptor; - ub4 bytes_written = 0; - - switch (type) { - case OCI_TEMP_BLOB: - case OCI_TEMP_CLOB: - /* only these two are allowed */ - break; - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid temporary lob type: %d", type); - return 1; - break; - } - - if (!data || data_len <= 0) { - /* nothing to write, silently fail */ - return 1; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobCreateTemporary, - ( - connection->svc, - connection->err, - lob, - OCI_DEFAULT, - OCI_DEFAULT, - type, - OCI_ATTR_NOCACHE, - OCI_DURATION_SESSION - ) - ); - - if (connection->errcode) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - - PHP_OCI_CALL_RETURN(connection->errcode, OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE)); - - if (connection->errcode) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; - } - - return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written TSRMLS_CC); -} /* }}} */ - -#endif /* HAVE_OCI8 */ diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c deleted file mode 100644 index 2e412a8713..0000000000 --- a/ext/oci8/oci8_statement.c +++ /dev/null @@ -1,1481 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Stig Sæther Bakken <ssb@php.net> | - | Thies C. Arntzen <thies@thieso.net> | - | | - | Collection support by Andy Sautins <asautins@veripost.net> | - | Temporary LOB support by David Benson <dbenson@mancala.com> | - | ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> | - | | - | Redesigned by: Antony Dovgal <antony@zend.com> | - | Andi Gutmans <andi@zend.com> | - | Wez Furlong <wez@omniti.com> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "ext/standard/info.h" -#include "php_ini.h" - -#if HAVE_OCI8 - -#include "php_oci8.h" -#include "php_oci8_int.h" - -/* {{{ php_oci_statement_create() - Create statemend handle and allocate necessary resources */ -php_oci_statement *php_oci_statement_create (php_oci_connection *connection, char *query, int query_len TSRMLS_DC) -{ - php_oci_statement *statement; - - 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, - &(statement->stmt), - connection->err, - (text *)query, - query_len, - NULL, - 0, - OCI_NTV_SYNTAX, - 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) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - -#if HAVE_OCI_STMT_PREPARE2 - PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_STRLS_CACHE_DELETE)); - 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); - return NULL; - } - } - - if (query && query_len) { - statement->last_query = estrndup(query, query_len); - statement->last_query_len = query_len; - } - else { - statement->last_query = NULL; - statement->last_query_len = 0; - } - - statement->connection = connection; - statement->has_data = 0; - statement->nested = 0; - - if (OCI_G(default_prefetch) > 0) { - php_oci_statement_set_prefetch(statement, OCI_G(default_prefetch) TSRMLS_CC); - } - - PHP_OCI_REGISTER_RESOURCE(statement, le_statement); - - return statement; -} -/* }}} */ - -/* {{{ php_oci_statement_set_prefetch() - Set prefetch buffer size for the statement (we're assuming that one row is ~1K sized) */ -int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 size TSRMLS_DC) -{ - ub4 prefetch = size * 1024; - - if (size < 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of rows has to be greater than or equal to 1"); - return 1; - } - - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_MEMORY, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - prefetch = size; - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - return 0; -} -/* }}} */ - -/* {{{ php_oci_statement_fetch() - Fetch a row from the statement */ -int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) -{ - int i; - void *handlepp; - ub4 typep, iterp, idxp; - ub1 in_outp, piecep; - zend_bool piecewisecols = 0; - - php_oci_out_column *column; - - PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); - - if ( statement->errcode == OCI_NO_DATA || nrows == 0 ) { - if (statement->last_query == NULL) { - /* reset define-list for refcursors */ - if (statement->columns) { - zend_hash_destroy(statement->columns); - efree(statement->columns); - statement->columns = NULL; - statement->ncolumns = 0; - } - statement->executed = 0; - } - - statement->errcode = 0; /* OCI_NO_DATA is NO error for us!!! */ - statement->has_data = 0; - - if (nrows == 0) { - /* this is exactly what we requested */ - return 0; - } - return 1; - } - - /* reset length for all piecewise columns */ - for (i = 0; i < statement->ncolumns; i++) { - column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); - if (column->piecewise) { - column->retlen4 = 0; - piecewisecols = 1; - } - } - - while (statement->errcode == OCI_NEED_DATA) { - if (piecewisecols) { - PHP_OCI_CALL_RETURN(statement->errcode, - OCIStmtGetPieceInfo, - ( - statement->stmt, - statement->err, - &handlepp, - &typep, - &in_outp, - &iterp, - &idxp, - &piecep - ) - ); - - /* scan through our columns for a piecewise column with a matching handle */ - for (i = 0; i < statement->ncolumns; i++) { - column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); - if (column->piecewise && handlepp == column->oci_define) { - if (!column->data) { - column->data = (text *) ecalloc(1, PHP_OCI_PIECE_SIZE + 1); - } else { - column->data = erealloc(column->data, column->retlen4 + PHP_OCI_PIECE_SIZE + 1); - } - column->cb_retlen = PHP_OCI_PIECE_SIZE; - - /* and instruct fetch to fetch waiting piece into our buffer */ - PHP_OCI_CALL(OCIStmtSetPieceInfo, - ( - (void *) column->oci_define, - OCI_HTYPE_DEFINE, - statement->err, - ((char*)column->data) + column->retlen4, - &(column->cb_retlen), - piecep, - &column->indicator, - &column->retcode - ) - ); - } - } - } - - PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); - - if (piecewisecols) { - for (i = 0; i < statement->ncolumns; i++) { - column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); - if (column && column->piecewise && handlepp == column->oci_define) { - column->retlen4 += column->cb_retlen; - } - } - } - } - - if (statement->errcode == OCI_SUCCESS_WITH_INFO || statement->errcode == OCI_SUCCESS) { - statement->has_data = 1; - - /* do the stuff needed for OCIDefineByName */ - for (i = 0; i < statement->ncolumns; i++) { - column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); - if (column == NULL) { - continue; - } - - if (!column->define) { - continue; - } - - zval_dtor(column->define->zval); - php_oci_column_to_zval(column, column->define->zval, 0 TSRMLS_CC); - } - - return 0; - } - - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - - statement->has_data = 0; - - return 1; -} -/* }}} */ - -/* {{{ php_oci_statement_get_column() - Get column from the result set */ -php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, long column_index, char *column_name, int column_name_len TSRMLS_DC) -{ - php_oci_out_column *column = NULL; - int i; - - if (statement->columns == NULL) { /* we release the columns at the end of a fetch */ - return NULL; - } - - if (column_name) { - for (i = 0; i < statement->ncolumns; i++) { - column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); - if (column == NULL) { - continue; - } else if (((int) column->name_len == column_name_len) && (!strncmp(column->name, column_name, column_name_len))) { - return column; - } - } - } else if (column_index != -1) { - if (zend_hash_index_find(statement->columns, column_index, (void **)&column) == FAILURE) { - return NULL; - } - return column; - } - - return NULL; -} -/* }}} */ - -/* {{{ php_oci_statement_execute() - Execute statement */ -int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) -{ - php_oci_out_column *outcol; - php_oci_out_column column; - OCIParam *param = NULL; - text *colname; - ub4 counter; - ub2 define_type; - ub4 iters; - ub4 colcount; - ub2 dynamic; - int dtype; - dvoid *buf; - php_oci_descriptor *descr; - - switch (mode) { - case OCI_COMMIT_ON_SUCCESS: - case OCI_DESCRIBE_ONLY: - case OCI_DEFAULT: - /* only these are allowed */ - break; - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid execute mode given: %d", mode); - return 1; - break; - } - - if (!statement->stmttype) { - /* get statement type */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - } - - if (statement->stmttype == OCI_STMT_SELECT) { - iters = 0; - } else { - iters = 1; - } - - if (statement->last_query) { - /* if we execute refcursors we don't have a query and - we don't want to execute!!! */ - - if (statement->binds) { - zend_hash_apply(statement->binds, (apply_func_t) php_oci_bind_pre_exec TSRMLS_CC); - } - - /* execute statement */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtExecute, (statement->connection->svc, statement->stmt, statement->err, iters, 0, NULL, NULL, mode)); - - if (statement->errcode != OCI_SUCCESS) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - if (statement->binds) { - zend_hash_apply(statement->binds, (apply_func_t) php_oci_bind_post_exec TSRMLS_CC); - } - - if (mode & OCI_COMMIT_ON_SUCCESS) { - statement->connection->needs_commit = 0; - } else { - statement->connection->needs_commit = 1; - } - } - - if (statement->stmttype == OCI_STMT_SELECT && statement->executed == 0) { - /* we only need to do the define step is this very statement is executed the first time! */ - statement->executed = 1; - - ALLOC_HASHTABLE(statement->columns); - zend_hash_init(statement->columns, 13, NULL, php_oci_column_hash_dtor, 0); - - counter = 1; - - /* get number of columns */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - statement->ncolumns = colcount; - - for (counter = 1; counter <= colcount; counter++) { - memset(&column,0,sizeof(php_oci_out_column)); - - if (zend_hash_index_update(statement->columns, counter, &column, sizeof(php_oci_out_column), (void**) &outcol) == FAILURE) { - efree(statement->columns); - /* out of memory */ - return 1; - } - - outcol->statement = statement; - - /* get column */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)¶m, counter)); - - if (statement->errcode != OCI_SUCCESS) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - /* get column datatype */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - /* get character set form */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - /* get character set id */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - /* get size of the column */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - outcol->storage_size4 = outcol->data_size; - outcol->retlen = outcol->data_size; - - /* get scale of the column */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - /* get precision of the column */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - /* get name of the column */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - - outcol->name = estrndup((char*) colname, outcol->name_len); - - /* find a user-setted define */ - if (statement->defines) { - zend_hash_find(statement->defines,outcol->name,outcol->name_len,(void **) &outcol->define); - } - - buf = 0; - switch (outcol->data_type) { - case SQLT_RSET: - outcol->statement = php_oci_statement_create(statement->connection, NULL, 0 TSRMLS_CC); - outcol->stmtid = outcol->statement->id; - outcol->statement->nested = 1; - - define_type = SQLT_RSET; - outcol->is_cursor = 1; - outcol->storage_size4 = -1; - outcol->retlen = -1; - dynamic = OCI_DEFAULT; - buf = &(outcol->statement->stmt); - break; - - case SQLT_RDD: /* ROWID */ - case SQLT_BLOB: /* binary LOB */ - case SQLT_CLOB: /* character LOB */ - case SQLT_BFILE: /* binary file LOB */ - define_type = outcol->data_type; - outcol->is_descr = 1; - outcol->storage_size4 = -1; - dynamic = OCI_DEFAULT; - - if (outcol->data_type == SQLT_BFILE) { - dtype = OCI_DTYPE_FILE; - } else if (outcol->data_type == SQLT_RDD ) { - dtype = OCI_DTYPE_ROWID; - } else { - dtype = OCI_DTYPE_LOB; - } - - descr = php_oci_lob_create(statement->connection, dtype TSRMLS_CC); - if (!descr) { - efree(outcol->name); - return 1; - } - outcol->descid = descr->id; - buf = &(descr->descriptor); - descr->charset_form = outcol->charset_form; - /* descr->charset_id = outcol->charset_id; */ - break; - - case SQLT_LNG: - case SQLT_LBI: - if (outcol->data_type == SQLT_LBI) { - define_type = SQLT_BIN; - } else { - define_type = SQLT_CHR; - } - outcol->storage_size4 = PHP_OCI_MAX_DATA_SIZE; - outcol->piecewise = 1; - dynamic = OCI_DYNAMIC_FETCH; - break; - - case SQLT_BIN: - default: - define_type = SQLT_CHR; - if (outcol->data_type == SQLT_BIN) { - define_type = SQLT_BIN; - } - if ((outcol->data_type == SQLT_DAT) || (outcol->data_type == SQLT_NUM) -#ifdef SQLT_TIMESTAMP - || (outcol->data_type == SQLT_TIMESTAMP) -#endif -#ifdef SQLT_TIMESTAMP_TZ - || (outcol->data_type == SQLT_TIMESTAMP_TZ) -#endif - ) { - outcol->storage_size4 = 512; /* XXX this should fit "most" NLS date-formats and Numbers */ -#if defined(SQLT_IBFLOAT) && defined(SQLT_IBDOUBLE) - } else if (outcol->data_type == SQLT_IBFLOAT || outcol->data_type == SQLT_IBDOUBLE) { - outcol->storage_size4 = 1024; -#endif - } else { - outcol->storage_size4++; /* add one for string terminator */ - } - - outcol->storage_size4 *= 3; - - dynamic = OCI_DEFAULT; - buf = outcol->data = (text *) ecalloc(1, outcol->storage_size4); - break; - } - - if (dynamic == OCI_DYNAMIC_FETCH) { - PHP_OCI_CALL_RETURN(statement->errcode, - OCIDefineByPos, - ( - statement->stmt, /* IN/OUT handle to the requested SQL query */ - (OCIDefine **)&outcol->oci_define, /* IN/OUT pointer to a pointer to a define handle */ - statement->err, /* IN/OUT An error handle */ - counter, /* IN position in the select list */ - (dvoid *)NULL, /* IN/OUT pointer to a buffer */ - outcol->storage_size4, /* IN The size of each valuep buffer in bytes */ - define_type, /* IN The data type */ - (dvoid *)&outcol->indicator, /* IN pointer to an indicator variable or arr */ - (ub2 *)NULL, /* IN/OUT Pointer to array of length of data fetched */ - (ub2 *)NULL, /* OUT Pointer to array of column-level return codes */ - OCI_DYNAMIC_FETCH /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */ - ) - ); - - } else { - PHP_OCI_CALL_RETURN(statement->errcode, - OCIDefineByPos, - ( - statement->stmt, /* IN/OUT handle to the requested SQL query */ - (OCIDefine **)&outcol->oci_define, /* IN/OUT pointer to a pointer to a define handle */ - statement->err, /* IN/OUT An error handle */ - counter, /* IN position in the select list */ - (dvoid *)buf, /* IN/OUT pointer to a buffer */ - outcol->storage_size4, /* IN The size of each valuep buffer in bytes */ - define_type, /* IN The data type */ - (dvoid *)&outcol->indicator, /* IN pointer to an indicator variable or arr */ - (ub2 *)&outcol->retlen, /* IN/OUT Pointer to array of length of data fetched */ - (ub2 *)&outcol->retcode, /* OUT Pointer to array of column-level return codes */ - OCI_DEFAULT /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */ - ) - ); - - } - - if (statement->errcode != OCI_SUCCESS) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 0; - } - } - } - - return 0; -} -/* }}} */ - -/* {{{ php_oci_statement_cancel() - Cancel statement */ -int php_oci_statement_cancel(php_oci_statement *statement TSRMLS_DC) -{ - - return php_oci_statement_fetch(statement, 0 TSRMLS_CC); - -} /* }}} */ - -/* {{{ php_oci_statement_free() - Destroy statement handle and free associated resources */ -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, OCI_STRLS_CACHE_DELETE)); - } else { - PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT)); - } -#else - PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT)); -#endif - statement->stmt = 0; - } - - if (statement->err) { - PHP_OCI_CALL(OCIHandleFree, (statement->err, OCI_HTYPE_ERROR)); - statement->err = 0; - } - - if (statement->last_query) { - efree(statement->last_query); - } - - if (statement->columns) { - zend_hash_destroy(statement->columns); - efree(statement->columns); - } - - if (statement->binds) { - zend_hash_destroy(statement->binds); - efree(statement->binds); - } - - if (statement->defines) { - zend_hash_destroy(statement->defines); - efree(statement->defines); - } - - zend_list_delete(statement->connection->rsrc_id); - efree(statement); -} /* }}} */ - -/* {{{ php_oci_bind_pre_exec() - Helper function */ -int php_oci_bind_pre_exec(void *data TSRMLS_DC) -{ - php_oci_bind *bind = (php_oci_bind *) data; - - /* reset all bind stuff to a normal state..-. */ - - bind->indicator = 0; - - return 0; -} -/* }}} */ - -/* {{{ php_oci_bind_post_exec() - Helper function */ -int php_oci_bind_post_exec(void *data TSRMLS_DC) -{ - php_oci_bind *bind = (php_oci_bind *) data; - php_oci_connection *connection = bind->parent_statement->connection; - - if (bind->indicator == -1) { /* NULL */ - zval *val = bind->zval; - if (Z_TYPE_P(val) == IS_STRING) { - *Z_STRVAL_P(val) = '\0'; /* XXX avoid warning in debug mode */ - } - zval_dtor(val); - ZVAL_NULL(val); - } else if (Z_TYPE_P(bind->zval) == IS_STRING && Z_STRLEN_P(bind->zval) > 0) { - Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRLEN_P(bind->zval)+1); - Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] = '\0'; - } else if (Z_TYPE_P(bind->zval) == IS_ARRAY) { - int i; - zval **entry; - HashTable *hash = HASH_OF(bind->zval); - - zend_hash_internal_pointer_reset(hash); - - switch (bind->array.type) { - case SQLT_NUM: - case SQLT_INT: - case SQLT_LNG: - for (i = 0; i < bind->array.current_length; i++) { - if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - zval_dtor(*entry); - ZVAL_LONG(*entry, ((ub4 *)(bind->array.elements))[i]); - zend_hash_move_forward(hash); - } else { - add_next_index_long(bind->zval, ((ub4 *)(bind->array.elements))[i]); - } - } - break; - case SQLT_FLT: - for (i = 0; i < bind->array.current_length; i++) { - if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - zval_dtor(*entry); - ZVAL_DOUBLE(*entry, ((double *)(bind->array.elements))[i]); - zend_hash_move_forward(hash); - } else { - add_next_index_double(bind->zval, ((double *)(bind->array.elements))[i]); - } - } - break; - case SQLT_ODT: - for (i = 0; i < bind->array.current_length; i++) { - char buff[1024]; - int buff_len = 1024; - - memset((void*)buff,0,sizeof(buff)); - - if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); - zval_dtor(*entry); - - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - ZVAL_NULL(*entry); - } else { - ZVAL_STRINGL(*entry, buff, buff_len, 1); - } - zend_hash_move_forward(hash); - } else { - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); - if (connection->errcode != OCI_SUCCESS) { - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - add_next_index_null(bind->zval); - } else { - add_next_index_stringl(bind->zval, buff, buff_len, 1); - } - } - } - break; - - case SQLT_AFC: - case SQLT_CHR: - case SQLT_VCS: - case SQLT_AVC: - case SQLT_STR: - case SQLT_LVC: - for (i = 0; i < bind->array.current_length; i++) { - /* int curr_element_length = strlen(((text *)bind->array.elements)+i*bind->array.max_length); */ - int curr_element_length = bind->array.element_lengths[i]; - if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - zval_dtor(*entry); - ZVAL_STRINGL(*entry, ((text *)bind->array.elements)+i*bind->array.max_length, curr_element_length, 1); - zend_hash_move_forward(hash); - } else { - add_next_index_stringl(bind->zval, ((text *)bind->array.elements)+i*bind->array.max_length, curr_element_length, 1); - } - } - break; - } - } - - return 0; -} -/* }}} */ - -/* {{{ php_oci_bind_by_name() - 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) -{ - php_oci_collection *bind_collection = NULL; - php_oci_descriptor *bind_descriptor = NULL; - php_oci_statement *bind_statement = NULL; - dvoid *oci_desc = NULL; - /* dvoid *php_oci_collection = NULL; */ - OCIStmt *oci_stmt = NULL; - dvoid *bind_data = NULL; - php_oci_bind bind, *old_bind, *bindp; - int mode = OCI_DATA_AT_EXEC; - sb4 value_sz = -1; - - switch (type) { -#ifdef PHP_OCI8_HAVE_COLLECTIONS - case SQLT_NTY: - { - zval **tmp; - - if (Z_TYPE_P(var) != IS_OBJECT || zend_hash_find(Z_OBJPROP_P(var), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property"); - return 1; - } - - PHP_OCI_ZVAL_TO_COLLECTION_EX(*tmp, bind_collection); - value_sz = sizeof(void*); - mode = OCI_DEFAULT; - - if (!bind_collection->collection) { - return 1; - } - } - break; -#endif - case SQLT_BFILEE: - case SQLT_CFILEE: - case SQLT_CLOB: - case SQLT_BLOB: - case SQLT_RDD: - { - zval **tmp; - - if (Z_TYPE_P(var) != IS_OBJECT || zend_hash_find(Z_OBJPROP_P(var), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property"); - return 1; - } - - PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(*tmp, bind_descriptor); - - value_sz = sizeof(void*); - - oci_desc = bind_descriptor->descriptor; - - if (!oci_desc) { - return 1; - } - } - break; - - case SQLT_INT: - case SQLT_NUM: - convert_to_long(var); - bind_data = (ub4 *)&Z_LVAL_P(var); - value_sz = sizeof(ub4); - mode = OCI_DEFAULT; - break; - - case SQLT_LBI: - case SQLT_BIN: - case SQLT_LNG: - case SQLT_CHR: - /* this is the default case when type was not specified */ - if (Z_TYPE_P(var) != IS_NULL) { - convert_to_string(var); - } - if (maxlength == -1) { - value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRLEN_P(var) : 0; - } else { - value_sz = maxlength; - } - break; - - case SQLT_RSET: - PHP_OCI_ZVAL_TO_STATEMENT_EX(var, bind_statement); - value_sz = sizeof(void*); - - oci_stmt = bind_statement->stmt; - - if (!oci_stmt) { - return 1; - } - break; - - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or unsupported datatype given: %ld", type); - return 1; - break; - } - - if (value_sz == 0) { - value_sz = 1; - } - - if (!statement->binds) { - ALLOC_HASHTABLE(statement->binds); - zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0); - } - - memset((void*)&bind,0,sizeof(php_oci_bind)); - if (zend_hash_find(statement->binds, name, name_len + 1, (void **)&old_bind) == SUCCESS) { - bindp = old_bind; - if (bindp->zval) { - zval_ptr_dtor(&bindp->zval); - } - } else { - zend_hash_update(statement->binds, name, name_len + 1, &bind, sizeof(php_oci_bind), (void **)&bindp); - } - - bindp->descriptor = oci_desc; - bindp->statement = oci_stmt; - bindp->parent_statement = statement; - bindp->zval = var; - zval_add_ref(&var); - - PHP_OCI_CALL_RETURN(statement->errcode, - OCIBindByName, - ( - statement->stmt, /* statement handle */ - (OCIBind **)&bindp->bind, /* bind hdl (will alloc) */ - statement->err, /* error handle */ - (text*) name, /* placeholder name */ - name_len, /* placeholder length */ - (dvoid *)bind_data, /* in/out data */ - value_sz, /* PHP_OCI_MAX_DATA_SIZE, */ /* max size of input/output data */ - (ub2)type, /* in/out data type */ - (dvoid *)&bindp->indicator, /* indicator (ignored) */ - (ub2 *)0, /* size array (ignored) */ - (ub2 *)&bindp->retcode, /* return code (ignored) */ - (ub4)0, /* maxarr_len (PL/SQL only?) */ - (ub4 *)0, /* actual array size (PL/SQL only?) */ - mode /* mode */ - ) - ); - - if (statement->errcode != OCI_SUCCESS) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - if (mode == OCI_DATA_AT_EXEC) { - PHP_OCI_CALL_RETURN(statement->errcode, OCIBindDynamic, - ( - bindp->bind, - statement->err, - (dvoid *)bindp, - php_oci_bind_in_callback, - (dvoid *)bindp, - php_oci_bind_out_callback - ) - ); - - if (statement->errcode != OCI_SUCCESS) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - } - -#ifdef PHP_OCI8_HAVE_COLLECTIONS - if (type == SQLT_NTY) { - /* Bind object */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIBindObject, - ( - bindp->bind, - statement->err, - bind_collection->tdo, - (dvoid **) &(bind_collection->collection), - (ub4 *) 0, - (dvoid **) 0, - (ub4 *) 0 - ) - ); - - if (statement->errcode) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - } -#endif - - return 0; -} /* }}} */ - -/* {{{ php_oci_bind_in_callback() - Callback used when binding LOBs and VARCHARs */ -sb4 php_oci_bind_in_callback( - dvoid *ictxp, /* context pointer */ - OCIBind *bindp, /* bind handle */ - ub4 iter, /* 0-based execute iteration value */ - ub4 index, /* index of current array for PL/SQL or row index for SQL */ - dvoid **bufpp, /* pointer to data */ - ub4 *alenp, /* size after value/piece has been read */ - ub1 *piecep, /* which piece */ - dvoid **indpp) /* indicator value */ -{ - php_oci_bind *phpbind; - zval *val; - TSRMLS_FETCH(); - - if (!(phpbind=(php_oci_bind *)ictxp) || !(val = phpbind->zval)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid phpbind pointer value"); - return OCI_ERROR; - } - - if (ZVAL_IS_NULL(val)) { - /* we're going to insert a NULL column */ - phpbind->indicator = -1; - *bufpp = 0; - *alenp = -1; - *indpp = (dvoid *)&phpbind->indicator; - } else if ((phpbind->descriptor == 0) && (phpbind->statement == 0)) { - /* "normal string bind */ - convert_to_string(val); - - *bufpp = Z_STRVAL_P(val); - *alenp = Z_STRLEN_P(val); - *indpp = (dvoid *)&phpbind->indicator; - } else if (phpbind->statement != 0) { - /* RSET */ - *bufpp = phpbind->statement; - *alenp = -1; /* seems to be allright */ - *indpp = (dvoid *)&phpbind->indicator; - } else { - /* descriptor bind */ - *bufpp = phpbind->descriptor; - *alenp = -1; /* seems to be allright */ - *indpp = (dvoid *)&phpbind->indicator; - } - - *piecep = OCI_ONE_PIECE; /* pass all data in one go */ - - return OCI_CONTINUE; -}/* }}} */ - -/* {{{ php_oci_bind_out_callback() - Callback used when binding LOBs and VARCHARs */ -sb4 php_oci_bind_out_callback( - dvoid *octxp, /* context pointer */ - OCIBind *bindp, /* bind handle */ - ub4 iter, /* 0-based execute iteration value */ - ub4 index, /* index of current array for PL/SQL or row index for SQL */ - dvoid **bufpp, /* pointer to data */ - ub4 **alenpp, /* size after value/piece has been read */ - ub1 *piecep, /* which piece */ - dvoid **indpp, /* indicator value */ - ub2 **rcodepp) /* return code */ -{ - php_oci_bind *phpbind; - zval *val; - sb4 retval = OCI_ERROR; - TSRMLS_FETCH(); - - if (!(phpbind=(php_oci_bind *)octxp) || !(val = phpbind->zval)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid phpbind pointer value"); - return retval; - } - - if ((Z_TYPE_P(val) == IS_OBJECT) || (Z_TYPE_P(val) == IS_RESOURCE)) { - retval = OCI_CONTINUE; - } else { - convert_to_string(val); - zval_dtor(val); - - Z_STRLEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ - Z_STRVAL_P(val) = ecalloc(1, Z_STRLEN_P(phpbind->zval) + 1); - - /* XXX we assume that zend-zval len has 4 bytes */ - *alenpp = (ub4*) &Z_STRLEN_P(phpbind->zval); - *bufpp = Z_STRVAL_P(phpbind->zval); - *piecep = OCI_ONE_PIECE; - *rcodepp = &phpbind->retcode; - *indpp = &phpbind->indicator; - retval = OCI_CONTINUE; - } - - return retval; -} -/* }}} */ - -/* {{{ php_oci_statement_get_column_helper() - Helper function to get column by name and index */ -php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data) -{ - zval *z_statement, **column_index; - php_oci_statement *statement; - php_oci_out_column *column; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rZ", &z_statement, &column_index) == FAILURE) { - return NULL; - } - - statement = (php_oci_statement *) zend_fetch_resource(&z_statement TSRMLS_CC, -1, "oci8 statement", NULL, 1, le_statement); - - if (!statement) { - return NULL; - } - - if (need_data && !statement->has_data) { - return NULL; - } - - if (Z_TYPE_PP(column_index) == IS_STRING) { - column = php_oci_statement_get_column(statement, -1, Z_STRVAL_PP(column_index), Z_STRLEN_PP(column_index) TSRMLS_CC); - if (!column) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%s\"", Z_STRVAL_PP(column_index)); - return NULL; - } - } else { - convert_to_long_ex(column_index); - column = php_oci_statement_get_column(statement, Z_LVAL_PP(column_index), NULL, 0 TSRMLS_CC); - if (!column) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%ld\"", Z_LVAL_PP(column_index)); - return NULL; - } - } - return column; -} /* }}} */ - -/* {{{ php_oci_statement_get_type() - Return type of the statement */ -int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC) -{ - ub2 statement_type; - - *type = 0; - - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - *type = statement_type; - - return 0; -} /* }}} */ - -/* {{{ php_oci_statement_get_numrows() - Get the number of rows fetched to the clientside (NOT the number of rows in the result set) */ -int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSRMLS_DC) -{ - ub4 statement_numrows; - - *numrows = 0; - - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err)); - - if (statement->errcode != OCI_SUCCESS) { - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - - *numrows = statement_numrows; - - return 0; -} /* }}} */ - -/* {{{ php_oci_bind_array_by_name() - Bind arrays to PL/SQL types */ -int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long max_table_length, long maxlength, long type TSRMLS_DC) -{ - php_oci_bind *bind, *bindp; - - convert_to_array(var); - - if (maxlength < -1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid max length value (%ld)", maxlength); - return 1; - } - - switch(type) { - case SQLT_NUM: - case SQLT_INT: - case SQLT_LNG: - bind = php_oci_bind_array_helper_number(var, max_table_length TSRMLS_CC); - break; - - case SQLT_FLT: - bind = php_oci_bind_array_helper_double(var, max_table_length TSRMLS_CC); - break; - - case SQLT_AFC: - case SQLT_CHR: - case SQLT_VCS: - case SQLT_AVC: - case SQLT_STR: - case SQLT_LVC: - if (maxlength == -1 && zend_hash_num_elements(Z_ARRVAL_P(var)) == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must provide max length value for empty arrays"); - return 1; - } - bind = php_oci_bind_array_helper_string(var, max_table_length, maxlength TSRMLS_CC); - break; - case SQLT_ODT: - bind = php_oci_bind_array_helper_date(var, max_table_length, statement->connection TSRMLS_CC); - break; - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or unsupported datatype given: %ld", type); - return 1; - break; - } - - if (bind == NULL) { - /* failed to generate bind struct */ - return 1; - } - - if (!statement->binds) { - ALLOC_HASHTABLE(statement->binds); - zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0); - } - - zend_hash_update(statement->binds, name, name_len + 1, bind, sizeof(php_oci_bind), (void **)&bindp); - - bindp->descriptor = NULL; - bindp->statement = NULL; - bindp->parent_statement = statement; - bindp->bind = NULL; - bindp->zval = var; - bindp->array.type = type; - zval_add_ref(&var); - - PHP_OCI_CALL_RETURN(statement->errcode, - OCIBindByName, - ( - statement->stmt, - (OCIBind **)&bindp->bind, - statement->err, - (text *)name, - name_len, - (dvoid *) bindp->array.elements, - (sb4) bind->array.max_length, - type, - (dvoid *)0, /* bindp->array.indicators, */ - (ub2 *)bind->array.element_lengths, - (ub2 *)0, /* bindp->array.retcodes, */ - (ub4) max_table_length, - (ub4 *) &(bindp->array.current_length), - (ub4) OCI_DEFAULT - ) - ); - - - if (statement->errcode != OCI_SUCCESS) { - efree(bind); - php_oci_error(statement->err, statement->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 1; - } - efree(bind); - return 0; -} /* }}} */ - -/* {{{ php_oci_bind_array_helper_string() - Bind arrays to PL/SQL types */ -php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, long maxlength TSRMLS_DC) -{ - php_oci_bind *bind; - ub4 i; - HashTable *hash; - zval **entry; - - hash = HASH_OF(var); - - if (maxlength == -1) { - zend_hash_internal_pointer_reset(hash); - while (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { - convert_to_string_ex(entry); - if (Z_STRLEN_PP(entry) > maxlength) { - maxlength = Z_STRLEN_PP(entry) + 1; - } - zend_hash_move_forward(hash); - } - } - - bind = emalloc(sizeof(php_oci_bind)); - bind->array.elements = (text *)ecalloc(1, max_table_length * sizeof(text) * (maxlength + 1)); - bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var)); - bind->array.old_length = bind->array.current_length; - bind->array.max_length = maxlength; - bind->array.element_lengths = ecalloc(1, max_table_length * sizeof(ub2)); - - zend_hash_internal_pointer_reset(hash); - - for (i = 0; i < bind->array.current_length; i++) { - if (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { - convert_to_string_ex(entry); - bind->array.element_lengths[i] = Z_STRLEN_PP(entry); - zend_hash_move_forward(hash); - } else { - break; - } - } - - zend_hash_internal_pointer_reset(hash); - for (i = 0; i < max_table_length; i++) { - if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - int element_length; - - convert_to_string_ex(entry); - element_length = (maxlength > Z_STRLEN_PP(entry)) ? Z_STRLEN_PP(entry) : maxlength; - - memcpy((text *)bind->array.elements + i*maxlength, Z_STRVAL_PP(entry), element_length); - ((text *)bind->array.elements)[i*maxlength + element_length] = '\0'; - - zend_hash_move_forward(hash); - } else { - ((text *)bind->array.elements)[i*maxlength] = '\0'; - } - } - zend_hash_internal_pointer_reset(hash); - - return bind; -} /* }}} */ - -/* {{{ php_oci_bind_array_helper_number() - Bind arrays to PL/SQL types */ -php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length TSRMLS_DC) -{ - php_oci_bind *bind; - ub4 i; - HashTable *hash; - zval **entry; - - hash = HASH_OF(var); - - bind = emalloc(sizeof(php_oci_bind)); - bind->array.elements = (ub4 *)emalloc(max_table_length * sizeof(ub4)); - bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var)); - bind->array.old_length = bind->array.current_length; - bind->array.max_length = sizeof(ub4); - bind->array.element_lengths = ecalloc(1, max_table_length * sizeof(ub2)); - - zend_hash_internal_pointer_reset(hash); - for (i = 0; i < max_table_length; i++) { - if (i < bind->array.current_length) { - bind->array.element_lengths[i] = sizeof(ub4); - } - if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - convert_to_long_ex(entry); - ((ub4 *)bind->array.elements)[i] = (ub4) Z_LVAL_PP(entry); - zend_hash_move_forward(hash); - } else { - ((ub4 *)bind->array.elements)[i] = 0; - } - } - zend_hash_internal_pointer_reset(hash); - - return bind; -} /* }}} */ - -/* {{{ php_oci_bind_array_helper_double() - Bind arrays to PL/SQL types */ -php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length TSRMLS_DC) -{ - php_oci_bind *bind; - ub4 i; - HashTable *hash; - zval **entry; - - hash = HASH_OF(var); - - bind = emalloc(sizeof(php_oci_bind)); - bind->array.elements = (double *)emalloc(max_table_length * sizeof(double)); - bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var)); - bind->array.old_length = bind->array.current_length; - bind->array.max_length = sizeof(double); - bind->array.element_lengths = ecalloc(1, max_table_length * sizeof(ub2)); - - zend_hash_internal_pointer_reset(hash); - for (i = 0; i < max_table_length; i++) { - if (i < bind->array.current_length) { - bind->array.element_lengths[i] = sizeof(double); - } - if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - convert_to_double_ex(entry); - ((double *)bind->array.elements)[i] = (double) Z_DVAL_PP(entry); - zend_hash_move_forward(hash); - } else { - ((double *)bind->array.elements)[i] = 0; - } - } - zend_hash_internal_pointer_reset(hash); - - return bind; -} /* }}} */ - -/* {{{ php_oci_bind_array_helper_date() - Bind arrays to PL/SQL types */ -php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, php_oci_connection *connection TSRMLS_DC) -{ - php_oci_bind *bind; - ub4 i; - HashTable *hash; - zval **entry; - - hash = HASH_OF(var); - - bind = emalloc(sizeof(php_oci_bind)); - bind->array.elements = (OCIDate *)emalloc(max_table_length * sizeof(OCIDate)); - bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var)); - bind->array.old_length = bind->array.current_length; - bind->array.max_length = sizeof(OCIDate); - bind->array.element_lengths = ecalloc(1, max_table_length * sizeof(ub2)); - - zend_hash_internal_pointer_reset(hash); - for (i = 0; i < max_table_length; i++) { - OCIDate oci_date; - if (i < bind->array.current_length) { - bind->array.element_lengths[i] = sizeof(OCIDate); - } - if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - - convert_to_string_ex(entry); - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date)); - - if (connection->errcode != OCI_SUCCESS) { - /* failed to convert string to date */ - efree(bind->array.element_lengths); - efree(bind->array.elements); - efree(bind); - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return NULL; - } - - ((OCIDate *)bind->array.elements)[i] = oci_date; - zend_hash_move_forward(hash); - } else { - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, "01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date)); - - if (connection->errcode != OCI_SUCCESS) { - /* failed to convert string to date */ - efree(bind->array.element_lengths); - efree(bind->array.elements); - efree(bind); - php_oci_error(connection->err, connection->errcode TSRMLS_CC); - return NULL; - } - - ((OCIDate *)bind->array.elements)[i] = oci_date; - } - } - zend_hash_internal_pointer_reset(hash); - - return bind; -} /* }}} */ - -#endif /* HAVE_OCI8 */ diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml deleted file mode 100644 index 992b6774aa..0000000000 --- a/ext/oci8/package.xml +++ /dev/null @@ -1,254 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "../pear/package.dtd"> -<package> - <name>oci8</name> - <summary>OCI8 functions</summary> - <maintainers> - <maintainer> - <user>tony2001</user> - <name>Antony Dovgal</name> - <email>tony2001@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>wez</user> - <name>Wez Furlong</name> - <email>wez@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>andi</user> - <name>Andi Gutmans</name> - <email>andi@zend.com</email> - <role>lead</role> - </maintainer> - </maintainers> - <description> - These functions allow you to access Oracle database servers using - the Oracle Call Interface (OCI8). - </description> - <license>PHP</license> - <release> - <state>stable</state> - <version>1.2.2</version> - <date>2006-08-24</date> - <notes> - Reimplemented oci_lob_read() utilities using patch from Massimo Squillace (msquillace at sogei dot it), which should fix Unicode LOB problems. - Fixed bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable) - Fixed bug #38173 (Freeing nested cursors causes OCI8 to segfault) - Fixed bug #37886 (oci_connect may crash when charset parameter is given) - Fixed bug #37931 (possible crash after database restart when using persistent connections) - Fixed bug #37531 (oci8 persistent connection corruption) - Fixed bug #37487 (oci_fetch_array() array-type should always default to OCI_BOTH) - Fixed bug #37392 (Unnecessary call to OCITransRollback() at the end of request) - Fixed bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field) - Fixed bug #34005 (oci_password_change() fails). Patch by pholdaway at technocom-wireless dot com. - Fixed PECL bug #8112 (Persistent connections misbehave when Apache process times out) - </notes> - <deps> - <dep type="php" rel="ge" version="4.3.10"/> - </deps> - </release> - <filelist> - <file role="doc" name="CREDITS"/> - <file role="doc" name="README"/> - <file role="src" name="config.m4"/> - <file role="src" name="config.w32"/> - <file role="src" name="oci8.dsp"/> - <file role="src" name="oci8.c"/> - <file role="src" name="oci8_interface.c"/> - <file role="src" name="oci8_lob.c"/> - <file role="src" name="oci8_statement.c"/> - <file role="src" name="oci8_collection.c"/> - <file role="src" name="php_oci8.h"/> - <file role="src" name="php_oci8_int.h"/> - <file role="test" name="tests/bind_empty.phpt"/> - <file role="test" name="tests/bind_long.phpt"/> - <file role="test" name="tests/bind_raw.phpt"/> - <file role="test" name="tests/bind_long_raw.phpt"/> - <file role="test" name="tests/bug26133.phpt"/> - <file role="test" name="tests/bug27303_2.phpt"/> - <file role="test" name="tests/bug27303_3.phpt"/> - <file role="test" name="tests/bug27303_4.phpt"/> - <file role="test" name="tests/bug27303.phpt"/> - <file role="test" name="tests/bug32325.phpt"/> - <file role="test" name="tests/bug35973.phpt"/> - <file role="test" name="tests/bug36096.phpt"/> - <file role="test" name="tests/bug37581.phpt"/> - <file role="test" name="tests/bug38161.phpt"/> - <file role="test" name="tests/bug38173.phpt"/> - <file role="test" name="tests/close.phpt"/> - <file role="test" name="tests/coll_001.phpt"/> - <file role="test" name="tests/coll_002_func.phpt"/> - <file role="test" name="tests/coll_002.phpt"/> - <file role="test" name="tests/coll_003_func.phpt"/> - <file role="test" name="tests/coll_003.phpt"/> - <file role="test" name="tests/coll_004_func.phpt"/> - <file role="test" name="tests/coll_004.phpt"/> - <file role="test" name="tests/coll_005.phpt"/> - <file role="test" name="tests/coll_006_func.phpt"/> - <file role="test" name="tests/coll_006.phpt"/> - <file role="test" name="tests/coll_007.phpt"/> - <file role="test" name="tests/coll_008.phpt"/> - <file role="test" name="tests/coll_009_func.phpt"/> - <file role="test" name="tests/coll_009.phpt"/> - <file role="test" name="tests/coll_010_func.phpt"/> - <file role="test" name="tests/coll_010.phpt"/> - <file role="test" name="tests/coll_011_func.phpt"/> - <file role="test" name="tests/coll_011.phpt"/> - <file role="test" name="tests/coll_012_func.phpt"/> - <file role="test" name="tests/coll_012.phpt"/> - <file role="test" name="tests/coll_013_func.phpt"/> - <file role="test" name="tests/coll_013.phpt"/> - <file role="test" name="tests/coll_014_func.phpt"/> - <file role="test" name="tests/coll_014.phpt"/> - <file role="test" name="tests/coll_015_func.phpt"/> - <file role="test" name="tests/coll_015.phpt"/> - <file role="test" name="tests/coll_016_func.phpt"/> - <file role="test" name="tests/coll_016.phpt"/> - <file role="test" name="tests/coll_017_func.phpt"/> - <file role="test" name="tests/coll_017.phpt"/> - <file role="test" name="tests/commit_old.phpt"/> - <file role="test" name="tests/commit.phpt"/> - <file role="test" name="tests/connect_1_old.phpt"/> - <file role="test" name="tests/connect_1.phpt"/> - <file role="test" name="tests/connect.inc"/> - <file role="test" name="tests/connect_old.phpt"/> - <file role="test" name="tests/connect.phpt"/> - <file role="test" name="tests/connect_with_charset_001.phpt"/> - <file role="test" name="tests/connect_without_oracle_home_old.phpt"/> - <file role="test" name="tests/connect_without_oracle_home.phpt"/> - <file role="test" name="tests/create_table.inc"/> - <file role="test" name="tests/create_type.inc"/> - <file role="test" name="tests/cursor_bind_err.phpt"/> - <file role="test" name="tests/cursors_old.phpt"/> - <file role="test" name="tests/cursors.phpt"/> - <file role="test" name="tests/debug.phpt"/> - <file role="test" name="tests/default_prefetch1.phpt"/> - <file role="test" name="tests/default_prefetch2.phpt"/> - <file role="test" name="tests/default_prefetch.phpt"/> - <file role="test" name="tests/define_old.phpt"/> - <file role="test" name="tests/define.phpt"/> - <file role="test" name="tests/drop_table.inc"/> - <file role="test" name="tests/drop_type.inc"/> - <file role="test" name="tests/error_old.phpt"/> - <file role="test" name="tests/error.phpt"/> - <file role="test" name="tests/exec_fetch.phpt"/> - <file role="test" name="tests/fetch_all.phpt"/> - <file role="test" name="tests/fetch_array.phpt"/> - <file role="test" name="tests/fetch_assoc.phpt"/> - <file role="test" name="tests/fetch_into1.phpt"/> - <file role="test" name="tests/fetch_into2.phpt"/> - <file role="test" name="tests/fetch_into.phpt"/> - <file role="test" name="tests/fetch_object.phpt"/> - <file role="test" name="tests/fetch.phpt"/> - <file role="test" name="tests/fetch_row.phpt"/> - <file role="test" name="tests/field_funcs_old.phpt"/> - <file role="test" name="tests/field_funcs.phpt"/> - <file role="test" name="tests/lob_001.phpt"/> - <file role="test" name="tests/lob_002.phpt"/> - <file role="test" name="tests/lob_003.phpt"/> - <file role="test" name="tests/lob_004.phpt"/> - <file role="test" name="tests/lob_005.phpt"/> - <file role="test" name="tests/lob_006.phpt"/> - <file role="test" name="tests/lob_007.phpt"/> - <file role="test" name="tests/lob_008.phpt"/> - <file role="test" name="tests/lob_009.phpt"/> - <file role="test" name="tests/lob_009.txt"/> - <file role="test" name="tests/lob_010.phpt"/> - <file role="test" name="tests/lob_011.phpt"/> - <file role="test" name="tests/lob_012.phpt"/> - <file role="test" name="tests/lob_013.phpt"/> - <file role="test" name="tests/lob_014.phpt"/> - <file role="test" name="tests/lob_015.phpt"/> - <file role="test" name="tests/lob_016.phpt"/> - <file role="test" name="tests/lob_017.phpt"/> - <file role="test" name="tests/lob_018.phpt"/> - <file role="test" name="tests/lob_019.phpt"/> - <file role="test" name="tests/lob_020.phpt"/> - <file role="test" name="tests/test.gif"/> - <file role="test" name="tests/lob_temp1.phpt"/> - <file role="test" name="tests/lob_temp.phpt"/> - <file role="test" name="tests/num.phpt"/> - <file role="test" name="tests/oci_execute_segfault.phpt"/> - <file role="test" name="tests/old_oci_close1.phpt"/> - <file role="test" name="tests/old_oci_close.phpt"/> - <file role="test" name="tests/password_new.phpt"/> - <file role="test" name="tests/password_old.phpt"/> - <file role="test" name="tests/password.phpt"/> - <file role="test" name="tests/persistent.phpt"/> - <file role="test" name="tests/prefetch_old.phpt"/> - <file role="test" name="tests/prefetch.phpt"/> - <file role="test" name="tests/privileged_connect1.phpt"/> - <file role="test" name="tests/privileged_connect.phpt"/> - <file role="test" name="tests/serverversion.phpt"/> - <file role="test" name="tests/skipif.inc"/> - <file role="test" name="tests/statement_cache.phpt"/> - <file role="test" name="tests/statement_type_old.phpt"/> - <file role="test" name="tests/statement_type.phpt"/> - <file role="test" name="tests/uncommitted.phpt"/> - </filelist> - <configureoptions> - <configureoption name="with-oci8" default="autodetect" prompt="Please provide the path to ORACLE_HOME dir. Use 'instantclient,/path/to/instant/client/lib' if you're compiling against Oracle Instant Client"/> - </configureoptions> - <changelog> - <release> - <state>stable</state> - <version>1.2.1</version> - <date>2006-05-02</date> - <notes> - Added support for BINARY_DOUBLE and BINARY_FLOAT (see #36764) - Changed oci_field_type() to return VARCHAR2 instead of VARCHAR (according to feature request #36800) - Fixed bug #37059 (oci_bind_by_name() doesn't support RAW and LONG RAW fields) - Fixed bug #37055 (incorrect reference counting for persistent OCI8 connections) - Fixed bug #36934 (OCILob->read() doesn't move internal pointer when reading 0's) - Fixed bug #36851 (Documentation and code discrepancies for NULL data) - Fixed bug #36820 (Privileged connection with an Oracle password file fails) - </notes> - </release> - <release> - <state>stable</state> - <version>1.2.0</version> - <date>2006-03-16</date> - <notes> - Changed OCI8 code to use OCIServerVersion() instead of OCIPing(), which may crash Oracle server of version < 10.2 - Fixed bug #36235 (ocicolumnname returns false before a succesfull fetch) - Fixed bug #36096 (oci_result() returns garbage after oci_fetch() failed) - Fixed bug #36055 (possible OCI8 crash in multithreaded environment) - Fixed bug #36010 (Segfault when re-creating and re-executing statements with bound parameters) - Fixed PECL bug #5571 (oci_new_connect() not closed by oci_close()) - Fixed bug #33383 (crash when retrieving empty BLOBs) - </notes> - </release> - <release> - <state>beta</state> - <version>1.1.1</version> - <date>2005-09-22</date> - <notes> - Fixed segfault when binding empty values. - Fixed problem with oci_error() without arguments. - </notes> - </release> - <release> - <state>beta</state> - <version>1.1</version> - <date>2005-09-07</date> - <notes> - This release fixes a huge amount of bugs and adds support of - statement caching, external credentials etc. - See official announce for details. - </notes> - </release> - <release> - <state>beta</state> - <version>1.0</version> - <date>2004-03-19</date> - <notes> - package.xml added to support installation using pear installer - </notes> - </release> - </changelog> - </package> -<!-- -vim:et:ts=1:sw=1 ---> diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h deleted file mode 100644 index f03fc96be9..0000000000 --- a/ext/oci8/php_oci8.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Stig Sæther Bakken <ssb@php.net> | - | Thies C. Arntzen <thies@thieso.net> | - | | - | Collection support by Andy Sautins <asautins@veripost.net> | - | Temporary LOB support by David Benson <dbenson@mancala.com> | - | ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> | - | | - | Redesigned by: Antony Dovgal <antony@zend.com> | - | Andi Gutmans <andi@zend.com> | - | Wez Furlong <wez@omniti.com> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#if HAVE_OCI8 -# ifndef PHP_OCI8_H -# define PHP_OCI8_H - -#ifdef PHP_WIN32 -#define PHP_OCI_API __declspec(dllexport) -#else -#define PHP_OCI_API -#endif - -#ifdef ZTS -# include "TSRM.h" -#endif - -extern zend_module_entry oci8_module_entry; -#define phpext_oci8_ptr &oci8_module_entry - - -PHP_MINIT_FUNCTION(oci); -PHP_RINIT_FUNCTION(oci); -PHP_MSHUTDOWN_FUNCTION(oci); -PHP_RSHUTDOWN_FUNCTION(oci); -PHP_MINFO_FUNCTION(oci); - -# endif /* !PHP_OCI8_H */ -#else /* !HAVE_OCI8 */ - -# define oci8_module_ptr NULL - -#endif /* HAVE_OCI8 */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ - - diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h deleted file mode 100644 index 65020b8c31..0000000000 --- a/ext/oci8/php_oci8_int.h +++ /dev/null @@ -1,451 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Stig Sæther Bakken <ssb@php.net> | - | Thies C. Arntzen <thies@thieso.net> | - | | - | Collection support by Andy Sautins <asautins@veripost.net> | - | Temporary LOB support by David Benson <dbenson@mancala.com> | - | ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> | - | | - | Redesigned by: Antony Dovgal <antony@zend.com> | - | Andi Gutmans <andi@zend.com> | - | Wez Furlong <wez@omniti.com> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#if HAVE_OCI8 -# ifndef PHP_OCI8_INT_H -# define PHP_OCI8_INT_H - -/* misc defines {{{ */ -# if (defined(__osf__) && defined(__alpha)) -# ifndef A_OSF -# define A_OSF -# endif -# ifndef OSF1 -# define OSF1 -# endif -# ifndef _INTRINSICS -# define _INTRINSICS -# endif -# endif /* osf alpha */ - -#if defined(min) -#undef min -#endif -#if defined(max) -#undef max -#endif -/* }}} */ - -#include "ext/standard/php_string.h" -#include <oci.h> - -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 -#define PHP_OCI_SEEK_CUR 1 -#define PHP_OCI_SEEK_END 2 - -#define PHP_OCI_MAX_NAME_LEN 64 -#define PHP_OCI_MAX_DATA_SIZE INT_MAX -#define PHP_OCI_PIECE_SIZE (64*1024)-1 -#define PHP_OCI_LOB_BUFFER_SIZE 1048576l /* 1Mb seems to be the most reasonable buffer size for LOB reading */ - -#define PHP_OCI_ASSOC 1<<0 -#define PHP_OCI_NUM 1<<1 -#define PHP_OCI_BOTH (PHP_OCI_ASSOC|PHP_OCI_NUM) - -#define PHP_OCI_RETURN_NULLS 1<<2 -#define PHP_OCI_RETURN_LOBS 1<<3 - -#define PHP_OCI_FETCHSTATEMENT_BY_COLUMN 1<<4 -#define PHP_OCI_FETCHSTATEMENT_BY_ROW 1<<5 -#define PHP_OCI_FETCHSTATEMENT_BY (PHP_OCI_FETCHSTATEMENT_BY_COLUMN | PHP_OCI_FETCHSTATEMENT_BY_ROW) - -#define PHP_OCI_LOB_BUFFER_DISABLED 0 -#define PHP_OCI_LOB_BUFFER_ENABLED 1 -#define PHP_OCI_LOB_BUFFER_USED 2 - -/* }}} */ - -typedef struct { /* php_oci_connection {{{ */ - OCIEnv *env; /* private env handle */ - ub2 charset; /* charset ID */ - OCIServer *server; /* private server handle */ - OCISvcCtx *svc; /* private service context handle */ - OCISession *session; /* private session handle */ - OCIError *err; /* private error handle */ - sword errcode; /* last errcode */ - - HashTable *descriptors; /* descriptors hash, used to flush all the LOBs using this connection on commit */ - unsigned is_open:1; /* hels to determine if the connection is dead or not */ - unsigned is_attached:1; /* hels to determine if we should detach from the server when closing/freeing the connection */ - unsigned is_persistent:1; /* self-descriptive */ - unsigned used_this_request:1; /* helps to determine if we should reset connection's next ping time and check its timeout */ - unsigned needs_commit:1; /* helps to determine if we should rollback this connection on close/shutdown */ - int rsrc_id; /* resource ID */ - time_t idle_expiry; /* time when the connection will be considered as expired */ - time_t next_ping; /* time of the next ping */ - char *hash_key; /* hashed details of the connection */ -} php_oci_connection; /* }}} */ - -typedef struct { /* php_oci_descriptor {{{ */ - int id; - php_oci_connection *connection; /* parent connection handle */ - dvoid *descriptor; /* OCI descriptor handle */ - ub4 type; /* descriptor type */ - int lob_current_position; /* LOB internal pointer */ - int lob_size; /* cached LOB size. -1 = Lob wasn't initialized yet */ - int buffering; /* cached buffering flag. 0 - off, 1 - on, 2 - on and buffer was used */ - ub4 chunk_size; /* chunk size of the LOB. 0 - unknown */ - ub1 charset_form; /* charset form, required for NCLOBs */ - ub2 charset_id; /* charset ID */ -} php_oci_descriptor; /* }}} */ - -typedef struct { /* php_oci_lob_ctx {{{ */ - char **lob_data; /* address of pointer to LOB data */ - ub4 *lob_len; /* address of LOB length variable (bytes) */ -} php_oci_lob_ctx; /* }}} */ - -typedef struct { /* php_oci_collection {{{ */ - int id; - php_oci_connection *connection; /* parent connection handle */ - OCIType *tdo; /* collection's type handle */ - OCITypeCode coll_typecode; /* collection's typecode handle */ - OCIRef *elem_ref; /* element's reference handle */ - OCIType *element_type; /* element's type handle */ - OCITypeCode element_typecode; /* element's typecode handle */ - OCIColl *collection; /* collection handle */ -} php_oci_collection; /* }}} */ - -typedef struct { /* php_oci_define {{{ */ - zval *zval; /* zval used in define */ - text *name; /* placeholder's name */ - ub4 name_len; /* placeholder's name length */ - ub4 type; /* define type */ -} php_oci_define; /* }}} */ - -typedef struct { /* php_oci_statement {{{ */ - int id; - php_oci_connection *connection; /* parent connection handle */ - sword errcode; /* last errcode*/ - OCIError *err; /* private error handle */ - OCIStmt *stmt; /* statement handle */ - char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor recieved from Oracle */ - long last_query_len; /* last query length */ - HashTable *columns; /* hash containing all the result columns */ - HashTable *binds; /* binds hash */ - HashTable *defines; /* defines hash */ - int ncolumns; /* number of columns in the result */ - unsigned executed:1; /* statement executed flag */ - unsigned has_data:1; /* statement has more data flag */ - unsigned nested:1; /* statement handle is valid */ - ub2 stmttype; /* statement type */ -} php_oci_statement; /* }}} */ - -typedef struct { /* php_oci_bind {{{ */ - OCIBind *bind; /* bind handle */ - zval *zval; /* value */ - dvoid *descriptor; /* used for binding of LOBS etc */ - OCIStmt *statement; /* used for binding REFCURSORs */ - php_oci_statement *parent_statement; /* pointer to the parent statement */ - struct { - void *elements; -/* ub2 *indicators; */ - ub2 *element_lengths; -/* ub2 *retcodes; */ - long current_length; - long old_length; - long max_length; - long type; - } array; - sb2 indicator; /* -1 means NULL */ - ub2 retcode; /* */ -} php_oci_bind; /* }}} */ - -typedef struct { /* php_oci_out_column {{{ */ - php_oci_statement *statement; /* statement handle. used when fetching REFCURSORS */ - OCIDefine *oci_define; /* define handle */ - char *name; /* column name */ - ub4 name_len; /* column name length */ - ub2 data_type; /* column data type */ - ub2 data_size; /* data size */ - ub4 storage_size4; /* size used when allocating buffers */ - sb2 indicator; /* */ - ub2 retcode; /* code returned when fetching this particular column */ - ub2 retlen; /* */ - ub4 retlen4; /* */ - ub2 is_descr; /* column contains a descriptor */ - ub2 is_cursor; /* column contains a cursor */ - int stmtid; /* statement id for cursors */ - int descid; /* descriptor id for descriptors */ - void *data; /* */ - php_oci_define *define; /* define handle */ - int piecewise; /* column is fetched piece-by-piece */ - ub4 cb_retlen; /* */ - ub2 scale; /* column scale */ - ub2 precision; /* column precision */ - ub1 charset_form; /* charset form, required for NCLOBs */ - ub2 charset_id; /* charset ID */ -} php_oci_out_column; /* }}} */ - -/* {{{ macros */ - -#define PHP_OCI_CALL(func, params) \ - OCI_G(in_call) = 1; \ - func params; \ - OCI_G(in_call) = 0; \ - if (OCI_G(debug_mode)) { \ - php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \ - } - -#define PHP_OCI_CALL_RETURN(__retval, func, params) \ - OCI_G(in_call) = 1; \ - __retval = func params; \ - OCI_G(in_call) = 0; \ - if (OCI_G(debug_mode)) { \ - php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \ - } - -#define PHP_OCI_HANDLE_ERROR(connection, errcode) \ -{ \ - switch (errcode) { \ - case 1013: \ - zend_bailout(); \ - break; \ - case 22: \ - case 1012: \ - case 3113: \ - case 604: \ - case 1041: \ - case 3114: \ - connection->is_open = 0; \ - break; \ - } \ -} \ - -#define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \ - resource->id = ZEND_REGISTER_RESOURCE(NULL, resource, le_resource); \ - zend_list_addref(resource->connection->rsrc_id); - -#define PHP_OCI_ZVAL_TO_CONNECTION(zval, connection) \ - ZEND_FETCH_RESOURCE2(connection, php_oci_connection *, &zval, -1, "oci8 connection", le_connection, le_pconnection); - -#define PHP_OCI_ZVAL_TO_STATEMENT(zval, statement) \ - ZEND_FETCH_RESOURCE(statement, php_oci_statement *, &zval, -1, "oci8 statement", le_statement) - -#define PHP_OCI_ZVAL_TO_DESCRIPTOR(zval, descriptor) \ - ZEND_FETCH_RESOURCE(descriptor, php_oci_descriptor *, &zval, -1, "oci8 descriptor", le_descriptor) - -#define PHP_OCI_ZVAL_TO_COLLECTION(zval, collection) \ - ZEND_FETCH_RESOURCE(collection, php_oci_collection *, &zval, -1, "oci8 collection", le_collection) - -#define PHP_OCI_FETCH_RESOURCE_EX(zval, var, type, name, resource_type) \ - var = (type) zend_fetch_resource(&zval TSRMLS_CC, -1, name, NULL, 1, resource_type); \ - if (!var) { \ - return 1; \ - } - -#define PHP_OCI_ZVAL_TO_CONNECTION_EX(zval, connection) \ - PHP_OCI_FETCH_RESOURCE_EX(zval, connection, php_oci_connection *, "oci8 connection", le_connection) - -#define PHP_OCI_ZVAL_TO_STATEMENT_EX(zval, statement) \ - PHP_OCI_FETCH_RESOURCE_EX(zval, statement, php_oci_statement *, "oci8 statement", le_statement) - -#define PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(zval, descriptor) \ - PHP_OCI_FETCH_RESOURCE_EX(zval, descriptor, php_oci_descriptor *, "oci8 descriptor", le_descriptor) - -#define PHP_OCI_ZVAL_TO_COLLECTION_EX(zval, collection) \ - PHP_OCI_FETCH_RESOURCE_EX(zval, collection, php_oci_collection *, "oci8 collection", le_collection) - -/* }}} */ - -/* PROTOS */ - -/* main prototypes {{{ */ - -void php_oci_column_hash_dtor (void *data); -void php_oci_define_hash_dtor (void *data); -void php_oci_bind_hash_dtor (void *data); -void php_oci_descriptor_flush_hash_dtor (void *data); -int php_oci_descriptor_delete_from_hash(void *data, void *id TSRMLS_DC); - -sb4 php_oci_error (OCIError *, sword TSRMLS_DC); -sb4 php_oci_fetch_errmsg(OCIError *, text ** TSRMLS_DC); -#ifdef HAVE_OCI8_ATTR_STATEMENT -int php_oci_fetch_sqltext_offset(php_oci_statement *, text **, ub2 * TSRMLS_DC); -#endif - -void php_oci_do_connect (INTERNAL_FUNCTION_PARAMETERS, int , int); -php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC); - -int php_oci_connection_rollback(php_oci_connection * TSRMLS_DC); -int php_oci_connection_commit(php_oci_connection * TSRMLS_DC); - -int php_oci_password_change(php_oci_connection *, char *, int, char *, int, char *, int TSRMLS_DC); -int php_oci_server_get_version(php_oci_connection *, char ** TSRMLS_DC); - -void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int, int); -int php_oci_column_to_zval(php_oci_out_column *, zval *, int TSRMLS_DC); - -/* }}} */ - -/* lob related prototypes {{{ */ - -php_oci_descriptor * php_oci_lob_create (php_oci_connection *, long TSRMLS_DC); -int php_oci_lob_get_length (php_oci_descriptor *, ub4 * TSRMLS_DC); -int php_oci_lob_read (php_oci_descriptor *, long, long, char **, ub4 * TSRMLS_DC); -int php_oci_lob_write (php_oci_descriptor *, ub4, char *, int, ub4 * TSRMLS_DC); -int php_oci_lob_flush (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_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_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); -int php_oci_lob_truncate (php_oci_descriptor *, long TSRMLS_DC); -int php_oci_lob_erase (php_oci_descriptor *, long, long, ub4 * TSRMLS_DC); -int php_oci_lob_is_equal (php_oci_descriptor *, php_oci_descriptor *, boolean * TSRMLS_DC); -#if defined(HAVE_OCI_LOB_READ2) -sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp); -#else -sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece); -#endif - -/* }}} */ - -/* collection related prototypes {{{ */ - -php_oci_collection * php_oci_collection_create(php_oci_connection *, char *, int, char *, int TSRMLS_DC); -int php_oci_collection_size(php_oci_collection *, sb4 * TSRMLS_DC); -int php_oci_collection_max(php_oci_collection *, long * TSRMLS_DC); -int php_oci_collection_trim(php_oci_collection *, long TSRMLS_DC); -int php_oci_collection_append(php_oci_collection *, char *, int TSRMLS_DC); -int php_oci_collection_element_get(php_oci_collection *, long, zval** TSRMLS_DC); -int php_oci_collection_element_set(php_oci_collection *, long, char*, int TSRMLS_DC); -int php_oci_collection_element_set_null(php_oci_collection *, long TSRMLS_DC); -int php_oci_collection_element_set_date(php_oci_collection *, long, char *, int TSRMLS_DC); -int php_oci_collection_element_set_number(php_oci_collection *, long, char *, int TSRMLS_DC); -int php_oci_collection_element_set_string(php_oci_collection *, long, char *, int TSRMLS_DC); -int php_oci_collection_assign(php_oci_collection *, php_oci_collection * TSRMLS_DC); -void php_oci_collection_close(php_oci_collection * TSRMLS_DC); -int php_oci_collection_append_null(php_oci_collection * TSRMLS_DC); -int php_oci_collection_append_date(php_oci_collection *, char *, int TSRMLS_DC); -int php_oci_collection_append_number(php_oci_collection *, char *, int TSRMLS_DC); -int php_oci_collection_append_string(php_oci_collection *, char *, int TSRMLS_DC); - - -/* }}} */ - -/* statement related prototypes {{{ */ - -php_oci_statement * php_oci_statement_create (php_oci_connection *, char *, int TSRMLS_DC); -int php_oci_statement_set_prefetch (php_oci_statement *, ub4 TSRMLS_DC); -int php_oci_statement_fetch (php_oci_statement *, ub4 TSRMLS_DC); -php_oci_out_column * php_oci_statement_get_column (php_oci_statement *, long, char*, int TSRMLS_DC); -int php_oci_statement_execute (php_oci_statement *, ub4 TSRMLS_DC); -int php_oci_statement_cancel (php_oci_statement * TSRMLS_DC); -void php_oci_statement_free (php_oci_statement * TSRMLS_DC); -int php_oci_bind_pre_exec(void *data TSRMLS_DC); -int php_oci_bind_post_exec(void *data TSRMLS_DC); -int php_oci_bind_by_name(php_oci_statement *, char *, int, zval*, long, long TSRMLS_DC); -sb4 php_oci_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **); -sb4 php_oci_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **); -php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data); - -int php_oci_statement_get_type(php_oci_statement *, ub2 * TSRMLS_DC); -int php_oci_statement_get_numrows(php_oci_statement *, ub4 * TSRMLS_DC); -int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long max_table_length, long maxlength, long type TSRMLS_DC); -php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length TSRMLS_DC); -php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length TSRMLS_DC); -php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, long maxlength TSRMLS_DC); -php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, php_oci_connection *connection TSRMLS_DC); - -/* }}} */ - -ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ */ - sword errcode; /* global last error code (used when connect fails, for example) */ - OCIError *err; /* global error handle */ - - /* - char *default_username; - char *default_password; - char *default_dbname; - */ - - zend_bool debug_mode; /* debug mode flag */ - - long max_persistent; /* maximum number of persistent connections per process */ - long num_persistent; /* number of existing persistent connections */ - long num_links; /* non-persistent + persistent connections */ - long ping_interval; /* time interval between pings */ - long persistent_timeout; /* time period after which idle persistent connection is considered expired */ - long statement_cache_size; /* statement cache size. used with 9i+ clients only*/ - long default_prefetch; /* default prefetch setting */ - zend_bool privileged_connect; /* privileged connect flag (On/Off) */ - zend_bool old_oci_close_semantics; /* old_oci_close_semantics flag (to determine the way oci_close() should behave) */ - - int shutdown; /* in shutdown flag */ - - OCIEnv *env; /* global environment handle */ - - zend_bool in_call; - -ZEND_END_MODULE_GLOBALS(oci) /* }}} */ - -#ifdef ZTS -#define OCI_G(v) TSRMG(oci_globals_id, zend_oci_globals *, v) -#else -#define OCI_G(v) (oci_globals.v) -#endif - -ZEND_EXTERN_MODULE_GLOBALS(oci) - -# endif /* !PHP_OCI8_INT_H */ -#else /* !HAVE_OCI8 */ - -# define oci8_module_ptr NULL - -#endif /* HAVE_OCI8 */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ - - diff --git a/ext/oci8/tests/array_bind_001.phpt b/ext/oci8/tests/array_bind_001.phpt deleted file mode 100644 index 1310325ad4..0000000000 --- a/ext/oci8/tests/array_bind_001.phpt +++ /dev/null @@ -1,69 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and invalid values 1 ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name DATE)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = ""; - -oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_ODT); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_bind_array_by_name(): OCI-21560: argument 3 is null, invalid, or out of range in %s on line %d - -Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d -array(1) { - [0]=> - string(0) "" -} -Done diff --git a/ext/oci8/tests/array_bind_002.phpt b/ext/oci8/tests/array_bind_002.phpt deleted file mode 100644 index 4c76df42f9..0000000000 --- a/ext/oci8/tests/array_bind_002.phpt +++ /dev/null @@ -1,77 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and invalid values 2 ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name DATE)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17","05-NOV-05"); - -oci_bind_array_by_name($statement, ":c1", $array, 0, 0, SQLT_ODT); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_bind_array_by_name(): Maximum array length must be greater than zero in %s on line %d - -Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d -array(5) { - [0]=> - string(9) "06-DEC-05" - [1]=> - string(9) "10-DEC-80" - [2]=> - string(9) "21-AUG-91" - [3]=> - string(9) "26-OCT-17" - [4]=> - string(9) "05-NOV-05" -} -Done diff --git a/ext/oci8/tests/array_bind_003.phpt b/ext/oci8/tests/array_bind_003.phpt deleted file mode 100644 index 497e46e496..0000000000 --- a/ext/oci8/tests/array_bind_003.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and invalid values 3 ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name DATE)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17"); - -oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_ODT); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_execute(): OCI_NO_DATA in %s on line %d -array(4) { - [0]=> - string(9) "06-DEC-05" - [1]=> - string(9) "10-DEC-80" - [2]=> - string(9) "21-AUG-91" - [3]=> - string(9) "26-OCT-17" -} -Done diff --git a/ext/oci8/tests/array_bind_004.phpt b/ext/oci8/tests/array_bind_004.phpt deleted file mode 100644 index 1ddf85149b..0000000000 --- a/ext/oci8/tests/array_bind_004.phpt +++ /dev/null @@ -1,65 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and invalid values 4 ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name DATE)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array(); - -oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_ODT); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_execute(): OCI_NO_DATA in %s on line %d -array(0) { -} -Done diff --git a/ext/oci8/tests/array_bind_005.phpt b/ext/oci8/tests/array_bind_005.phpt deleted file mode 100644 index 15278532ea..0000000000 --- a/ext/oci8/tests/array_bind_005.phpt +++ /dev/null @@ -1,75 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and invalid values 5 ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name VARCHAR(20))"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array("", "", "", "", ""); - -oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_execute(): ORA-01405: fetched column value is NULL in %s on line %d -array(5) { - [0]=> - string(0) "" - [1]=> - string(0) "" - [2]=> - string(0) "" - [3]=> - string(0) "" - [4]=> - string(0) "" -} -Done diff --git a/ext/oci8/tests/array_bind_006.phpt b/ext/oci8/tests/array_bind_006.phpt deleted file mode 100644 index e229dd8722..0000000000 --- a/ext/oci8/tests/array_bind_006.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -oci_bind_array_by_name(), SQLT_CHR and default max_length ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name VARCHAR(20))"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = array("one", "two", "three", "four", "five"); - -oci_bind_array_by_name($statement, ":c1", $array, 5, -1, SQLT_CHR); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECT-- -array(5) { - [0]=> - string(4) "five" - [1]=> - string(4) "four" - [2]=> - string(5) "three" - [3]=> - string(3) "two" - [4]=> - string(3) "one" -} -Done diff --git a/ext/oci8/tests/array_bind_007.phpt b/ext/oci8/tests/array_bind_007.phpt deleted file mode 100644 index 10c92a8e7d..0000000000 --- a/ext/oci8/tests/array_bind_007.phpt +++ /dev/null @@ -1,77 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and invalid values 7 ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name NUMBER)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array(1,2,3,4,5); - -oci_bind_array_by_name($statement, ":c1", $array, 5, 5, -1); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: -1 in %s on line %d - -Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d -array(5) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - [3]=> - int(4) - [4]=> - int(5) -} -Done diff --git a/ext/oci8/tests/array_bind_008.phpt b/ext/oci8/tests/array_bind_008.phpt deleted file mode 100644 index c44304c11c..0000000000 --- a/ext/oci8/tests/array_bind_008.phpt +++ /dev/null @@ -1,78 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and invalid values 8 ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name NUMBER)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array(1,2,3,4,5); - -oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_CHR); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_execute(): ORA-06550: line %d, column %d: -PLS-00418: array bind type must match PL/SQL table row type -ORA-06550: line %d, column %d: -PL/SQL: Statement ignored in %s on line %d -array(5) { - [0]=> - string(1) "1" - [1]=> - string(1) "2" - [2]=> - string(1) "3" - [3]=> - string(1) "4" - [4]=> - string(1) "5" -} -Done diff --git a/ext/oci8/tests/array_bind_009.phpt b/ext/oci8/tests/array_bind_009.phpt deleted file mode 100644 index 8e83b0982c..0000000000 --- a/ext/oci8/tests/array_bind_009.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and invalid values 9 ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -var_dump(oci_bind_array_by_name($c, ":c1", $array, 5, 5, SQLT_CHR)); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_bind_array_by_name(): supplied resource is not a valid oci8 statement resource in %s on line %d -bool(false) -Done diff --git a/ext/oci8/tests/array_bind_010.phpt b/ext/oci8/tests/array_bind_010.phpt deleted file mode 100644 index a77ed913ea..0000000000 --- a/ext/oci8/tests/array_bind_010.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and invalid values 8 ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$statement = oci_parse($c, 'SELECT user FROM v$session'); - -$array = Array(1,2,3,4,5); - -oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_CHR); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_bind_array_by_name(): ORA-01036: illegal variable name/number in %s on line %d -array(5) { - [0]=> - string(1) "1" - [1]=> - string(1) "2" - [2]=> - string(1) "3" - [3]=> - string(1) "4" - [4]=> - string(1) "5" -} -Done diff --git a/ext/oci8/tests/array_bind_011.phpt b/ext/oci8/tests/array_bind_011.phpt deleted file mode 100644 index e8e00a8091..0000000000 --- a/ext/oci8/tests/array_bind_011.phpt +++ /dev/null @@ -1,67 +0,0 @@ ---TEST-- -oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name VARCHAR(20))"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = array(); - -oci_bind_array_by_name($statement, ":c1", $array, 5, -1, SQLT_CHR); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d - -Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d -array(0) { -} -Done diff --git a/ext/oci8/tests/array_bind_012.phpt b/ext/oci8/tests/array_bind_012.phpt deleted file mode 100644 index 2208f0b3b9..0000000000 --- a/ext/oci8/tests/array_bind_012.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$statement = oci_parse($c, 'SELECT user FROM v$session'); - -$array = array(); - -oci_bind_array_by_name($statement, ":c1", $array, 5, -10, SQLT_CHR); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_bind_array_by_name(): Invalid max length value (-10) in %s on line %d -array(0) { -} -Done diff --git a/ext/oci8/tests/array_bind_013.phpt b/ext/oci8/tests/array_bind_013.phpt deleted file mode 100644 index da8f6fdd1a..0000000000 --- a/ext/oci8/tests/array_bind_013.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$statement = oci_parse($c, 'SELECT user FROM v$session'); - -$array = array(); - -var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -10, SQLT_CHR, -10)); -var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -10)); -var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -1)); -var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, 0)); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_bind_array_by_name() expects at most 6 parameters, 7 given in %s on line %d -NULL - -Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d -bool(false) - -Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d -bool(false) - -Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d -bool(false) -array(0) { -} -Done diff --git a/ext/oci8/tests/array_bind_date.phpt b/ext/oci8/tests/array_bind_date.phpt deleted file mode 100644 index 63da558f91..0000000000 --- a/ext/oci8/tests/array_bind_date.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and SQLT_ODT ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name DATE)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17","05-NOV-05"); - -oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_ODT); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECT-- -array(5) { - [0]=> - string(9) "05-NOV-05" - [1]=> - string(9) "26-OCT-17" - [2]=> - string(9) "21-AUG-91" - [3]=> - string(9) "10-DEC-80" - [4]=> - string(9) "06-DEC-05" -} -Done diff --git a/ext/oci8/tests/array_bind_date1.phpt b/ext/oci8/tests/array_bind_date1.phpt deleted file mode 100644 index ebf767570b..0000000000 --- a/ext/oci8/tests/array_bind_date1.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and SQLT_ODT ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name DATE)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17","05-NOV-05"); - -oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_ODT); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECT-- -array(5) { - [0]=> - string(9) "05-NOV-05" - [1]=> - string(9) "26-OCT-17" - [2]=> - string(9) "21-AUG-91" - [3]=> - string(9) "10-DEC-80" - [4]=> - string(9) "06-DEC-05" -} -Done diff --git a/ext/oci8/tests/array_bind_float.phpt b/ext/oci8/tests/array_bind_float.phpt deleted file mode 100644 index 1aafb24317..0000000000 --- a/ext/oci8/tests/array_bind_float.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and SQLT_FLT ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name FLOAT)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array(1.243,2.5658,3.4234,4.2123,5.9999); - -oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_FLT); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECT-- -array(5) { - [0]=> - float(5.9999) - [1]=> - float(4.2123) - [2]=> - float(3.4234) - [3]=> - float(2.5658) - [4]=> - float(1.243) -} -Done diff --git a/ext/oci8/tests/array_bind_float1.phpt b/ext/oci8/tests/array_bind_float1.phpt deleted file mode 100644 index ead85890fa..0000000000 --- a/ext/oci8/tests/array_bind_float1.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and SQLT_FLT ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name FLOAT)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array(1.243,2.5658,3.4234,4.2123,5.9999); - -oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_FLT); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECT-- -array(5) { - [0]=> - float(5.9999) - [1]=> - float(4.2123) - [2]=> - float(3.4234) - [3]=> - float(2.5658) - [4]=> - float(1.243) -} -Done diff --git a/ext/oci8/tests/array_bind_int.phpt b/ext/oci8/tests/array_bind_int.phpt deleted file mode 100644 index 3c8bfd4f57..0000000000 --- a/ext/oci8/tests/array_bind_int.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and SQLT_INT ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name NUMBER)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array(1,2,3,4,5); - -oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_NUM); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECT-- -array(5) { - [0]=> - int(5) - [1]=> - int(4) - [2]=> - int(3) - [3]=> - int(2) - [4]=> - int(1) -} -Done diff --git a/ext/oci8/tests/array_bind_int1.phpt b/ext/oci8/tests/array_bind_int1.phpt deleted file mode 100644 index eb2072adcf..0000000000 --- a/ext/oci8/tests/array_bind_int1.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and SQLT_INT ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name NUMBER)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array(1,2,3,4,5); - -oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_NUM); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECT-- -array(5) { - [0]=> - int(5) - [1]=> - int(4) - [2]=> - int(3) - [3]=> - int(2) - [4]=> - int(1) -} -Done diff --git a/ext/oci8/tests/array_bind_str.phpt b/ext/oci8/tests/array_bind_str.phpt deleted file mode 100644 index c8e1e0cdb5..0000000000 --- a/ext/oci8/tests/array_bind_str.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and SQLT_AVC ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name VARCHAR(20))"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array("one", "two", "three", "four", "five"); - -oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECT-- -array(5) { - [0]=> - string(4) "five" - [1]=> - string(4) "four" - [2]=> - string(5) "three" - [3]=> - string(3) "two" - [4]=> - string(3) "one" -} -Done diff --git a/ext/oci8/tests/array_bind_str1.phpt b/ext/oci8/tests/array_bind_str1.phpt deleted file mode 100644 index af4dbfe220..0000000000 --- a/ext/oci8/tests/array_bind_str1.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -oci_bind_array_by_name() and SQLT_AVC ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name VARCHAR(20))"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$create_pkg = " -CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS - TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; - PROCEDURE iobind(c1 IN OUT ARRTYPE); -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg); -oci_execute($statement); - -$create_pkg_body = " -CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS - CURSOR CUR IS SELECT name FROM bind_test; - PROCEDURE iobind(c1 IN OUT ARRTYPE) IS - BEGIN - FOR i IN 1..5 LOOP - INSERT INTO bind_test VALUES (c1(i)); - END LOOP; - IF NOT CUR%ISOPEN THEN - OPEN CUR; - END IF; - FOR i IN REVERSE 1..5 LOOP - FETCH CUR INTO c1(i); - IF CUR%NOTFOUND THEN - CLOSE CUR; - EXIT; - END IF; - END LOOP; - END iobind; -END ARRAYBINDPKG1;"; -$statement = oci_parse($c, $create_pkg_body); -oci_execute($statement); - -$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;"); - -$array = Array("one", "two", "three", "four", "five"); - -oci_bind_array_by_name($statement, ":c1", $array, 10, 20, SQLT_CHR); - -oci_execute($statement); - -var_dump($array); - -echo "Done\n"; -?> ---EXPECT-- -array(5) { - [0]=> - string(4) "five" - [1]=> - string(4) "four" - [2]=> - string(5) "three" - [3]=> - string(3) "two" - [4]=> - string(3) "one" -} -Done diff --git a/ext/oci8/tests/bind_empty.phpt b/ext/oci8/tests/bind_empty.phpt deleted file mode 100644 index 9c602b32c3..0000000000 --- a/ext/oci8/tests/bind_empty.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -binding empty values ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table bind_test(name VARCHAR(10))"; -$statement = oci_parse($c, $create); -oci_execute($statement); - - -$name = null; -$stmt = oci_parse($c, "UPDATE bind_test SET name=:name"); -oci_bind_by_name($stmt, ":name", $name); - -$res = oci_execute($stmt); - -$name = ""; -$stmt = oci_parse($c, "UPDATE bind_test SET name=:name"); -oci_bind_by_name($stmt, ":name", $name); - -$res = oci_execute($stmt); - -$drop = "DROP table bind_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -echo "Done\n"; - -?> ---EXPECTF-- -Done diff --git a/ext/oci8/tests/bind_long.phpt b/ext/oci8/tests/bind_long.phpt deleted file mode 100644 index ddbc11eb69..0000000000 --- a/ext/oci8/tests/bind_long.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -bind LONG field ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$stmt = oci_parse($c, "create table phptestlng( id number(10), filetxt long)"); -oci_execute($stmt); - -$stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)"); -$i=1; -$filetxt = file_get_contents( dirname(__FILE__)."/test.txt"); - -oci_bind_by_name( $stmt, ":id", $i, -1); -oci_bind_by_name( $stmt, ":filetxt", $filetxt, -1, SQLT_LNG); -oci_execute($stmt, OCI_DEFAULT); -oci_commit($c); - -$stmt = oci_parse($c, "SELECT filetxt FROM phptestlng"); -oci_execute($stmt); - -$row = oci_fetch_row($stmt); -var_dump(md5($row[0])); -var_dump(strlen($row[0])); - -$stmt = oci_parse($c, "drop table phptestlng"); -oci_execute($stmt); - -echo "Done\n"; - -?> ---EXPECT-- -string(32) "da852396d08c9ef9fbdf914db1d6d5bb" -int(276) -Done diff --git a/ext/oci8/tests/bind_long_raw.phpt b/ext/oci8/tests/bind_long_raw.phpt deleted file mode 100644 index 2a9962eace..0000000000 --- a/ext/oci8/tests/bind_long_raw.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -bind LONG RAW field ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$stmt = oci_parse($c, "create table phptestlngraw( id number(10), fileimage long raw)"); -oci_execute($stmt); - -$stmt = oci_parse ($c, "insert into phptestlngraw (id, fileimage) values (:id, :fileimage)"); -$i=1; -$fileimage = file_get_contents( dirname(__FILE__)."/test.gif"); - -oci_bind_by_name( $stmt, ":id", $i, -1); -oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_LBI); -oci_execute($stmt, OCI_DEFAULT); -oci_commit($c); - -$stmt = oci_parse($c, "SELECT fileimage FROM phptestlngraw"); -oci_execute($stmt); - -$row = oci_fetch_row($stmt); -var_dump(md5($row[0])); -var_dump(strlen($row[0])); - -$stmt = oci_parse($c, "drop table phptestlngraw"); -oci_execute($stmt); - -echo "Done\n"; - -?> ---EXPECT-- -string(32) "614fcbba1effb7caa27ef0ef25c27fcf" -int(2523) -Done diff --git a/ext/oci8/tests/bind_raw.phpt b/ext/oci8/tests/bind_raw.phpt deleted file mode 100644 index c9087e552b..0000000000 --- a/ext/oci8/tests/bind_raw.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -bind RAW field ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$stmt = oci_parse($c, "create table phptestrawtable( id number(10), fileimage raw(1000))"); -oci_execute($stmt); - -$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)"); -$i=1; -$fileimage = file_get_contents( dirname(__FILE__)."/test.gif"); -$fileimage = substr($fileimage, 0, 300); - -oci_bind_by_name( $stmt, ":id", $i, -1); -oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_BIN); -oci_execute($stmt, OCI_DEFAULT); -oci_commit($c); - -$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable"); -oci_execute($stmt); - -$row = oci_fetch_row($stmt); -var_dump(md5($row[0])); -var_dump(strlen($row[0])); - -$stmt = oci_parse($c, "drop table phptestrawtable"); -oci_execute($stmt); - -echo "Done\n"; - -?> ---EXPECT-- -string(32) "88b274d7a257ac6f70435b83abd4e26e" -int(300) -Done diff --git a/ext/oci8/tests/bug26133.phpt b/ext/oci8/tests/bug26133.phpt deleted file mode 100644 index df319feb05..0000000000 --- a/ext/oci8/tests/bug26133.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Bug #26133 (ocifreedesc() segfault) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - - require dirname(__FILE__).'/connect.inc'; - require dirname(__FILE__).'/create_table.inc'; - - if ($c) { - $ora_sql = "INSERT INTO - ".$schema.$table_name." (id, value) - VALUES ('1','1') - RETURNING - ROWID - INTO :v_rowid "; - - $statement = OCIParse($c,$ora_sql); - $rowid = OCINewDescriptor($c,OCI_D_ROWID); - OCIBindByName($statement,":v_rowid", $rowid,-1,OCI_B_ROWID); - if (OCIExecute($statement)) { - OCICommit($c); - } - OCIFreeStatement($statement); - $rowid->free(); - } - - require dirname(__FILE__).'/drop_table.inc'; - - echo "Done\n"; -?> ---EXPECT-- -Done diff --git a/ext/oci8/tests/bug27303.phpt b/ext/oci8/tests/bug27303.phpt deleted file mode 100644 index 191cdffe67..0000000000 --- a/ext/oci8/tests/bug27303.phpt +++ /dev/null @@ -1,252 +0,0 @@ ---TEST-- -bug #27303 (OCIBindByName binds numeric PHP values as characters) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$create_st = array(); -$create_st[] = "drop sequence myseq"; -$create_st[] = "drop table mytab"; -$create_st[] = "create sequence myseq"; -$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)"; - -foreach ($create_st as $statement) { - $stmt = oci_parse($c, $statement); - oci_execute($stmt); -} - -define('MYLIMIT', 200); -define('INITMYBV', 11); - -$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv"; - -$stid = OCIParse($c, $stmt); -if (!$stid) { echo "Parse error"; die; } - -//$mybv = INITMYBV; // Uncomment this for the 2nd test only -$r = OCIBindByName($stid, ':MYBV', $mybv /*, 5 */); // Uncomment this for the 3rd test only -if (!$r) { echo "Bind error"; die; } - -for ($i = 1; $i < MYLIMIT; $i++) { - $r = OCIExecute($stid, OCI_DEFAULT); - if (!$r) { echo "Execute error"; die; } - var_dump($mybv); -} - -OCICommit($c); - -$drop_st = array(); -$drop_st[] = "drop sequence myseq"; -$drop_st[] = "drop table mytab"; - -foreach ($create_st as $statement) { - $stmt = oci_parse($c, $statement); - oci_execute($stmt); -} - -echo "Done\n"; -?> ---EXPECTF-- -string(1) "1" -string(1) "2" -string(1) "3" -string(1) "4" -string(1) "5" -string(1) "6" -string(1) "7" -string(1) "8" -string(1) "9" -string(2) "10" -string(2) "11" -string(2) "12" -string(2) "13" -string(2) "14" -string(2) "15" -string(2) "16" -string(2) "17" -string(2) "18" -string(2) "19" -string(2) "20" -string(2) "21" -string(2) "22" -string(2) "23" -string(2) "24" -string(2) "25" -string(2) "26" -string(2) "27" -string(2) "28" -string(2) "29" -string(2) "30" -string(2) "31" -string(2) "32" -string(2) "33" -string(2) "34" -string(2) "35" -string(2) "36" -string(2) "37" -string(2) "38" -string(2) "39" -string(2) "40" -string(2) "41" -string(2) "42" -string(2) "43" -string(2) "44" -string(2) "45" -string(2) "46" -string(2) "47" -string(2) "48" -string(2) "49" -string(2) "50" -string(2) "51" -string(2) "52" -string(2) "53" -string(2) "54" -string(2) "55" -string(2) "56" -string(2) "57" -string(2) "58" -string(2) "59" -string(2) "60" -string(2) "61" -string(2) "62" -string(2) "63" -string(2) "64" -string(2) "65" -string(2) "66" -string(2) "67" -string(2) "68" -string(2) "69" -string(2) "70" -string(2) "71" -string(2) "72" -string(2) "73" -string(2) "74" -string(2) "75" -string(2) "76" -string(2) "77" -string(2) "78" -string(2) "79" -string(2) "80" -string(2) "81" -string(2) "82" -string(2) "83" -string(2) "84" -string(2) "85" -string(2) "86" -string(2) "87" -string(2) "88" -string(2) "89" -string(2) "90" -string(2) "91" -string(2) "92" -string(2) "93" -string(2) "94" -string(2) "95" -string(2) "96" -string(2) "97" -string(2) "98" -string(2) "99" -string(3) "100" -string(3) "101" -string(3) "102" -string(3) "103" -string(3) "104" -string(3) "105" -string(3) "106" -string(3) "107" -string(3) "108" -string(3) "109" -string(3) "110" -string(3) "111" -string(3) "112" -string(3) "113" -string(3) "114" -string(3) "115" -string(3) "116" -string(3) "117" -string(3) "118" -string(3) "119" -string(3) "120" -string(3) "121" -string(3) "122" -string(3) "123" -string(3) "124" -string(3) "125" -string(3) "126" -string(3) "127" -string(3) "128" -string(3) "129" -string(3) "130" -string(3) "131" -string(3) "132" -string(3) "133" -string(3) "134" -string(3) "135" -string(3) "136" -string(3) "137" -string(3) "138" -string(3) "139" -string(3) "140" -string(3) "141" -string(3) "142" -string(3) "143" -string(3) "144" -string(3) "145" -string(3) "146" -string(3) "147" -string(3) "148" -string(3) "149" -string(3) "150" -string(3) "151" -string(3) "152" -string(3) "153" -string(3) "154" -string(3) "155" -string(3) "156" -string(3) "157" -string(3) "158" -string(3) "159" -string(3) "160" -string(3) "161" -string(3) "162" -string(3) "163" -string(3) "164" -string(3) "165" -string(3) "166" -string(3) "167" -string(3) "168" -string(3) "169" -string(3) "170" -string(3) "171" -string(3) "172" -string(3) "173" -string(3) "174" -string(3) "175" -string(3) "176" -string(3) "177" -string(3) "178" -string(3) "179" -string(3) "180" -string(3) "181" -string(3) "182" -string(3) "183" -string(3) "184" -string(3) "185" -string(3) "186" -string(3) "187" -string(3) "188" -string(3) "189" -string(3) "190" -string(3) "191" -string(3) "192" -string(3) "193" -string(3) "194" -string(3) "195" -string(3) "196" -string(3) "197" -string(3) "198" -string(3) "199" -Done diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt deleted file mode 100644 index 67f3552f13..0000000000 --- a/ext/oci8/tests/bug27303_2.phpt +++ /dev/null @@ -1,252 +0,0 @@ ---TEST-- -bug #27303 (OCIBindByName binds numeric PHP values as characters) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$create_st = array(); -$create_st[] = "drop sequence myseq"; -$create_st[] = "drop table mytab"; -$create_st[] = "create sequence myseq"; -$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)"; - -foreach ($create_st as $statement) { - $stmt = oci_parse($c, $statement); - oci_execute($stmt); -} - -define('MYLIMIT', 200); -define('INITMYBV', 11); - -$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv"; - -$stid = OCIParse($c, $stmt); -if (!$stid) { echo "Parse error"; die; } - -$mybv = INITMYBV; // Uncomment this for the 2nd test only -$r = OCIBindByName($stid, ':MYBV', $mybv /*, 5 */); // Uncomment this for the 3rd test only -if (!$r) { echo "Bind error"; die; } - -for ($i = 1; $i < MYLIMIT; $i++) { - $r = OCIExecute($stid, OCI_DEFAULT); - if (!$r) { echo "Execute error"; die; } - var_dump($mybv); -} - -OCICommit($c); - -$drop_st = array(); -$drop_st[] = "drop sequence myseq"; -$drop_st[] = "drop table mytab"; - -foreach ($create_st as $statement) { - $stmt = oci_parse($c, $statement); - oci_execute($stmt); -} - -echo "Done\n"; -?> ---EXPECTF-- -string(1) "1" -string(1) "2" -string(1) "3" -string(1) "4" -string(1) "5" -string(1) "6" -string(1) "7" -string(1) "8" -string(1) "9" -string(2) "10" -string(2) "11" -string(2) "12" -string(2) "13" -string(2) "14" -string(2) "15" -string(2) "16" -string(2) "17" -string(2) "18" -string(2) "19" -string(2) "20" -string(2) "21" -string(2) "22" -string(2) "23" -string(2) "24" -string(2) "25" -string(2) "26" -string(2) "27" -string(2) "28" -string(2) "29" -string(2) "30" -string(2) "31" -string(2) "32" -string(2) "33" -string(2) "34" -string(2) "35" -string(2) "36" -string(2) "37" -string(2) "38" -string(2) "39" -string(2) "40" -string(2) "41" -string(2) "42" -string(2) "43" -string(2) "44" -string(2) "45" -string(2) "46" -string(2) "47" -string(2) "48" -string(2) "49" -string(2) "50" -string(2) "51" -string(2) "52" -string(2) "53" -string(2) "54" -string(2) "55" -string(2) "56" -string(2) "57" -string(2) "58" -string(2) "59" -string(2) "60" -string(2) "61" -string(2) "62" -string(2) "63" -string(2) "64" -string(2) "65" -string(2) "66" -string(2) "67" -string(2) "68" -string(2) "69" -string(2) "70" -string(2) "71" -string(2) "72" -string(2) "73" -string(2) "74" -string(2) "75" -string(2) "76" -string(2) "77" -string(2) "78" -string(2) "79" -string(2) "80" -string(2) "81" -string(2) "82" -string(2) "83" -string(2) "84" -string(2) "85" -string(2) "86" -string(2) "87" -string(2) "88" -string(2) "89" -string(2) "90" -string(2) "91" -string(2) "92" -string(2) "93" -string(2) "94" -string(2) "95" -string(2) "96" -string(2) "97" -string(2) "98" -string(2) "99" -string(3) "100" -string(3) "101" -string(3) "102" -string(3) "103" -string(3) "104" -string(3) "105" -string(3) "106" -string(3) "107" -string(3) "108" -string(3) "109" -string(3) "110" -string(3) "111" -string(3) "112" -string(3) "113" -string(3) "114" -string(3) "115" -string(3) "116" -string(3) "117" -string(3) "118" -string(3) "119" -string(3) "120" -string(3) "121" -string(3) "122" -string(3) "123" -string(3) "124" -string(3) "125" -string(3) "126" -string(3) "127" -string(3) "128" -string(3) "129" -string(3) "130" -string(3) "131" -string(3) "132" -string(3) "133" -string(3) "134" -string(3) "135" -string(3) "136" -string(3) "137" -string(3) "138" -string(3) "139" -string(3) "140" -string(3) "141" -string(3) "142" -string(3) "143" -string(3) "144" -string(3) "145" -string(3) "146" -string(3) "147" -string(3) "148" -string(3) "149" -string(3) "150" -string(3) "151" -string(3) "152" -string(3) "153" -string(3) "154" -string(3) "155" -string(3) "156" -string(3) "157" -string(3) "158" -string(3) "159" -string(3) "160" -string(3) "161" -string(3) "162" -string(3) "163" -string(3) "164" -string(3) "165" -string(3) "166" -string(3) "167" -string(3) "168" -string(3) "169" -string(3) "170" -string(3) "171" -string(3) "172" -string(3) "173" -string(3) "174" -string(3) "175" -string(3) "176" -string(3) "177" -string(3) "178" -string(3) "179" -string(3) "180" -string(3) "181" -string(3) "182" -string(3) "183" -string(3) "184" -string(3) "185" -string(3) "186" -string(3) "187" -string(3) "188" -string(3) "189" -string(3) "190" -string(3) "191" -string(3) "192" -string(3) "193" -string(3) "194" -string(3) "195" -string(3) "196" -string(3) "197" -string(3) "198" -string(3) "199" -Done diff --git a/ext/oci8/tests/bug27303_3.phpt b/ext/oci8/tests/bug27303_3.phpt deleted file mode 100644 index 3a8982d305..0000000000 --- a/ext/oci8/tests/bug27303_3.phpt +++ /dev/null @@ -1,252 +0,0 @@ ---TEST-- -bug #27303 (OCIBindByName binds numeric PHP values as characters) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$create_st = array(); -$create_st[] = "drop sequence myseq"; -$create_st[] = "drop table mytab"; -$create_st[] = "create sequence myseq"; -$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)"; - -foreach ($create_st as $statement) { - $stmt = oci_parse($c, $statement); - oci_execute($stmt); -} - -define('MYLIMIT', 200); -define('INITMYBV', 11); - -$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv"; - -$stid = OCIParse($c, $stmt); -if (!$stid) { echo "Parse error"; die; } - -$mybv = INITMYBV; // Uncomment this for the 2nd test only -$r = OCIBindByName($stid, ':MYBV', $mybv, 5, SQLT_INT); // Uncomment this for the 3rd test only -if (!$r) { echo "Bind error"; die; } - -for ($i = 1; $i < MYLIMIT; $i++) { - $r = OCIExecute($stid, OCI_DEFAULT); - if (!$r) { echo "Execute error"; die; } - var_dump($mybv); -} - -OCICommit($c); - -$drop_st = array(); -$drop_st[] = "drop sequence myseq"; -$drop_st[] = "drop table mytab"; - -foreach ($create_st as $statement) { - $stmt = oci_parse($c, $statement); - oci_execute($stmt); -} - -echo "Done\n"; -?> ---EXPECTF-- -int(1) -int(2) -int(3) -int(4) -int(5) -int(6) -int(7) -int(8) -int(9) -int(10) -int(11) -int(12) -int(13) -int(14) -int(15) -int(16) -int(17) -int(18) -int(19) -int(20) -int(21) -int(22) -int(23) -int(24) -int(25) -int(26) -int(27) -int(28) -int(29) -int(30) -int(31) -int(32) -int(33) -int(34) -int(35) -int(36) -int(37) -int(38) -int(39) -int(40) -int(41) -int(42) -int(43) -int(44) -int(45) -int(46) -int(47) -int(48) -int(49) -int(50) -int(51) -int(52) -int(53) -int(54) -int(55) -int(56) -int(57) -int(58) -int(59) -int(60) -int(61) -int(62) -int(63) -int(64) -int(65) -int(66) -int(67) -int(68) -int(69) -int(70) -int(71) -int(72) -int(73) -int(74) -int(75) -int(76) -int(77) -int(78) -int(79) -int(80) -int(81) -int(82) -int(83) -int(84) -int(85) -int(86) -int(87) -int(88) -int(89) -int(90) -int(91) -int(92) -int(93) -int(94) -int(95) -int(96) -int(97) -int(98) -int(99) -int(100) -int(101) -int(102) -int(103) -int(104) -int(105) -int(106) -int(107) -int(108) -int(109) -int(110) -int(111) -int(112) -int(113) -int(114) -int(115) -int(116) -int(117) -int(118) -int(119) -int(120) -int(121) -int(122) -int(123) -int(124) -int(125) -int(126) -int(127) -int(128) -int(129) -int(130) -int(131) -int(132) -int(133) -int(134) -int(135) -int(136) -int(137) -int(138) -int(139) -int(140) -int(141) -int(142) -int(143) -int(144) -int(145) -int(146) -int(147) -int(148) -int(149) -int(150) -int(151) -int(152) -int(153) -int(154) -int(155) -int(156) -int(157) -int(158) -int(159) -int(160) -int(161) -int(162) -int(163) -int(164) -int(165) -int(166) -int(167) -int(168) -int(169) -int(170) -int(171) -int(172) -int(173) -int(174) -int(175) -int(176) -int(177) -int(178) -int(179) -int(180) -int(181) -int(182) -int(183) -int(184) -int(185) -int(186) -int(187) -int(188) -int(189) -int(190) -int(191) -int(192) -int(193) -int(194) -int(195) -int(196) -int(197) -int(198) -int(199) -Done diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt deleted file mode 100644 index 8ba4ef44b4..0000000000 --- a/ext/oci8/tests/bug27303_4.phpt +++ /dev/null @@ -1,252 +0,0 @@ ---TEST-- -bug #27303 (OCIBindByName binds numeric PHP values as characters) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$create_st = array(); -$create_st[] = "drop sequence myseq"; -$create_st[] = "drop table mytab"; -$create_st[] = "create sequence myseq"; -$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)"; - -foreach ($create_st as $statement) { - $stmt = oci_parse($c, $statement); - oci_execute($stmt); -} - -define('MYLIMIT', 200); -define('INITMYBV', 11); - -$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv"; - -$stid = OCIParse($c, $stmt); -if (!$stid) { echo "Parse error"; die; } - -//$mybv = INITMYBV; // Uncomment this for the 2nd test only -$r = OCIBindByName($stid, ':MYBV', $mybv, 0 ); // Uncomment this for the 3rd test only -if (!$r) { echo "Bind error"; die; } - -for ($i = 1; $i < MYLIMIT; $i++) { - $r = OCIExecute($stid, OCI_DEFAULT); - if (!$r) { echo "Execute error"; die; } - var_dump($mybv); -} - -OCICommit($c); - -$drop_st = array(); -$drop_st[] = "drop sequence myseq"; -$drop_st[] = "drop table mytab"; - -foreach ($create_st as $statement) { - $stmt = oci_parse($c, $statement); - oci_execute($stmt); -} - -echo "Done\n"; -?> ---EXPECTF-- -string(1) "1" -string(1) "2" -string(1) "3" -string(1) "4" -string(1) "5" -string(1) "6" -string(1) "7" -string(1) "8" -string(1) "9" -string(2) "10" -string(2) "11" -string(2) "12" -string(2) "13" -string(2) "14" -string(2) "15" -string(2) "16" -string(2) "17" -string(2) "18" -string(2) "19" -string(2) "20" -string(2) "21" -string(2) "22" -string(2) "23" -string(2) "24" -string(2) "25" -string(2) "26" -string(2) "27" -string(2) "28" -string(2) "29" -string(2) "30" -string(2) "31" -string(2) "32" -string(2) "33" -string(2) "34" -string(2) "35" -string(2) "36" -string(2) "37" -string(2) "38" -string(2) "39" -string(2) "40" -string(2) "41" -string(2) "42" -string(2) "43" -string(2) "44" -string(2) "45" -string(2) "46" -string(2) "47" -string(2) "48" -string(2) "49" -string(2) "50" -string(2) "51" -string(2) "52" -string(2) "53" -string(2) "54" -string(2) "55" -string(2) "56" -string(2) "57" -string(2) "58" -string(2) "59" -string(2) "60" -string(2) "61" -string(2) "62" -string(2) "63" -string(2) "64" -string(2) "65" -string(2) "66" -string(2) "67" -string(2) "68" -string(2) "69" -string(2) "70" -string(2) "71" -string(2) "72" -string(2) "73" -string(2) "74" -string(2) "75" -string(2) "76" -string(2) "77" -string(2) "78" -string(2) "79" -string(2) "80" -string(2) "81" -string(2) "82" -string(2) "83" -string(2) "84" -string(2) "85" -string(2) "86" -string(2) "87" -string(2) "88" -string(2) "89" -string(2) "90" -string(2) "91" -string(2) "92" -string(2) "93" -string(2) "94" -string(2) "95" -string(2) "96" -string(2) "97" -string(2) "98" -string(2) "99" -string(3) "100" -string(3) "101" -string(3) "102" -string(3) "103" -string(3) "104" -string(3) "105" -string(3) "106" -string(3) "107" -string(3) "108" -string(3) "109" -string(3) "110" -string(3) "111" -string(3) "112" -string(3) "113" -string(3) "114" -string(3) "115" -string(3) "116" -string(3) "117" -string(3) "118" -string(3) "119" -string(3) "120" -string(3) "121" -string(3) "122" -string(3) "123" -string(3) "124" -string(3) "125" -string(3) "126" -string(3) "127" -string(3) "128" -string(3) "129" -string(3) "130" -string(3) "131" -string(3) "132" -string(3) "133" -string(3) "134" -string(3) "135" -string(3) "136" -string(3) "137" -string(3) "138" -string(3) "139" -string(3) "140" -string(3) "141" -string(3) "142" -string(3) "143" -string(3) "144" -string(3) "145" -string(3) "146" -string(3) "147" -string(3) "148" -string(3) "149" -string(3) "150" -string(3) "151" -string(3) "152" -string(3) "153" -string(3) "154" -string(3) "155" -string(3) "156" -string(3) "157" -string(3) "158" -string(3) "159" -string(3) "160" -string(3) "161" -string(3) "162" -string(3) "163" -string(3) "164" -string(3) "165" -string(3) "166" -string(3) "167" -string(3) "168" -string(3) "169" -string(3) "170" -string(3) "171" -string(3) "172" -string(3) "173" -string(3) "174" -string(3) "175" -string(3) "176" -string(3) "177" -string(3) "178" -string(3) "179" -string(3) "180" -string(3) "181" -string(3) "182" -string(3) "183" -string(3) "184" -string(3) "185" -string(3) "186" -string(3) "187" -string(3) "188" -string(3) "189" -string(3) "190" -string(3) "191" -string(3) "192" -string(3) "193" -string(3) "194" -string(3) "195" -string(3) "196" -string(3) "197" -string(3) "198" -string(3) "199" -Done diff --git a/ext/oci8/tests/bug32325.phpt b/ext/oci8/tests/bug32325.phpt deleted file mode 100644 index 6bfcd404eb..0000000000 --- a/ext/oci8/tests/bug32325.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -bug #32325 (Can't retrieve collection using OCI8) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$create_stmt = oci_parse($c, "create or replace type ut_num_list_t as table of number"); -oci_execute($create_stmt); - -$collection = oci_new_collection($c, "UT_NUM_LIST_T"); - -$sql = " - begin - select ut_num_list_t(1,2,3,4) into :list from dual; - end;"; - -$stmt = oci_parse($c, $sql); - -oci_bind_by_name($stmt, ":list", $collection, -1, OCI_B_NTY); -oci_execute($stmt); - -var_dump($collection->size()); -var_dump($collection->getelem(1)); -var_dump($collection->getelem(2)); - -$drop_stmt = oci_parse($c, "drop type ut_num_list_t"); -oci_execute($drop_stmt); - -echo "Done\n"; -?> ---EXPECTF-- -int(4) -float(2) -float(3) -Done diff --git a/ext/oci8/tests/bug35973.phpt b/ext/oci8/tests/bug35973.phpt deleted file mode 100644 index b62f5cfd0f..0000000000 --- a/ext/oci8/tests/bug35973.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field) ---SKIPIF-- -<?php if (!extension_loaded("oci8")) print "skip"; ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$s1 = oci_parse($c, "drop table test_nclob"); -@oci_execute($s1); - -$s2 = oci_parse($c, "create table test_nclob (nc NCLOB)"); -oci_execute($s2); - -$s3 = oci_parse($c, "insert into test_nclob (nc) values ('12345data')"); -oci_execute($s3); - -$s3 = oci_parse($c, "select * from test_nclob"); -oci_execute($s3); - -var_dump($data = oci_fetch_assoc($s3)); -$d = $data['NC']; - -var_dump($d->read(5)); -var_dump($d->read(4)); - -$s1 = oci_parse($c, "drop table test_nclob"); -@oci_execute($s1); - -echo "Done\n"; -?> ---EXPECTF-- -array(1) { - ["NC"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } -} -string(%d) "%s5" -string(%d) "%sa" -Done diff --git a/ext/oci8/tests/bug36010.phpt b/ext/oci8/tests/bug36010.phpt deleted file mode 100644 index ef435496a8..0000000000 --- a/ext/oci8/tests/bug36010.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -bug #36010 (Crash when executing SQL statment with lob parameter twice) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -function f($conn) -{ - $sql = "begin :p_clob := 'lob string'; end;"; - $stid = oci_parse($conn, $sql); - $clob = oci_new_descriptor($conn, OCI_D_LOB); - oci_bind_by_name($stid, ":p_clob", $clob, -1, OCI_B_CLOB); - $r = oci_execute($stid, OCI_DEFAULT); -} - -f($c); -f($c); - -echo "Done\n"; - -?> ---EXPECT-- -Done diff --git a/ext/oci8/tests/bug36096.phpt b/ext/oci8/tests/bug36096.phpt deleted file mode 100644 index 44b3a6ddca..0000000000 --- a/ext/oci8/tests/bug36096.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #36096 (oci_result() returns garbage after oci_fetch() failed) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$sql = "SELECT 'ABC' FROM DUAL WHERE 1<>1"; -$stmt = oci_parse($c, $sql); - -if(oci_execute($stmt, OCI_COMMIT_ON_SUCCESS)){ - var_dump(oci_fetch($stmt)); - var_dump(oci_result($stmt, 1)); - var_dump(oci_field_name($stmt, 1)); - var_dump(oci_field_type($stmt, 1)); -} - -echo "Done\n"; - -?> ---EXPECT-- -bool(false) -bool(false) -string(5) "'ABC'" -string(4) "CHAR" -Done diff --git a/ext/oci8/tests/bug37581.phpt b/ext/oci8/tests/bug37581.phpt deleted file mode 100644 index ec86c51959..0000000000 --- a/ext/oci8/tests/bug37581.phpt +++ /dev/null @@ -1,69 +0,0 @@ ---TEST-- -Bug #37581 (oci_bind_array_by_name clobbers input array when using SQLT_AFC, AVC) ---SKIPIF-- -<?php if (!extension_loaded("oci8")) print "skip"; ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$p1 = "create or replace package ARRAYBINDPKG1 as -type str_array is table of char(2) index by binary_integer; -procedure array_bind(in_str in str_array, out_str out string); -end ARRAYBINDPKG1;"; - -$p2 = "create or replace package body ARRAYBINDPKG1 as - procedure array_bind(in_str in str_array, out_str out string) is - begin - for i in 1 .. in_str.count loop - out_str := in_str(i); - end loop; - end array_bind; -end ARRAYBINDPKG1;"; - -$s1 = oci_parse($c, $p1); -$s2 = oci_parse($c, $p2); -oci_execute($s1); -oci_execute($s2); - - -$stmt = oci_parse($c,'begin ARRAYBINDPKG1.array_bind(:in_arr, :out_str); end;'); -$strings = array('A','B','C','D','E'); - -oci_bind_array_by_name($stmt,':in_arr',$strings,5,1,SQLT_AFC); -oci_bind_by_name($stmt,':out_str',$result,10); - -oci_execute($stmt); -var_dump($strings); - -oci_execute($stmt); -var_dump($strings); - -echo "Done\n"; -?> ---EXPECTF-- -array(5) { - [0]=> - string(1) "A" - [1]=> - string(1) "B" - [2]=> - string(1) "C" - [3]=> - string(1) "D" - [4]=> - string(1) "E" -} -array(5) { - [0]=> - string(1) "A" - [1]=> - string(1) "B" - [2]=> - string(1) "C" - [3]=> - string(1) "D" - [4]=> - string(1) "E" -} -Done diff --git a/ext/oci8/tests/bug38161.phpt b/ext/oci8/tests/bug38161.phpt deleted file mode 100644 index 27cfafdc8f..0000000000 --- a/ext/oci8/tests/bug38161.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable) ---SKIPIF-- -<?php if (!extension_loaded("oci8")) print "skip"; ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$query = "begin if false then :bv := 1; end if; end;"; -$stid = oci_parse($c, $query); -oci_bind_by_name($stid, ":bv", $bv, 22); -oci_execute($stid, OCI_DEFAULT); - -var_dump($bv); -unset($bv); - -$query = "begin if false then :bv := 1; end if; end;"; -$stid = oci_parse($c, $query); -oci_bind_by_name($stid, ":bv", $bv, 22, SQLT_INT); -oci_execute($stid, OCI_DEFAULT); - -var_dump($bv); - -echo "Done\n"; -?> ---EXPECTF-- -NULL -int(0) -Done diff --git a/ext/oci8/tests/bug38173.phpt b/ext/oci8/tests/bug38173.phpt deleted file mode 100644 index b92df9e39e..0000000000 --- a/ext/oci8/tests/bug38173.phpt +++ /dev/null @@ -1,79 +0,0 @@ ---TEST-- -Bug #38173 (Freeing nested cursors causes OCI8 to segfault) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$create_1 = "CREATE TABLE t1 (id INTEGER)"; -$create_2 = "CREATE TABLE t2 (id INTEGER)"; -$drop_1 = "DROP TABLE t1"; -$drop_2 = "DROP TABLE t2"; - -$s1 = oci_parse($c, $drop_1); -$s2 = oci_parse($c, $drop_2); -@oci_execute($s1); -@oci_execute($s2); - -$s1 = oci_parse($c, $create_1); -$s2 = oci_parse($c, $create_2); -oci_execute($s1); -oci_execute($s2); - -for($i=0; $i < 5; $i++) { - $insert = "INSERT INTO t1 VALUES(".$i.")"; - $s = oci_parse($c, $insert); - oci_execute($s); -} - -for($i=0; $i < 5; $i++) { - $insert = "INSERT INTO t2 VALUES(".$i.")"; - $s = oci_parse($c, $insert); - oci_execute($s); -} - -$query =" -SELECT - t1.*, - CURSOR( SELECT * FROM t2 ) as cursor -FROM - t1 -"; - -$sth = oci_parse($c, $query); -oci_execute($sth); - -// dies on oci_free_statement on 2nd pass through loop -while ( $row = oci_fetch_assoc($sth) ) { - print "Got row!\n"; - var_dump(oci_execute($row['CURSOR'])); - var_dump(oci_free_statement($row['CURSOR'])); -} - -$s1 = oci_parse($c, $drop_1); -$s2 = oci_parse($c, $drop_2); -@oci_execute($s1); -@oci_execute($s2); - -echo "Done\n"; - -?> ---EXPECT-- -Got row! -bool(true) -bool(true) -Got row! -bool(true) -bool(true) -Got row! -bool(true) -bool(true) -Got row! -bool(true) -bool(true) -Got row! -bool(true) -bool(true) -Done diff --git a/ext/oci8/tests/close.phpt b/ext/oci8/tests/close.phpt deleted file mode 100644 index 55bb4ea364..0000000000 --- a/ext/oci8/tests/close.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -connect/close/connect ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -oci_close($c); - -oci_connect($user, $password, $dbase); - -echo "Done\n"; -?> ---EXPECTF-- -Done diff --git a/ext/oci8/tests/coll_001.phpt b/ext/oci8/tests/coll_001.phpt deleted file mode 100644 index 57d3cf1b47..0000000000 --- a/ext/oci8/tests/coll_001.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -oci_new_collection() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_type.inc"; - -var_dump(oci_new_collection($c, $type_name)); -var_dump(oci_new_collection($c, "NONEXISTENT")); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECTF-- -object(OCI-Collection)#%d (1) { - ["collection"]=> - resource(%d) of type (oci8 collection) -} - -Warning: oci_new_collection(): OCI-22303: type ""."NONEXISTENT" not found in %s on line %d -bool(false) -Done diff --git a/ext/oci8/tests/coll_002.phpt b/ext/oci8/tests/coll_002.phpt deleted file mode 100644 index 6d30519897..0000000000 --- a/ext/oci8/tests/coll_002.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -oci_new_collection() + free() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_type.inc"; - -var_dump($coll1 = oci_new_collection($c, $type_name)); - -var_dump($coll1->free()); -var_dump($coll1->size()); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECTF-- -object(OCI-Collection)#%d (1) { - ["collection"]=> - resource(%d) of type (oci8 collection) -} -bool(true) - -Warning: OCI-Collection::size(): %d is not a valid oci8 collection resource in %s on line %d -bool(false) -Done diff --git a/ext/oci8/tests/coll_002_func.phpt b/ext/oci8/tests/coll_002_func.phpt deleted file mode 100644 index 58e641ee24..0000000000 --- a/ext/oci8/tests/coll_002_func.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -oci_new_collection() + free() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_type.inc"; - -var_dump($coll1 = oci_new_collection($c, $type_name)); - -var_dump(oci_free_collection($coll1)); -var_dump(oci_collection_size($coll1)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECTF-- -object(OCI-Collection)#%d (1) { - ["collection"]=> - resource(%d) of type (oci8 collection) -} -bool(true) - -Warning: oci_collection_size(): %d is not a valid oci8 collection resource in %s on line %d -bool(false) -Done diff --git a/ext/oci8/tests/coll_003.phpt b/ext/oci8/tests/coll_003.phpt deleted file mode 100644 index b5236ef6f6..0000000000 --- a/ext/oci8/tests/coll_003.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -collection methods ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_type.inc"; - -$coll1 = oci_new_collection($c, $type_name); - -var_dump($coll1->size()); -var_dump($coll1->max()); -var_dump($coll1->trim(3)); -var_dump($coll1->append(1)); -var_dump($coll1->getElem(0)); -var_dump($coll1->assignElem(0,2)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECTF-- -int(0) -int(0) - -Warning: OCI-Collection::trim(): OCI-22167: given trim size [3] must be less than or equal to [0] in %s on line %d -bool(false) -bool(true) -float(1) -bool(true) -Done diff --git a/ext/oci8/tests/coll_003_func.phpt b/ext/oci8/tests/coll_003_func.phpt deleted file mode 100644 index f5c6dc7f38..0000000000 --- a/ext/oci8/tests/coll_003_func.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -collection methods ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_type.inc"; - -$coll1 = oci_new_collection($c, $type_name); - -var_dump(oci_collection_size($coll1)); -var_dump(oci_collection_max($coll1)); -var_dump(oci_collection_trim($coll1, 3)); -var_dump(oci_collection_append($coll1, 1)); -var_dump(oci_collection_element_get($coll1, 0)); -var_dump(oci_collection_element_assign($coll1, 0, 2)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECTF-- -int(0) -int(0) - -Warning: oci_collection_trim(): OCI-22167: given trim size [3] must be less than or equal to [0] in %s on line %d -bool(false) -bool(true) -float(1) -bool(true) -Done diff --git a/ext/oci8/tests/coll_004.phpt b/ext/oci8/tests/coll_004.phpt deleted file mode 100644 index eb2ac7e26d..0000000000 --- a/ext/oci8/tests/coll_004.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -oci_collection_assign() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_type.inc"; - -$coll1 = oci_new_collection($c, $type_name); -$coll2 = oci_new_collection($c, $type_name); - -var_dump($coll1->append(1)); - -var_dump($coll2->assign($coll1)); - -var_dump($coll2->getElem(0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -float(1) -Done diff --git a/ext/oci8/tests/coll_004_func.phpt b/ext/oci8/tests/coll_004_func.phpt deleted file mode 100644 index 57dff2eb35..0000000000 --- a/ext/oci8/tests/coll_004_func.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -oci_collection_assign() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_type.inc"; - -$coll1 = oci_new_collection($c, $type_name); -$coll2 = oci_new_collection($c, $type_name); - -var_dump(oci_collection_append($coll1, 1)); - -var_dump(oci_collection_assign($coll2, $coll1)); - -var_dump(oci_collection_element_get($coll2, 0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -float(1) -Done diff --git a/ext/oci8/tests/coll_005.phpt b/ext/oci8/tests/coll_005.phpt deleted file mode 100644 index 0f40069964..0000000000 --- a/ext/oci8/tests/coll_005.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -ocinewcollection() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_type.inc"; - -var_dump(ocinewcollection($c, $type_name)); -var_dump(ocinewcollection($c, "NONEXISTENT")); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECTF-- -object(OCI-Collection)#%d (1) { - ["collection"]=> - resource(%d) of type (oci8 collection) -} - -Warning: ocinewcollection(): OCI-22303: type ""."NONEXISTENT" not found in %s on line %d -bool(false) -Done diff --git a/ext/oci8/tests/coll_006.phpt b/ext/oci8/tests/coll_006.phpt deleted file mode 100644 index cf258cbe34..0000000000 --- a/ext/oci8/tests/coll_006.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -ocinewcollection() + free() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_type.inc"; - -var_dump($coll1 = ocinewcollection($c, $type_name)); - -var_dump($coll1->free()); -var_dump($coll1->size()); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECTF-- -object(OCI-Collection)#%d (1) { - ["collection"]=> - resource(%d) of type (oci8 collection) -} -bool(true) - -Warning: OCI-Collection::size(): %d is not a valid oci8 collection resource in %s on line %d -bool(false) -Done diff --git a/ext/oci8/tests/coll_006_func.phpt b/ext/oci8/tests/coll_006_func.phpt deleted file mode 100644 index 56707d6087..0000000000 --- a/ext/oci8/tests/coll_006_func.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -ocinewcollection() + free() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_type.inc"; - -var_dump($coll1 = ocinewcollection($c, $type_name)); - -var_dump(oci_free_collection($coll1)); -var_dump(oci_collection_size($coll1)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECTF-- -object(OCI-Collection)#%d (1) { - ["collection"]=> - resource(%d) of type (oci8 collection) -} -bool(true) - -Warning: oci_collection_size(): %d is not a valid oci8 collection resource in %s on line %d -bool(false) -Done diff --git a/ext/oci8/tests/coll_007.phpt b/ext/oci8/tests/coll_007.phpt deleted file mode 100644 index 31e10c065e..0000000000 --- a/ext/oci8/tests/coll_007.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -collection methods ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_type.inc"; - -$coll1 = ocinewcollection($c, $type_name); - -var_dump($coll1->size()); -var_dump($coll1->max()); -var_dump($coll1->trim(3)); -var_dump($coll1->append(1)); -var_dump($coll1->getElem(0)); -var_dump($coll1->assignElem(0,2)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECTF-- -int(0) -int(0) - -Warning: OCI-Collection::trim(): OCI-22167: given trim size [3] must be less than or equal to [0] in %s on line %d -bool(false) -bool(true) -float(1) -bool(true) -Done diff --git a/ext/oci8/tests/coll_008.phpt b/ext/oci8/tests/coll_008.phpt deleted file mode 100644 index 57d44cc9ab..0000000000 --- a/ext/oci8/tests/coll_008.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -ocicollassign() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_type.inc"; - -$coll1 = ocinewcollection($c, $type_name); -$coll2 = ocinewcollection($c, $type_name); - -var_dump($coll1->append(1)); - -var_dump($coll2->assign($coll1)); - -var_dump($coll2->getElem(0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -float(1) -Done diff --git a/ext/oci8/tests/coll_009.phpt b/ext/oci8/tests/coll_009.phpt deleted file mode 100644 index 296d6493e2..0000000000 --- a/ext/oci8/tests/coll_009.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -collections and wrong dates ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); -$coll2 = ocinewcollection($c, $type_name); - -var_dump($coll1->append("2005-07-28")); - -var_dump($coll2->assign($coll1)); - -var_dump($coll2->getElem(0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECTF-- -Warning: OCI-Collection::append(): OCI-01861: literal does not match format string in %s on line %d -bool(false) -bool(true) -bool(false) -Done diff --git a/ext/oci8/tests/coll_009_func.phpt b/ext/oci8/tests/coll_009_func.phpt deleted file mode 100644 index 3ed416ce09..0000000000 --- a/ext/oci8/tests/coll_009_func.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -collections and wrong dates ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); -$coll2 = ocinewcollection($c, $type_name); - -var_dump(oci_collection_append($coll1, "2005-07-28")); - -var_dump(oci_collection_assign($coll2, $coll1)); - -var_dump(oci_collection_element_get($coll2, 0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECTF-- -Warning: oci_collection_append(): OCI-01861: literal does not match format string in %s on line %d -bool(false) -bool(true) -bool(false) -Done diff --git a/ext/oci8/tests/coll_010.phpt b/ext/oci8/tests/coll_010.phpt deleted file mode 100644 index 6f72dd16c1..0000000000 --- a/ext/oci8/tests/coll_010.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -collections and nulls ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); -$coll2 = ocinewcollection($c, $type_name); - -var_dump($coll1->append(null)); - -var_dump($coll2->assign($coll1)); - -var_dump($coll2->getElem(0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -NULL -Done diff --git a/ext/oci8/tests/coll_010_func.phpt b/ext/oci8/tests/coll_010_func.phpt deleted file mode 100644 index 7b63a276f3..0000000000 --- a/ext/oci8/tests/coll_010_func.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -collections and nulls ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); -$coll2 = ocinewcollection($c, $type_name); - -var_dump(oci_collection_append($coll1, null)); - -var_dump(oci_collection_assign($coll2, $coll1)); - -var_dump(oci_collection_element_get($coll2, 0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -NULL -Done diff --git a/ext/oci8/tests/coll_011.phpt b/ext/oci8/tests/coll_011.phpt deleted file mode 100644 index 7d805d3f70..0000000000 --- a/ext/oci8/tests/coll_011.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -collections and strings ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); -$coll2 = ocinewcollection($c, $type_name); - -var_dump($coll1->append("string")); -var_dump($coll1->append("string")); - -var_dump($coll2->assign($coll1)); - -var_dump($coll2->getElem(0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -bool(true) -string(6) "string" -Done diff --git a/ext/oci8/tests/coll_011_func.phpt b/ext/oci8/tests/coll_011_func.phpt deleted file mode 100644 index dca640e846..0000000000 --- a/ext/oci8/tests/coll_011_func.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -collections and strings ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); -$coll2 = ocinewcollection($c, $type_name); - -var_dump(oci_collection_append($coll1, "string")); -var_dump(oci_collection_append($coll1, "string")); - -var_dump(oci_collection_assign($coll2, $coll1)); - -var_dump(oci_collection_element_get($coll2, 0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -bool(true) -string(6) "string" -Done diff --git a/ext/oci8/tests/coll_012.phpt b/ext/oci8/tests/coll_012.phpt deleted file mode 100644 index 543dafd902..0000000000 --- a/ext/oci8/tests/coll_012.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -collections and correct dates ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); -$coll2 = ocinewcollection($c, $type_name); - -var_dump($coll1->append("28-JUL-05")); - -var_dump($coll2->assign($coll1)); - -var_dump($coll2->getElem(0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -string(9) "28-JUL-05" -Done diff --git a/ext/oci8/tests/coll_012_func.phpt b/ext/oci8/tests/coll_012_func.phpt deleted file mode 100644 index fd1019e411..0000000000 --- a/ext/oci8/tests/coll_012_func.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -collections and correct dates ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); -$coll2 = ocinewcollection($c, $type_name); - -var_dump(oci_collection_append($coll1, "28-JUL-05")); - -var_dump(oci_collection_assign($coll2, $coll1)); - -var_dump(oci_collection_element_get($coll2, 0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -string(9) "28-JUL-05" -Done diff --git a/ext/oci8/tests/coll_013.phpt b/ext/oci8/tests/coll_013.phpt deleted file mode 100644 index 00d88bb9a4..0000000000 --- a/ext/oci8/tests/coll_013.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -collections and correct dates (2) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); - -var_dump($coll1->append("28-JUL-05")); -var_dump($coll1->assignElem(0,"01-JAN-05")); -var_dump($coll1->getElem(0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -string(9) "01-JAN-05" -Done diff --git a/ext/oci8/tests/coll_013_func.phpt b/ext/oci8/tests/coll_013_func.phpt deleted file mode 100644 index 0d01bc1744..0000000000 --- a/ext/oci8/tests/coll_013_func.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -collections and correct dates (2) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); - -var_dump(oci_collection_append($coll1, "28-JUL-05")); -var_dump(oci_collection_element_assign($coll1, 0, "01-JAN-05")); -var_dump(oci_collection_element_get($coll1, 0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -string(9) "01-JAN-05" -Done diff --git a/ext/oci8/tests/coll_014.phpt b/ext/oci8/tests/coll_014.phpt deleted file mode 100644 index 8458525ae5..0000000000 --- a/ext/oci8/tests/coll_014.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -collections and strings (2) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); - -var_dump($coll1->append("striing")); -var_dump($coll1->assignElem(0,"blah")); -var_dump($coll1->getElem(0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -string(4) "blah" -Done diff --git a/ext/oci8/tests/coll_014_func.phpt b/ext/oci8/tests/coll_014_func.phpt deleted file mode 100644 index a0fe555b61..0000000000 --- a/ext/oci8/tests/coll_014_func.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -collections and strings (2) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); - -var_dump(oci_collection_append($coll1, "striing")); -var_dump(oci_collection_element_assign($coll1, 0,"blah")); -var_dump(oci_collection_element_get($coll1, 0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -string(4) "blah" -Done diff --git a/ext/oci8/tests/coll_015.phpt b/ext/oci8/tests/coll_015.phpt deleted file mode 100644 index 64b0aea106..0000000000 --- a/ext/oci8/tests/coll_015.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -collections and numbers (2) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); - -var_dump($coll1->append(1)); -var_dump($coll1->assignElem(0,2345)); -var_dump($coll1->getElem(0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -float(2345) -Done diff --git a/ext/oci8/tests/coll_015_func.phpt b/ext/oci8/tests/coll_015_func.phpt deleted file mode 100644 index eeed7839a7..0000000000 --- a/ext/oci8/tests/coll_015_func.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -collections and numbers (2) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); - -var_dump(oci_collection_append($coll1, 1)); -var_dump(oci_collection_element_assign($coll1,0,2345)); -var_dump(oci_collection_element_get($coll1, 0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -float(2345) -Done diff --git a/ext/oci8/tests/coll_016.phpt b/ext/oci8/tests/coll_016.phpt deleted file mode 100644 index c2af9cc22d..0000000000 --- a/ext/oci8/tests/coll_016.phpt +++ /dev/null @@ -1,48 +0,0 @@ ---TEST-- -collections and negative/too big element indexes ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); - -var_dump($coll1->append(1)); -var_dump($coll1->assignElem(-1,2345)); -var_dump($coll1->assignElem(5000,2345)); -var_dump($coll1->getElem(-1)); -var_dump($coll1->getElem(-100)); -var_dump($coll1->getElem(500)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECTF-- -bool(true) - -Warning: OCI-Collection::assignelem(): OCI-22165: given index [%d] must be in the range of %s to [0] in %s on line %d -bool(false) - -Warning: OCI-Collection::assignelem(): OCI-22165: given index [5000] must be in the range of %s to [0] in %s on line %d -bool(false) -bool(false) -bool(false) -bool(false) -Done diff --git a/ext/oci8/tests/coll_016_func.phpt b/ext/oci8/tests/coll_016_func.phpt deleted file mode 100644 index cde26f22f0..0000000000 --- a/ext/oci8/tests/coll_016_func.phpt +++ /dev/null @@ -1,48 +0,0 @@ ---TEST-- -collections and negative/too big element indexes ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); - -var_dump(oci_collection_append($coll1, 1)); -var_dump(oci_collection_element_assign($coll1,-1,2345)); -var_dump(oci_collection_element_assign($coll1,5000,2345)); -var_dump(oci_collection_element_get($coll1, -1)); -var_dump(oci_collection_element_get($coll1, -100)); -var_dump(oci_collection_element_get($coll1, 500)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECTF-- -bool(true) - -Warning: oci_collection_element_assign(): OCI-22165: given index [%d] must be in the range of%s0%sto [0] in %s on line %d -bool(false) - -Warning: oci_collection_element_assign(): OCI-22165: given index [5000] must be in the range of%s0%sto [0] in %s on line %d -bool(false) -bool(false) -bool(false) -bool(false) -Done diff --git a/ext/oci8/tests/coll_017.phpt b/ext/oci8/tests/coll_017.phpt deleted file mode 100644 index 42347ba6f8..0000000000 --- a/ext/oci8/tests/coll_017.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -collections and nulls (2) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); - -var_dump($coll1->append("string")); -var_dump($coll1->assignElem(0, null)); -var_dump($coll1->getElem(0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -NULL -Done diff --git a/ext/oci8/tests/coll_017_func.phpt b/ext/oci8/tests/coll_017_func.phpt deleted file mode 100644 index 914844ae61..0000000000 --- a/ext/oci8/tests/coll_017_func.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -collections and nulls (2) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$ora_sql = "DROP TYPE - ".$type_name." - "; - -$statement = OCIParse($c,$ora_sql); -@OCIExecute($statement); - -$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)"; - -$statement = OCIParse($c,$ora_sql); -OCIExecute($statement); - - -$coll1 = ocinewcollection($c, $type_name); - -var_dump(oci_collection_append($coll1, "string")); -var_dump(oci_collection_element_assign($coll1, 0, null)); -var_dump(oci_collection_element_get($coll1, 0)); - -echo "Done\n"; - -require dirname(__FILE__)."/drop_type.inc"; - -?> ---EXPECT-- -bool(true) -bool(true) -NULL -Done diff --git a/ext/oci8/tests/commit.phpt b/ext/oci8/tests/commit.phpt deleted file mode 100644 index 3bef318c85..0000000000 --- a/ext/oci8/tests/commit.phpt +++ /dev/null @@ -1,148 +0,0 @@ ---TEST-- -oci_commit()/oci_rollback() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s, OCI_DEFAULT)) { - die("oci_execute(insert) failed!\n"); - } -} - -var_dump(oci_rollback($c)); - -$select_sql = "SELECT * FROM ".$schema.$table_name.""; - -if (!($select = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -/* oci_fetch_all */ -if (!oci_execute($select)) { - die("oci_execute(select) failed!\n"); -} -var_dump(oci_fetch_all($select, $all)); -var_dump($all); - -/* ocifetchstatement */ -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s, OCI_DEFAULT)) { - die("oci_execute(insert) failed!\n"); - } -} - -var_dump(oci_commit($c)); - -/* oci_fetch_all */ -if (!oci_execute($select)) { - die("oci_execute(select) failed!\n"); -} -var_dump(oci_fetch_all($select, $all)); -var_dump($all); - - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECT-- -bool(true) -int(0) -array(5) { - ["ID"]=> - array(0) { - } - ["VALUE"]=> - array(0) { - } - ["BLOB"]=> - array(0) { - } - ["CLOB"]=> - array(0) { - } - ["STRING"]=> - array(0) { - } -} -bool(true) -int(4) -array(5) { - ["ID"]=> - array(4) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - string(1) "1" - [3]=> - string(1) "1" - } - ["VALUE"]=> - array(4) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - string(1) "1" - [3]=> - string(1) "1" - } - ["BLOB"]=> - array(4) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - [3]=> - NULL - } - ["CLOB"]=> - array(4) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - [3]=> - NULL - } - ["STRING"]=> - array(4) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - [3]=> - NULL - } -} -Done diff --git a/ext/oci8/tests/commit_old.phpt b/ext/oci8/tests/commit_old.phpt deleted file mode 100644 index 196e0650cc..0000000000 --- a/ext/oci8/tests/commit_old.phpt +++ /dev/null @@ -1,146 +0,0 @@ ---TEST-- -ocicommit()/ocirollback() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = ociparse($c, $insert_sql))) { - die("ociparse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!ociexecute($s, OCI_DEFAULT)) { - die("ociexecute(insert) failed!\n"); - } -} - -var_dump(ocirollback($c)); - -$select_sql = "SELECT * FROM ".$schema.$table_name.""; - -if (!($select = ociparse($c, $select_sql))) { - die("ociparse(select) failed!\n"); -} - -if (!oci_execute($select)) { - die("ociexecute(select) failed!\n"); -} -var_dump(ocifetchstatement($select, $all)); -var_dump($all); - -/* ocifetchstatement */ -if (!ociexecute($s)) { - die("ociexecute(select) failed!\n"); -} - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = ociparse($c, $insert_sql))) { - die("ociparse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!ociexecute($s, OCI_DEFAULT)) { - die("ociexecute(insert) failed!\n"); - } -} - -var_dump(ocicommit($c)); - -if (!ociexecute($select)) { - die("ociexecute(select) failed!\n"); -} -var_dump(ocifetchstatement($select, $all)); -var_dump($all); - - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECT-- -bool(true) -int(0) -array(5) { - ["ID"]=> - array(0) { - } - ["VALUE"]=> - array(0) { - } - ["BLOB"]=> - array(0) { - } - ["CLOB"]=> - array(0) { - } - ["STRING"]=> - array(0) { - } -} -bool(true) -int(4) -array(5) { - ["ID"]=> - array(4) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - string(1) "1" - [3]=> - string(1) "1" - } - ["VALUE"]=> - array(4) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - string(1) "1" - [3]=> - string(1) "1" - } - ["BLOB"]=> - array(4) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - [3]=> - NULL - } - ["CLOB"]=> - array(4) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - [3]=> - NULL - } - ["STRING"]=> - array(4) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - [3]=> - NULL - } -} -Done diff --git a/ext/oci8/tests/connect.inc b/ext/oci8/tests/connect.inc deleted file mode 100644 index 887c8fdaa1..0000000000 --- a/ext/oci8/tests/connect.inc +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -/* - * Please, change user, password and dbase to match your configuration. - * - * */ - -$user = "system"; -$password = "system"; -$dbase = "oracle"; - -/* - * You should have privileges to create tables in this schema - * - * */ -/* -$schema = "system"; -*/ - -$table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5); -$type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5)); - - if (!empty($dbase)) { - $c = ocilogon($user,$password,$dbase); - } - else { - $c = ocilogon($user,$password); - } - - if (!empty($schema)) { - $schema = $schema."."; - } - else { - $schema = ''; - } - -?> diff --git a/ext/oci8/tests/connect.phpt b/ext/oci8/tests/connect.phpt deleted file mode 100644 index 6ce4c533ba..0000000000 --- a/ext/oci8/tests/connect.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -oci_connect() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -if (!empty($dbase)) { - var_dump(oci_connect($user, $password, $dbase)); -} -else { - var_dump(oci_connect($user, $password)); -} - -echo "Done\n"; - -?> ---EXPECTF-- -resource(%d) of type (oci8 connection) -Done diff --git a/ext/oci8/tests/connect_1.phpt b/ext/oci8/tests/connect_1.phpt deleted file mode 100644 index 647a92ceeb..0000000000 --- a/ext/oci8/tests/connect_1.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -oci_pconnect() & oci_new_connect() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -if (!empty($dbase)) { - var_dump($c1 = oci_pconnect($user, $password, $dbase)); -} -else { - var_dump($c1 = oci_pconnect($user, $password)); -} - -if (!empty($dbase)) { - var_dump($c2 = oci_new_connect($user, $password, $dbase)); -} -else { - var_dump($c2 = oci_new_connect($user, $password)); -} - -var_dump(oci_close($c1)); -var_dump(ocilogoff($c2)); - -echo "Done\n"; - -?> ---EXPECTF-- -resource(%d) of type (oci8 persistent connection) -resource(%d) of type (oci8 connection) -bool(true) -bool(true) -Done diff --git a/ext/oci8/tests/connect_1_old.phpt b/ext/oci8/tests/connect_1_old.phpt deleted file mode 100644 index 8210b82d6c..0000000000 --- a/ext/oci8/tests/connect_1_old.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -ociplogon() & ocinlogon() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -if (!empty($dbase)) { - var_dump($c1 = ociplogon($user, $password, $dbase)); -} -else { - var_dump($c1 = ociplogon($user, $password)); -} - -if (!empty($dbase)) { - var_dump($c2 = ocinlogon($user, $password, $dbase)); -} -else { - var_dump($c2 = ocinlogon($user, $password)); -} - -var_dump(ocilogoff($c1)); -var_dump(ocilogoff($c2)); - -echo "Done\n"; - -?> ---EXPECTF-- -resource(%d) of type (oci8 persistent connection) -resource(%d) of type (oci8 connection) -bool(true) -bool(true) -Done diff --git a/ext/oci8/tests/connect_old.phpt b/ext/oci8/tests/connect_old.phpt deleted file mode 100644 index 55f1734a5a..0000000000 --- a/ext/oci8/tests/connect_old.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -ocilogon() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -if (!empty($dbase)) { - var_dump(ocilogon($user, $password, $dbase)); -} -else { - var_dump(ocilogon($user, $password)); -} - -echo "Done\n"; - -?> ---EXPECTF-- -resource(%d) of type (oci8 connection) -Done diff --git a/ext/oci8/tests/connect_with_charset_001.phpt b/ext/oci8/tests/connect_with_charset_001.phpt deleted file mode 100644 index 9149747cdb..0000000000 --- a/ext/oci8/tests/connect_with_charset_001.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -oci_connect() with invalid character set ---SKIPIF-- -<?php if (!extension_loaded("oci8")) print "skip"; ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -var_dump($c1 = oci_connect($user, $password, $dbase)); -var_dump($c2 = oci_connect($user, $password, $dbase, "")); -var_dump($c3 = oci_connect($user, $password, $dbase, "blah")); -var_dump($c4 = oci_connect($user, $password, $dbase, "obviously wrong")); - -var_dump($c3 == $c4); - -var_dump($c5 = oci_connect($user, $password, $dbase, "US7ASCII")); -var_dump($c6 = oci_connect($user, $password, $dbase, "UTF8")); - -var_dump($c5 == $c6); - -echo "Done\n"; -?> ---EXPECTF-- -resource(%d) of type (oci8 connection) -resource(%d) of type (oci8 connection) - -Warning: oci_connect(): Invalid character set name: blah in %s on line %d -resource(%d) of type (oci8 connection) - -Warning: oci_connect(): Invalid character set name: obviously wrong in %s on line %d -resource(%d) of type (oci8 connection) -bool(true) -resource(%d) of type (oci8 connection) -resource(%d) of type (oci8 connection) -bool(false) -Done diff --git a/ext/oci8/tests/connect_without_oracle_home.phpt b/ext/oci8/tests/connect_without_oracle_home.phpt deleted file mode 100644 index 513d60cefd..0000000000 --- a/ext/oci8/tests/connect_without_oracle_home.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -oci_connect() without ORACLE_HOME set (OCIServerAttach() segfaults) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -if (!empty($dbase)) { - var_dump(oci_connect($user, $password, $dbase)); -} -else { - var_dump(oci_connect($user, $password)); -} - -echo "Done\n"; - -?> ---EXPECTF-- -Warning: ocilogon(): _oci_open_server failed, check ORACLE_HOME and NLS_LANG variables: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor in %sconnect.inc on line %d - -Warning: oci_connect(): _oci_open_server failed, check ORACLE_HOME and NLS_LANG variables: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor in %sconnect_without_oracle_home.php on line %d -bool(false) -Done diff --git a/ext/oci8/tests/connect_without_oracle_home_old.phpt b/ext/oci8/tests/connect_without_oracle_home_old.phpt deleted file mode 100644 index 68b11de155..0000000000 --- a/ext/oci8/tests/connect_without_oracle_home_old.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -ocilogon() without ORACLE_HOME set (OCIServerAttach() segfaults) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -if (!empty($dbase)) { - var_dump(ocilogon($user, $password, $dbase)); -} -else { - var_dump(ocilogon($user, $password)); -} - -echo "Done\n"; - -?> ---EXPECTF-- -Warning: ocilogon(): _oci_open_server failed, check ORACLE_HOME and NLS_LANG variables: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor in %sconnect.inc on line %d - -Warning: oci_connect(): _oci_open_server failed, check ORACLE_HOME and NLS_LANG variables: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor in %sconnect_without_oracle_home.php on line %d -bool(false) -Done diff --git a/ext/oci8/tests/create_table.inc b/ext/oci8/tests/create_table.inc deleted file mode 100644 index d6debf2339..0000000000 --- a/ext/oci8/tests/create_table.inc +++ /dev/null @@ -1,19 +0,0 @@ -<?php - - if ($c) { - $ora_sql = "DROP TABLE - ".$schema.$table_name." - "; - - $statement = OCIParse($c, $ora_sql); - @OCIExecute($statement); - - $ora_sql = "CREATE TABLE - ".$schema.$table_name." (id NUMBER, value NUMBER, blob BLOB, clob CLOB, string VARCHAR(10)) - "; - - $statement = OCIParse($c,$ora_sql); - OCIExecute($statement); - } - -?> diff --git a/ext/oci8/tests/create_type.inc b/ext/oci8/tests/create_type.inc deleted file mode 100644 index e23f7cb903..0000000000 --- a/ext/oci8/tests/create_type.inc +++ /dev/null @@ -1,17 +0,0 @@ -<?php - - if ($c) { - $ora_sql = "DROP TYPE - ".$type_name." - "; - - $statement = OCIParse($c,$ora_sql); - @OCIExecute($statement); - - $ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER(11)"; - - $statement = OCIParse($c,$ora_sql); - OCIExecute($statement); - } - -?> diff --git a/ext/oci8/tests/cursor_bind.phpt b/ext/oci8/tests/cursor_bind.phpt deleted file mode 100644 index c2ce15cb38..0000000000 --- a/ext/oci8/tests/cursor_bind.phpt +++ /dev/null @@ -1,99 +0,0 @@ ---TEST-- -bind and fetch cursor from a statement ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$drop_table = "DROP TABLE ".$schema.$table_name.""; - -if (!($s = oci_parse($c, $drop_table))) { - die("oci_parse(drop) failed!\n"); -} - -@oci_execute($s); - -$create_table = "CREATE TABLE ".$schema.$table_name." (id NUMBER, value VARCHAR(20))"; - -if (!($s = oci_parse($c, $create_table))) { - die("oci_parse(create) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(create) failed!\n"); -} - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - - -$sql = " -DECLARE -TYPE curtype IS REF CURSOR; -cursor_var curtype; -BEGIN - OPEN cursor_var FOR SELECT id, value FROM ".$schema.$table_name."; - :curs := cursor_var; -END; -"; - -$stmt = oci_parse($c, $sql); - -$cursor = oci_new_cursor($c); -oci_bind_by_name($stmt, ":curs", $cursor, -1, OCI_B_CURSOR); - -oci_execute($stmt); - -oci_execute($cursor); -var_dump(oci_fetch_row($cursor)); -var_dump(oci_fetch_row($cursor)); -var_dump(oci_fetch_row($cursor)); -var_dump(oci_fetch_row($cursor)); - -echo "Done\n"; - -$drop_table = "DROP TABLE ".$schema.$table_name.""; - -if (!($s = oci_parse($c, $drop_table))) { - die("oci_parse(drop) failed!\n"); -} - -@oci_execute($s); - -?> ---EXPECT-- -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -bool(false) -Done diff --git a/ext/oci8/tests/cursor_bind_err.phpt b/ext/oci8/tests/cursor_bind_err.phpt deleted file mode 100644 index 267c4d94fb..0000000000 --- a/ext/oci8/tests/cursor_bind_err.phpt +++ /dev/null @@ -1,48 +0,0 @@ ---TEST-- -binding a cursor (with errors) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_table.inc"; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$sql = "select CURSOR(select * from ".$schema.$table_name.") into :cursor from dual"; -$stmt = oci_parse($c, $sql); - -$cursor = oci_new_cursor($c); -oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR); - -oci_execute($stmt); - -oci_execute($cursor); -var_dump(oci_fetch_assoc($cursor)); - -require dirname(__FILE__)."/drop_table.inc"; - -echo "Done\n"; - -?> ---EXPECTF-- -Warning: oci_bind_by_name(): ORA-01036: illegal variable name/number in %s on line %d - -Warning: oci_fetch_assoc(): ORA-24338: statement handle not executed in %s on line %d -bool(false) -Done diff --git a/ext/oci8/tests/cursors.phpt b/ext/oci8/tests/cursors.phpt deleted file mode 100644 index 22c89c9c54..0000000000 --- a/ext/oci8/tests/cursors.phpt +++ /dev/null @@ -1,65 +0,0 @@ ---TEST-- -fetching cursor from a statement ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_table.inc"; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$sql = "select CURSOR(select * from ".$schema.$table_name.") as curs FROM dual"; -$stmt = oci_parse($c, $sql); - -oci_execute($stmt); - -while ($data = oci_fetch_assoc($stmt)) { - oci_execute($data["CURS"]); - $subdata = oci_fetch_assoc($data["CURS"]); - var_dump($subdata); - var_dump(oci_cancel($data["CURS"])); - $subdata = oci_fetch_assoc($data["CURS"]); - var_dump($subdata); - var_dump(oci_cancel($data["CURS"])); -} - -require dirname(__FILE__)."/drop_table.inc"; - -echo "Done\n"; - -?> ---EXPECTF-- -array(5) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - ["BLOB"]=> - NULL - ["CLOB"]=> - NULL - ["STRING"]=> - NULL -} -bool(true) - -Warning: oci_fetch_assoc(): ORA-01002: fetch out of sequence in %s on line %d -bool(false) -bool(true) -Done diff --git a/ext/oci8/tests/cursors_old.phpt b/ext/oci8/tests/cursors_old.phpt deleted file mode 100644 index cf3b5f9575..0000000000 --- a/ext/oci8/tests/cursors_old.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -fetching cursor from a statement ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_table.inc"; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = ociparse($c, $insert_sql))) { - die("ociparse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!ociexecute($s)) { - die("ociexecute(insert) failed!\n"); - } -} - -if (!ocicommit($c)) { - die("ocicommit() failed!\n"); -} - -$sql = "select CURSOR(select * from ".$schema.$table_name.") as curs FROM dual"; -$stmt = ociparse($c, $sql); - -ociexecute($stmt); - -while ($result = ocifetchinto($stmt, $data, OCI_ASSOC)) { - ociexecute($data["CURS"]); - ocifetchinto($data["CURS"], $subdata, OCI_ASSOC); - var_dump($subdata); - var_dump(ocicancel($data["CURS"])); - ocifetchinto($data["CURS"], $subdata, OCI_ASSOC); - var_dump($subdata); - var_dump(ocicancel($data["CURS"])); -} - -require dirname(__FILE__)."/drop_table.inc"; - -echo "Done\n"; - -?> ---EXPECTF-- -array(2) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" -} -bool(true) - -Warning: ocifetchinto():%sORA-01002: fetch out of sequence in %scursors_old.php on line %d -array(2) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" -} -bool(true) -Done diff --git a/ext/oci8/tests/debug.phpt b/ext/oci8/tests/debug.phpt deleted file mode 100644 index cc771d5319..0000000000 --- a/ext/oci8/tests/debug.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -oci_internal_debug() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -oci_internal_debug(true); - -if (!empty($dbase)) { - oci_connect($user, $password, $dbase); -} -else { - oci_connect($user, $password); -} - -echo "Done\n"; - -?> ---EXPECTF-- -OCI8 DEBUG: OCINlsEnvironmentVariableGet at (%s:%d) -Done -OCI8 DEBUG: OCISessionEnd at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) -OCI8 DEBUG: OCIServerDetach at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) -OCI8 DEBUG: OCIHandleFree at (%s:%d) diff --git a/ext/oci8/tests/default_prefetch.phpt b/ext/oci8/tests/default_prefetch.phpt deleted file mode 100644 index cc02b6a1c3..0000000000 --- a/ext/oci8/tests/default_prefetch.phpt +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -oci8.default_prefetch ini option ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---INI-- -oci8.default_prefetch=20 ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema.$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} - -var_dump(oci_fetch($s)); - -var_dump(oci_num_rows($s)); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECT-- -bool(true) -int(1) -Done diff --git a/ext/oci8/tests/default_prefetch1.phpt b/ext/oci8/tests/default_prefetch1.phpt deleted file mode 100644 index aa130e9f93..0000000000 --- a/ext/oci8/tests/default_prefetch1.phpt +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -oci8.default_prefetch ini option ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---INI-- -oci8.default_prefetch=100 ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema.$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} - -var_dump(oci_fetch($s)); - -var_dump(oci_num_rows($s)); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECT-- -bool(true) -int(1) -Done diff --git a/ext/oci8/tests/default_prefetch2.phpt b/ext/oci8/tests/default_prefetch2.phpt deleted file mode 100644 index ac623a2744..0000000000 --- a/ext/oci8/tests/default_prefetch2.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -oci8.default_prefetch ini option ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---INI-- -oci8.default_prefetch=100 ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema.$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -var_dump(oci_set_prefetch($s, 10)); - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} - -var_dump(oci_fetch($s)); - -var_dump(oci_num_rows($s)); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECT-- -bool(true) -bool(true) -int(1) -Done diff --git a/ext/oci8/tests/define.phpt b/ext/oci8/tests/define.phpt deleted file mode 100644 index c76f360f28..0000000000 --- a/ext/oci8/tests/define.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -oci_define_by_name() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_table.inc"; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (string) VALUES ('some')"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); -} - -$stmt = oci_parse($c, "SELECT string FROM ".$table_name.""); - -/* the define MUST be done BEFORE ociexecute! */ - -$strong = ''; -oci_define_by_name($stmt, "STRING", $string, 20); - -oci_execute($stmt); - -while (oci_fetch($stmt)) { - var_dump($string); -} - -require dirname(__FILE__)."/drop_table.inc"; - -echo "Done\n"; - -?> ---EXPECT-- -string(4) "some" -Done diff --git a/ext/oci8/tests/define1.phpt b/ext/oci8/tests/define1.phpt deleted file mode 100644 index f6e04cc185..0000000000 --- a/ext/oci8/tests/define1.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -oci_define_by_name() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_table.inc"; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (string) VALUES ('some')"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); -} - -$stmt = oci_parse($c, "SELECT string FROM ".$table_name.""); - -/* the define MUST be done BEFORE ociexecute! */ - -$strong = ''; -var_dump(oci_define_by_name($stmt, "STRING", $string, 20)); -var_dump(oci_define_by_name($stmt, "STRING", $string, 20)); -var_dump(oci_define_by_name($stmt, "", $string, 20)); -var_dump(oci_define_by_name($stmt, "")); - -oci_execute($stmt); - -while (oci_fetch($stmt)) { - var_dump($string); -} - -require dirname(__FILE__)."/drop_table.inc"; - -echo "Done\n"; - -?> ---EXPECTF-- -bool(true) -bool(false) - -Warning: oci_define_by_name(): Column name cannot be empty in %s on line %d -bool(false) - -Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d -NULL -string(4) "some" -Done diff --git a/ext/oci8/tests/define_old.phpt b/ext/oci8/tests/define_old.phpt deleted file mode 100644 index da52e619ce..0000000000 --- a/ext/oci8/tests/define_old.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -ocidefinebyname() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__)."/create_table.inc"; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (string) VALUES ('some')"; - -if (!($s = ociparse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -if (!ociexecute($s)) { - die("oci_execute(insert) failed!\n"); -} - -$stmt = ociparse($c, "SELECT string FROM ".$table_name.""); - -/* the define MUST be done BEFORE ociexecute! */ - -$strong = ''; -ocidefinebyname($stmt, "STRING", $string, 20); - -ociexecute($stmt); - -while (ocifetch($stmt)) { - var_dump($string); -} - -require dirname(__FILE__)."/drop_table.inc"; - -echo "Done\n"; - -?> ---EXPECT-- -string(4) "some" -Done diff --git a/ext/oci8/tests/descriptors.phpt b/ext/oci8/tests/descriptors.phpt deleted file mode 100644 index 8be4f3a06d..0000000000 --- a/ext/oci8/tests/descriptors.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -commit connection after destroying the descriptor ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -unset($blob); -unset($statement); - -oci_commit($c); - -$ora_sql = "SELECT blob FROM ".$schema.$table_name." "; -$statement = oci_parse($c,$ora_sql); -oci_execute($statement, OCI_DEFAULT); - -var_dump($row = oci_fetch_assoc($statement)); -unset($row['BLOB']); - -oci_commit($c); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECTF-- -array(1) { - ["BLOB"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } -} -Done diff --git a/ext/oci8/tests/drop_table.inc b/ext/oci8/tests/drop_table.inc deleted file mode 100644 index ffd99f5af3..0000000000 --- a/ext/oci8/tests/drop_table.inc +++ /dev/null @@ -1,12 +0,0 @@ -<?php - - if ($c) { - $ora_sql = "DROP TABLE - ".$schema.$table_name." - "; - - $statement = OCIParse($c,$ora_sql); - OCIExecute($statement); - } - -?> diff --git a/ext/oci8/tests/drop_type.inc b/ext/oci8/tests/drop_type.inc deleted file mode 100644 index 047968ef28..0000000000 --- a/ext/oci8/tests/drop_type.inc +++ /dev/null @@ -1,12 +0,0 @@ -<?php - - if ($c) { - $ora_sql = "DROP TYPE - ".$type_name." - "; - - $statement = OCIParse($c,$ora_sql); - OCIExecute($statement); - } - -?> diff --git a/ext/oci8/tests/error.phpt b/ext/oci8/tests/error.phpt deleted file mode 100644 index 743820f901..0000000000 --- a/ext/oci8/tests/error.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -oci_error() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -if (!empty($dbase)) { - var_dump(oci_connect($user, $password, $dbase)); -} -else { - var_dump(oci_connect($user, $password)); -} - -var_dump($s = oci_parse($c, "WRONG SYNTAX")); -var_dump(oci_execute($s)); -var_dump(oci_error($s)); - -echo "Done\n"; - -?> ---EXPECTF-- -resource(%s) of type (oci8 connection) -resource(%s) of type (oci8 statement) - -Warning: oci_execute(): ORA-00900: invalid SQL statement in %s on line %d -bool(false) -array(4) { - ["code"]=> - int(900) - ["message"]=> - string(32) "ORA-00900: invalid SQL statement" - ["offset"]=> - int(0) - ["sqltext"]=> - string(12) "WRONG SYNTAX" -} -Done diff --git a/ext/oci8/tests/error1.phpt b/ext/oci8/tests/error1.phpt deleted file mode 100644 index 25a3f09e92..0000000000 --- a/ext/oci8/tests/error1.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -oci_error() when oci_connect() fails ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -var_dump(oci_connect("some", "some", "some")); -var_dump(oci_error()); - -echo "Done\n"; - -?> ---EXPECTF-- -Warning: oci_connect(): ORA-12154: TNS:could not resolve %s in %s on line %d -bool(false) -array(4) { - ["code"]=> - int(12154) - ["message"]=> - string(%d) "ORA-12154: TNS:could not resolve %s" - ["offset"]=> - int(0) - ["sqltext"]=> - string(0) "" -} -Done diff --git a/ext/oci8/tests/error_old.phpt b/ext/oci8/tests/error_old.phpt deleted file mode 100644 index a6889c897a..0000000000 --- a/ext/oci8/tests/error_old.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -ocierror() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -if (!empty($dbase)) { - var_dump(ocilogon($user, $password, $dbase)); -} -else { - var_dump(ocilogon($user, $password)); -} - -var_dump($s = ociparse($c, "WRONG SYNTAX")); -var_dump(ociexecute($s)); -var_dump(ocierror($s)); - -echo "Done\n"; - -?> ---EXPECTF-- -resource(%s) of type (oci8 connection) -resource(%s) of type (oci8 statement) - -Warning: ociexecute(): ORA-00900: invalid SQL statement in %s on line %d -bool(false) -array(4) { - ["code"]=> - int(900) - ["message"]=> - string(32) "ORA-00900: invalid SQL statement" - ["offset"]=> - int(0) - ["sqltext"]=> - string(12) "WRONG SYNTAX" -} -Done diff --git a/ext/oci8/tests/exec_fetch.phpt b/ext/oci8/tests/exec_fetch.phpt deleted file mode 100644 index 83aae69f7d..0000000000 --- a/ext/oci8/tests/exec_fetch.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -fetch after failed oci_execute() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$sql = "select 2 from nonex_dual"; -$stmt = oci_parse($c, $sql); - -var_dump(oci_execute($stmt)); -var_dump(oci_fetch_array($stmt)); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_execute(): ORA-00942: table or view does not exist in %s on line %d -bool(false) - -Warning: oci_fetch_array(): ORA-24374: define not done before fetch or execute and fetch in %s on line %d -bool(false) -Done diff --git a/ext/oci8/tests/execute_mode.phpt b/ext/oci8/tests/execute_mode.phpt deleted file mode 100644 index 90570cae80..0000000000 --- a/ext/oci8/tests/execute_mode.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -oci_execute() and invalid execute mode ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$pc = oci_pconnect($user, $password, $dbase); - -$stmt = oci_parse($pc, "select NULL from dual"); -oci_execute($stmt, -1); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_execute(): Invalid execute mode given: -1 in %s on line %d -Done diff --git a/ext/oci8/tests/fetch.phpt b/ext/oci8/tests/fetch.phpt deleted file mode 100644 index 33cba657b6..0000000000 --- a/ext/oci8/tests/fetch.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -ocifetch() & ociresult() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema.$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} - -while(ocifetch($s)) { - $i = 1; - while ($row = ociresult($s, $i)) { - $i++; - var_dump($row); - } -} - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECT-- -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -Done diff --git a/ext/oci8/tests/fetch_all.phpt b/ext/oci8/tests/fetch_all.phpt deleted file mode 100644 index 5d3738b892..0000000000 --- a/ext/oci8/tests/fetch_all.phpt +++ /dev/null @@ -1,149 +0,0 @@ ---TEST-- -oci_fetch_all() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema."".$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -/* oci_fetch_all */ -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -var_dump(oci_fetch_all($s, $all)); -var_dump($all); - -/* ocifetchstatement */ -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} - -var_dump(ocifetchstatement($s, $all)); -var_dump($all); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECT-- -int(3) -array(5) { - ["ID"]=> - array(3) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - string(1) "1" - } - ["VALUE"]=> - array(3) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - string(1) "1" - } - ["BLOB"]=> - array(3) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - } - ["CLOB"]=> - array(3) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - } - ["STRING"]=> - array(3) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - } -} -int(3) -array(5) { - ["ID"]=> - array(3) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - string(1) "1" - } - ["VALUE"]=> - array(3) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - string(1) "1" - } - ["BLOB"]=> - array(3) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - } - ["CLOB"]=> - array(3) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - } - ["STRING"]=> - array(3) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - } -} -Done diff --git a/ext/oci8/tests/fetch_array.phpt b/ext/oci8/tests/fetch_array.phpt deleted file mode 100644 index e2f32483d5..0000000000 --- a/ext/oci8/tests/fetch_array.phpt +++ /dev/null @@ -1,308 +0,0 @@ ---TEST-- -oci_fetch_array() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema."".$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -while ($row = oci_fetch_array($s)) { - var_dump($row); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -while ($row = oci_fetch_array($s, OCI_NUM)) { - var_dump($row); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -while ($row = oci_fetch_array($s, OCI_ASSOC)) { - var_dump($row); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -while ($row = oci_fetch_array($s, OCI_BOTH)) { - var_dump($row); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -while ($row = oci_fetch_array($s, OCI_RETURN_LOBS)) { - var_dump($row); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -while ($row = oci_fetch_array($s, OCI_RETURN_NULLS)) { - var_dump($row); -} - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECT-- -array(10) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - [2]=> - NULL - ["BLOB"]=> - NULL - [3]=> - NULL - ["CLOB"]=> - NULL - [4]=> - NULL - ["STRING"]=> - NULL -} -array(10) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - [2]=> - NULL - ["BLOB"]=> - NULL - [3]=> - NULL - ["CLOB"]=> - NULL - [4]=> - NULL - ["STRING"]=> - NULL -} -array(10) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - [2]=> - NULL - ["BLOB"]=> - NULL - [3]=> - NULL - ["CLOB"]=> - NULL - [4]=> - NULL - ["STRING"]=> - NULL -} -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -array(2) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" -} -array(2) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" -} -array(2) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" -} -array(4) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" -} -array(4) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" -} -array(4) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" -} -array(4) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" -} -array(4) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" -} -array(4) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" -} -array(10) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - [2]=> - NULL - ["BLOB"]=> - NULL - [3]=> - NULL - ["CLOB"]=> - NULL - [4]=> - NULL - ["STRING"]=> - NULL -} -array(10) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - [2]=> - NULL - ["BLOB"]=> - NULL - [3]=> - NULL - ["CLOB"]=> - NULL - [4]=> - NULL - ["STRING"]=> - NULL -} -array(10) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - [2]=> - NULL - ["BLOB"]=> - NULL - [3]=> - NULL - ["CLOB"]=> - NULL - [4]=> - NULL - ["STRING"]=> - NULL -} -Done diff --git a/ext/oci8/tests/fetch_assoc.phpt b/ext/oci8/tests/fetch_assoc.phpt deleted file mode 100644 index 7dacf2e5b2..0000000000 --- a/ext/oci8/tests/fetch_assoc.phpt +++ /dev/null @@ -1,82 +0,0 @@ ---TEST-- -oci_fetch_assoc() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema."".$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -while ($row = oci_fetch_assoc($s)) { - var_dump($row); -} - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECT-- -array(5) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - ["BLOB"]=> - NULL - ["CLOB"]=> - NULL - ["STRING"]=> - NULL -} -array(5) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - ["BLOB"]=> - NULL - ["CLOB"]=> - NULL - ["STRING"]=> - NULL -} -array(5) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - ["BLOB"]=> - NULL - ["CLOB"]=> - NULL - ["STRING"]=> - NULL -} -Done diff --git a/ext/oci8/tests/fetch_into.phpt b/ext/oci8/tests/fetch_into.phpt deleted file mode 100644 index 379f5fc14e..0000000000 --- a/ext/oci8/tests/fetch_into.phpt +++ /dev/null @@ -1,82 +0,0 @@ ---TEST-- -ocifetchinto() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema."".$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -/* oci_fetch_all */ -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -var_dump(ocifetchinto($s, $all)); -var_dump($all); - -/* oci_fetch_all */ -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS)); -var_dump($all); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECT-- -int(5) -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -int(5) -array(10) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - [2]=> - NULL - ["BLOB"]=> - NULL - [3]=> - NULL - ["CLOB"]=> - NULL - [4]=> - NULL - ["STRING"]=> - NULL -} -Done diff --git a/ext/oci8/tests/fetch_into1.phpt b/ext/oci8/tests/fetch_into1.phpt deleted file mode 100644 index 263590d140..0000000000 --- a/ext/oci8/tests/fetch_into1.phpt +++ /dev/null @@ -1,192 +0,0 @@ ---TEST-- -various ocifetchinto() tests ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value, string) VALUES (1, 1, NULL)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<20; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema."".$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -var_dump(ocifetchinto($s, $all, OCI_NUM)); -var_dump($all); -var_dump(ocifetchinto($s, $all, OCI_ASSOC)); -var_dump($all); -var_dump(ocifetchinto($s, $all, OCI_RETURN_NULLS)); -var_dump($all); -var_dump(ocifetchinto($s, $all, OCI_RETURN_LOBS)); -var_dump($all); -var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC)); -var_dump($all); -var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS)); -var_dump($all); -var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS)); -var_dump($all); -var_dump(ocifetchinto($s, $all, OCI_RETURN_NULLS+OCI_RETURN_LOBS)); -var_dump($all); -var_dump(ocifetchinto($s, $all, OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS)); -var_dump($all); -var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_RETURN_NULLS+OCI_RETURN_LOBS)); -var_dump($all); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECT-- -int(5) -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -int(5) -array(2) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" -} -int(5) -array(5) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL -} -int(5) -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -int(5) -array(4) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" -} -int(5) -array(10) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - [2]=> - NULL - ["BLOB"]=> - NULL - [3]=> - NULL - ["CLOB"]=> - NULL - [4]=> - NULL - ["STRING"]=> - NULL -} -int(5) -array(10) { - [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" - [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - [2]=> - NULL - ["BLOB"]=> - NULL - [3]=> - NULL - ["CLOB"]=> - NULL - [4]=> - NULL - ["STRING"]=> - NULL -} -int(5) -array(5) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL -} -int(5) -array(5) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - ["BLOB"]=> - NULL - ["CLOB"]=> - NULL - ["STRING"]=> - NULL -} -int(5) -array(5) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL -} -Done diff --git a/ext/oci8/tests/fetch_into2.phpt b/ext/oci8/tests/fetch_into2.phpt deleted file mode 100644 index c196d39f62..0000000000 --- a/ext/oci8/tests/fetch_into2.phpt +++ /dev/null @@ -1,70 +0,0 @@ ---TEST-- -ocifetchinto() & wrong number of params ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value, string) VALUES (1, 1, NULL)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<20; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema."".$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -var_dump(ocifetchinto($s)); -var_dump($all); -var_dump(ocifetchinto($s, $all, OCI_ASSOC, 5)); -var_dump($all); -var_dump(ocifetchinto($c, $all, OCI_RETURN_LOBS)); -var_dump($all); -var_dump(ocifetchinto($s, $all, 1000000)); -var_dump($all); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECTF-- -Warning: ocifetchinto() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Notice: Undefined variable: all in %s on line %d -NULL - -Warning: ocifetchinto() expects at most 3 parameters, 4 given in %s on line %d -NULL -NULL - -Warning: ocifetchinto(): supplied resource is not a valid oci8 statement resource in %s on line %d -bool(false) -NULL -int(5) -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" -} -Done diff --git a/ext/oci8/tests/fetch_object.phpt b/ext/oci8/tests/fetch_object.phpt deleted file mode 100644 index 57b7fc03d8..0000000000 --- a/ext/oci8/tests/fetch_object.phpt +++ /dev/null @@ -1,82 +0,0 @@ ---TEST-- -oci_fetch_object() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema."".$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -while ($row = oci_fetch_object($s)) { - var_dump($row); -} - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -object(stdClass)#%d (5) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - ["BLOB"]=> - NULL - ["CLOB"]=> - NULL - ["STRING"]=> - NULL -} -object(stdClass)#%d (5) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - ["BLOB"]=> - NULL - ["CLOB"]=> - NULL - ["STRING"]=> - NULL -} -object(stdClass)#%d (5) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" - ["BLOB"]=> - NULL - ["CLOB"]=> - NULL - ["STRING"]=> - NULL -} -Done diff --git a/ext/oci8/tests/fetch_row.phpt b/ext/oci8/tests/fetch_row.phpt deleted file mode 100644 index a637ecc6f4..0000000000 --- a/ext/oci8/tests/fetch_row.phpt +++ /dev/null @@ -1,82 +0,0 @@ ---TEST-- -oci_fetch_row() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema."".$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} -while ($row = oci_fetch_row($s)) { - var_dump($row); -} - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECT-- -array(5) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL -} -array(5) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL -} -array(5) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL -} -Done diff --git a/ext/oci8/tests/field_funcs.phpt b/ext/oci8/tests/field_funcs.phpt deleted file mode 100644 index 102f2fdc03..0000000000 --- a/ext/oci8/tests/field_funcs.phpt +++ /dev/null @@ -1,105 +0,0 @@ ---TEST-- -oci_field_*() family ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema."".$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} - -$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS); -var_dump($row); - -foreach ($row as $num => $field) { - $num++; - var_dump(oci_field_is_null($s, $num)); - var_dump(oci_field_name($s, $num)); - var_dump(oci_field_type($s, $num)); - var_dump(oci_field_type_raw($s, $num)); - var_dump(oci_field_scale($s, $num)); - var_dump(oci_field_precision($s, $num)); - var_dump(oci_field_size($s, $num)); -} - - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -array(5) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL -} -bool(false) -string(2) "ID" -string(6) "NUMBER" -int(2) -int(%d) -int(0) -int(22) -bool(false) -string(5) "VALUE" -string(6) "NUMBER" -int(2) -int(%d) -int(0) -int(22) -bool(true) -string(4) "BLOB" -string(4) "BLOB" -int(113) -int(0) -int(0) -int(4000) -bool(true) -string(4) "CLOB" -string(4) "CLOB" -int(112) -int(0) -int(0) -int(4000) -bool(true) -string(6) "STRING" -string(8) "VARCHAR2" -int(1) -int(0) -int(0) -int(10) -Done diff --git a/ext/oci8/tests/field_funcs1.phpt b/ext/oci8/tests/field_funcs1.phpt deleted file mode 100644 index b41e743e41..0000000000 --- a/ext/oci8/tests/field_funcs1.phpt +++ /dev/null @@ -1,179 +0,0 @@ ---TEST-- -oci_field_*() family ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema."".$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} - -$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS); -var_dump($row); - -var_dump(oci_field_is_null($s, -1)); -var_dump(oci_field_name($s, -1)); -var_dump(oci_field_type($s, -1)); -var_dump(oci_field_type_raw($s, -1)); -var_dump(oci_field_scale($s, -1)); -var_dump(oci_field_precision($s, -1)); -var_dump(oci_field_size($s, -1)); - -var_dump(oci_field_is_null($s, "none")); -var_dump(oci_field_name($s, "none")); -var_dump(oci_field_type($s, "none")); -var_dump(oci_field_type_raw($s, "none")); -var_dump(oci_field_scale($s, "none")); -var_dump(oci_field_precision($s, "none")); -var_dump(oci_field_size($s, "none")); - -var_dump(oci_field_is_null($c, -1)); -var_dump(oci_field_name($c, -1)); -var_dump(oci_field_type($c, -1)); -var_dump(oci_field_type_raw($c, -1)); -var_dump(oci_field_scale($c, -1)); -var_dump(oci_field_precision($c, -1)); -var_dump(oci_field_size($c, -1)); - -var_dump(oci_field_is_null($s, array())); -var_dump(oci_field_name($s, array())); -var_dump(oci_field_type($s, array())); -var_dump(oci_field_type_raw($s, array())); -var_dump(oci_field_scale($s, array())); -var_dump(oci_field_precision($s, array())); -var_dump(oci_field_size($s, array())); - -var_dump(oci_field_size($s)); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -array(5) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL -} - -Warning: oci_field_is_null(): Invalid column index "-1" in %s on line %d -bool(false) - -Warning: oci_field_name(): Invalid column index "-1" in %s on line %d -bool(false) - -Warning: oci_field_type(): Invalid column index "-1" in %s on line %d -bool(false) - -Warning: oci_field_type_raw(): Invalid column index "-1" in %s on line %d -bool(false) - -Warning: oci_field_scale(): Invalid column index "-1" in %s on line %d -bool(false) - -Warning: oci_field_precision(): Invalid column index "-1" in %s on line %d -bool(false) - -Warning: oci_field_size(): Invalid column index "-1" in %s on line %d -bool(false) - -Warning: oci_field_is_null(): Invalid column name "none" in %s on line %d -bool(false) - -Warning: oci_field_name(): Invalid column name "none" in %s on line %d -bool(false) - -Warning: oci_field_type(): Invalid column name "none" in %s on line %d -bool(false) - -Warning: oci_field_type_raw(): Invalid column name "none" in %s on line %d -bool(false) - -Warning: oci_field_scale(): Invalid column name "none" in %s on line %d -bool(false) - -Warning: oci_field_precision(): Invalid column name "none" in %s on line %d -bool(false) - -Warning: oci_field_size(): Invalid column name "none" in %s on line %d -bool(false) - -Warning: oci_field_is_null(): supplied resource is not a valid oci8 statement resource in %s on line %d -bool(false) - -Warning: oci_field_name(): supplied resource is not a valid oci8 statement resource in %s on line %d -bool(false) - -Warning: oci_field_type(): supplied resource is not a valid oci8 statement resource in %s on line %d -bool(false) - -Warning: oci_field_type_raw(): supplied resource is not a valid oci8 statement resource in %s on line %d -bool(false) - -Warning: oci_field_scale(): supplied resource is not a valid oci8 statement resource in %s on line %d -bool(false) - -Warning: oci_field_precision(): supplied resource is not a valid oci8 statement resource in %s on line %d -bool(false) - -Warning: oci_field_size(): supplied resource is not a valid oci8 statement resource in %s on line %d -bool(false) - -Warning: oci_field_is_null(): Invalid column index "0" in %s on line %d -bool(false) - -Warning: oci_field_name(): Invalid column index "0" in %s on line %d -bool(false) - -Warning: oci_field_type(): Invalid column index "0" in %s on line %d -bool(false) - -Warning: oci_field_type_raw(): Invalid column index "0" in %s on line %d -bool(false) - -Warning: oci_field_scale(): Invalid column index "0" in %s on line %d -bool(false) - -Warning: oci_field_precision(): Invalid column index "0" in %s on line %d -bool(false) - -Warning: oci_field_size(): Invalid column index "0" in %s on line %d -bool(false) - -Warning: oci_field_size() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) -Done diff --git a/ext/oci8/tests/field_funcs_old.phpt b/ext/oci8/tests/field_funcs_old.phpt deleted file mode 100644 index e6f21d613d..0000000000 --- a/ext/oci8/tests/field_funcs_old.phpt +++ /dev/null @@ -1,105 +0,0 @@ ---TEST-- -ocicolumn*() family ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; - -if (!($s = ociparse($c, $insert_sql))) { - die("ociparse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!ociexecute($s)) { - die("ociexecute(insert) failed!\n"); - } -} - -if (!ocicommit($c)) { - die("ocicommit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema."".$table_name.""; - -if (!($s = ociparse($c, $select_sql))) { - die("ociparse(select) failed!\n"); -} - -if (!ociexecute($s)) { - die("ociexecute(select) failed!\n"); -} - -ocifetchinto($s, $row, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS); -var_dump($row); - -foreach ($row as $num => $field) { - $num++; - var_dump(ocicolumnisnull($s, $num)); - var_dump(ocicolumnname($s, $num)); - var_dump(ocicolumntype($s, $num)); - var_dump(ocicolumntyperaw($s, $num)); - var_dump(ocicolumnscale($s, $num)); - var_dump(ocicolumnprecision($s, $num)); - var_dump(ocicolumnsize($s, $num)); -} - - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -array(5) { - [0]=> - string(1) "1" - [1]=> - string(1) "1" - [2]=> - NULL - [3]=> - NULL - [4]=> - NULL -} -bool(false) -string(2) "ID" -string(6) "NUMBER" -int(2) -int(%d) -int(0) -int(22) -bool(false) -string(5) "VALUE" -string(6) "NUMBER" -int(2) -int(%d) -int(0) -int(22) -bool(true) -string(4) "BLOB" -string(4) "BLOB" -int(113) -int(0) -int(0) -int(4000) -bool(true) -string(4) "CLOB" -string(4) "CLOB" -int(112) -int(0) -int(0) -int(4000) -bool(true) -string(6) "STRING" -string(8) "VARCHAR2" -int(1) -int(0) -int(0) -int(10) -Done diff --git a/ext/oci8/tests/lob_001.phpt b/ext/oci8/tests/lob_001.phpt Binary files differdeleted file mode 100644 index cbcb92e7ec..0000000000 --- a/ext/oci8/tests/lob_001.phpt +++ /dev/null diff --git a/ext/oci8/tests/lob_002.phpt b/ext/oci8/tests/lob_002.phpt deleted file mode 100644 index ebbef1815e..0000000000 --- a/ext/oci8/tests/lob_002.phpt +++ /dev/null @@ -1,66 +0,0 @@ ---TEST-- -oci_lob_write() and friends (with errors) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -var_dump($blob); - -var_dump($blob->write("test", -1)); -var_dump($blob->write("test", "str")); -var_dump($blob->write("test", 1000000)); -var_dump($blob->write(str_repeat("test", 10000), 1000000)); -var_dump($blob->tell()); -var_dump($blob->seek("str", -5)); -var_dump($blob->flush()); - -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name.""; -$s = oci_parse($c, $select_sql); -oci_execute($s); - -$row = oci_fetch_array($s, OCI_RETURN_LOBS); - -var_dump(strlen($row[0])); - - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) -} -int(0) - -Warning: OCI-Lob::write() expects parameter 2 to be long, string given in %slob_002.php on line %d -NULL -int(4) -int(40000) -int(40004) - -Warning: OCI-Lob::seek() expects parameter 1 to be long, string given in %slob_002.php on line %d -NULL -bool(false) -int(40004) -Done diff --git a/ext/oci8/tests/lob_003.phpt b/ext/oci8/tests/lob_003.phpt Binary files differdeleted file mode 100644 index 8a492d16ca..0000000000 --- a/ext/oci8/tests/lob_003.phpt +++ /dev/null diff --git a/ext/oci8/tests/lob_004.phpt b/ext/oci8/tests/lob_004.phpt deleted file mode 100644 index 32de4a0120..0000000000 --- a/ext/oci8/tests/lob_004.phpt +++ /dev/null @@ -1,80 +0,0 @@ ---TEST-- -oci_lob_seek()/rewind()/append() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -var_dump($blob); - -var_dump($blob->write("test")); -var_dump($blob->rewind()); -var_dump($blob->write("str")); -var_dump($blob->seek(10, OCI_SEEK_SET)); - -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -var_dump($row = oci_fetch_array($s)); - -var_dump($row[0]->append($blob)); -var_dump($row[0]->read(10000)); - -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -$row = oci_fetch_array($s); - -var_dump($row[0]->read(10000)); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) -} -int(4) -bool(true) -int(3) -bool(true) -array(2) { - [0]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } - ["BLOB"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } -} -bool(true) -string(4) "strt" -string(8) "strtstrt" -Done diff --git a/ext/oci8/tests/lob_005.phpt b/ext/oci8/tests/lob_005.phpt deleted file mode 100644 index e1ac6e5340..0000000000 --- a/ext/oci8/tests/lob_005.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -oci_lob_is_equal() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -var_dump($row = oci_fetch_array($s)); - -var_dump(oci_lob_is_equal($row[0], $row['BLOB'])); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -array(2) { - [0]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } - ["BLOB"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } -} -bool(true) -Done diff --git a/ext/oci8/tests/lob_006.phpt b/ext/oci8/tests/lob_006.phpt Binary files differdeleted file mode 100644 index 3192ebc906..0000000000 --- a/ext/oci8/tests/lob_006.phpt +++ /dev/null diff --git a/ext/oci8/tests/lob_007.phpt b/ext/oci8/tests/lob_007.phpt deleted file mode 100644 index 1fe63092c6..0000000000 --- a/ext/oci8/tests/lob_007.phpt +++ /dev/null @@ -1,66 +0,0 @@ ---TEST-- -oci_lob_write()/size()/load() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -var_dump($blob); - -var_dump($blob->size()); -var_dump($blob->write(str_repeat("string.", 1000))); -var_dump($blob->size()); -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -var_dump($row = oci_fetch_array($s)); - -var_dump($row[0]->size()); -var_dump(strlen($row[0]->load())); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) -} -int(0) -int(7000) -int(7000) -array(2) { - [0]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } - ["BLOB"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } -} -int(7000) -int(7000) -Done diff --git a/ext/oci8/tests/lob_008.phpt b/ext/oci8/tests/lob_008.phpt deleted file mode 100644 index a36bb4a340..0000000000 --- a/ext/oci8/tests/lob_008.phpt +++ /dev/null @@ -1,65 +0,0 @@ ---TEST-- -oci_lob_write()/read()/eof() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -var_dump($blob); - -var_dump($blob->write(str_repeat("string.", 1000))); -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -var_dump($row = oci_fetch_array($s)); - - -$len = 0; -while (!$row[0]->eof()) { - $len += strlen($row[0]->read(1024)); -} -var_dump($len); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) -} -int(7000) -array(2) { - [0]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } - ["BLOB"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } -} -int(7000) -Done diff --git a/ext/oci8/tests/lob_009.phpt b/ext/oci8/tests/lob_009.phpt deleted file mode 100644 index b9f7401128..0000000000 --- a/ext/oci8/tests/lob_009.phpt +++ /dev/null @@ -1,69 +0,0 @@ ---TEST-- -oci_lob_import()/read() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -var_dump($blob); -var_dump($blob->seek(10, OCI_SEEK_CUR)); -var_dump($blob->import(dirname(__FILE__)."/lob_009.txt")); -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -var_dump($row = oci_fetch_array($s)); - -while (!$row[0]->eof()) { - var_dump($row[0]->read(1024)); -} - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) -} -bool(true) -bool(true) -array(2) { - [0]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } - ["BLOB"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } -} -string(43) "this -is -a -test -file for -test lob_009.phpt -" -Done diff --git a/ext/oci8/tests/lob_009.txt b/ext/oci8/tests/lob_009.txt deleted file mode 100644 index f57bc8af37..0000000000 --- a/ext/oci8/tests/lob_009.txt +++ /dev/null @@ -1,6 +0,0 @@ -this -is -a -test -file for -test lob_009.phpt diff --git a/ext/oci8/tests/lob_010.phpt b/ext/oci8/tests/lob_010.phpt deleted file mode 100644 index 59f3e145f2..0000000000 --- a/ext/oci8/tests/lob_010.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -oci_lob_save() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -var_dump($blob->save("string")); -var_dump($blob->save("string", 3)); -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -$row = oci_fetch_array($s); - -while (!$row[0]->eof()) { - var_dump($row[0]->read(1024)); -} - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECT-- -bool(true) -bool(true) -string(9) "strstring" -Done diff --git a/ext/oci8/tests/lob_011.phpt b/ext/oci8/tests/lob_011.phpt deleted file mode 100644 index b074e1730e..0000000000 --- a/ext/oci8/tests/lob_011.phpt +++ /dev/null @@ -1,78 +0,0 @@ ---TEST-- -oci_lob_copy() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (id, blob) - VALUES (1, empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -var_dump($blob->write("some string here. string, I said")); -oci_commit($c); - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (id, blob) - VALUES (2, empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 1"; -$s = oci_parse($c, $select_sql); -oci_execute($s); - -$row1 = oci_fetch_array($s); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 2 FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -$row2 = oci_fetch_array($s); - -var_dump(oci_lob_copy($row2[0], $row1[0])); -var_dump($row1[0]->read(100)); - -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 2 FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -var_dump($row2 = oci_fetch_array($s, OCI_RETURN_LOBS)); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECT-- -int(32) -bool(true) -string(32) "some string here. string, I said" -array(2) { - [0]=> - string(32) "some string here. string, I said" - ["BLOB"]=> - string(32) "some string here. string, I said" -} -Done diff --git a/ext/oci8/tests/lob_012.phpt b/ext/oci8/tests/lob_012.phpt deleted file mode 100644 index 2061969bc4..0000000000 --- a/ext/oci8/tests/lob_012.phpt +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -oci_lob_export() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -$blob; - -var_dump($blob->write("test string is here\nnew string")); - -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -$row = oci_fetch_array($s); - -var_dump($row[0]->export(dirname(__FILE__)."/lob_012.tmp", 3, 10)); - -var_dump(file_get_contents(dirname(__FILE__)."/lob_012.tmp")); - -@unlink(dirname(__FILE__)."/lob_012.tmp"); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECT-- -int(30) -bool(true) -string(10) "t string i" -Done diff --git a/ext/oci8/tests/lob_013.phpt b/ext/oci8/tests/lob_013.phpt deleted file mode 100644 index c56de56198..0000000000 --- a/ext/oci8/tests/lob_013.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -lob buffering ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -var_dump($blob->write("test")); -var_dump($blob->getBuffering()); -var_dump($blob->setBuffering(true)); -var_dump($blob->write("test")); -var_dump($blob->getBuffering()); -var_dump($blob->flush()); - -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name.""; -$s = oci_parse($c, $select_sql); -oci_execute($s); - -$row = oci_fetch_array($s, OCI_RETURN_LOBS); - -var_dump($row[0]); - - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECT-- -int(4) -bool(false) -bool(true) -int(4) -bool(true) -bool(true) -string(8) "testtest" -Done diff --git a/ext/oci8/tests/lob_014.phpt b/ext/oci8/tests/lob_014.phpt deleted file mode 100644 index 60ed945312..0000000000 --- a/ext/oci8/tests/lob_014.phpt +++ /dev/null @@ -1,58 +0,0 @@ ---TEST-- -oci_lob_free()/close() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -$blob; - -var_dump($blob->write("test")); -var_dump($blob->close()); -var_dump($blob->write("test")); -var_dump($blob->free()); -var_dump($blob->write("test")); - -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name.""; -$s = oci_parse($c, $select_sql); -oci_execute($s); - -var_dump(oci_fetch_array($s, OCI_NUM + OCI_RETURN_LOBS)); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -int(4) - -Warning: OCI-Lob::close(): ORA-22289: cannot perform operation on an unopened file or LOB in %slob_014.php on line %d -bool(false) -int(4) -bool(true) - -Warning: OCI-Lob::write(): %d is not a valid oci8 descriptor resource in %slob_014.php on line %d -bool(false) -array(1) { - [0]=> - string(8) "testtest" -} -Done diff --git a/ext/oci8/tests/lob_015.phpt b/ext/oci8/tests/lob_015.phpt deleted file mode 100644 index 297d5b4971..0000000000 --- a/ext/oci8/tests/lob_015.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -various tests with wrong param count ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB,1,2,3); -$blob = oci_new_descriptor($c); -$int = 1; -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB,4); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB,4,5); -oci_bind_by_name($statement,":v_blob", $int,-1); -oci_bind_by_name($statement,":v_blob", $int); -oci_bind_by_name($statement,":v_blob"); -oci_bind_by_name($statement); -oci_execute($statement, OCI_DEFAULT); - -var_dump($blob); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -Warning: oci_new_descriptor() expects at most 2 parameters, 5 given in %s on line %d - -Warning: oci_bind_by_name() expects at most 5 parameters, 6 given in %s on line %d - -Warning: oci_bind_by_name() expects at most 5 parameters, 7 given in %s on line %d - -Warning: oci_bind_by_name() expects at least 3 parameters, 2 given in %s on line %d - -Warning: oci_bind_by_name() expects at least 3 parameters, 1 given in %s on line %d - -Warning: oci_execute(): ORA-00932: inconsistent datatypes: expected NUMBER got BLOB in %s on line %d -object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) -} -Done diff --git a/ext/oci8/tests/lob_016.phpt b/ext/oci8/tests/lob_016.phpt deleted file mode 100644 index 642e7195ef..0000000000 --- a/ext/oci8/tests/lob_016.phpt +++ /dev/null @@ -1,67 +0,0 @@ ---TEST-- -returning multiple lobs ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table lob_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table lob_test(lob_1 BLOB, lob_2 BLOB)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$init = "INSERT INTO lob_test VALUES(EMPTY_BLOB(), EMPTY_BLOB())"; -$statement = oci_parse($c, $init); -oci_execute($statement); - -$select = "SELECT * FROM lob_test FOR UPDATE"; -$statement = oci_parse($c, $select); -oci_execute($statement, OCI_DEFAULT); - -$row = oci_fetch_assoc($statement); - -$row['LOB_1']->write("first"); -$row['LOB_2']->write("second"); - -unset($row); - -oci_commit($c); - -$select = "SELECT * FROM lob_test FOR UPDATE"; -$statement = oci_parse($c, $select); -oci_execute($statement, OCI_DEFAULT); - -$row = oci_fetch_assoc($statement); - -var_dump($row); -var_dump($row['LOB_1']->load()); -var_dump($row['LOB_2']->load()); - -$drop = "DROP table lob_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -echo "Done\n"; - -?> ---EXPECTF-- -array(2) { - ["LOB_1"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } - ["LOB_2"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } -} -string(5) "first" -string(6) "second" -Done diff --git a/ext/oci8/tests/lob_017.phpt b/ext/oci8/tests/lob_017.phpt deleted file mode 100644 index ed12cc4685..0000000000 --- a/ext/oci8/tests/lob_017.phpt +++ /dev/null @@ -1,69 +0,0 @@ ---TEST-- -returning multiple lobs (using persistent connection) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$c = oci_pconnect($user, $password, $dbase); - -$drop = "DROP table lob_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table lob_test(lob_1 BLOB, lob_2 BLOB)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$init = "INSERT INTO lob_test VALUES(EMPTY_BLOB(), EMPTY_BLOB())"; -$statement = oci_parse($c, $init); -oci_execute($statement); - -$select = "SELECT * FROM lob_test FOR UPDATE"; -$statement = oci_parse($c, $select); -oci_execute($statement, OCI_DEFAULT); - -$row = oci_fetch_assoc($statement); - -$row['LOB_1']->write("first"); -$row['LOB_2']->write("second"); - -unset($row); - -oci_commit($c); - -$select = "SELECT * FROM lob_test FOR UPDATE"; -$statement = oci_parse($c, $select); -oci_execute($statement, OCI_DEFAULT); - -$row = oci_fetch_assoc($statement); - -var_dump($row); -var_dump($row['LOB_1']->load()); -var_dump($row['LOB_2']->load()); - -$drop = "DROP table lob_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -echo "Done\n"; - -?> ---EXPECTF-- -array(2) { - ["LOB_1"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } - ["LOB_2"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } -} -string(5) "first" -string(6) "second" -Done diff --git a/ext/oci8/tests/lob_018.phpt b/ext/oci8/tests/lob_018.phpt deleted file mode 100644 index 35cec4bd7d..0000000000 --- a/ext/oci8/tests/lob_018.phpt +++ /dev/null @@ -1,67 +0,0 @@ ---TEST-- -fetching the same lob several times ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table lob_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table lob_test(mykey NUMBER, lob_1 CLOB)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(1, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob"; -$statement = oci_parse($c, $init); -$clob = oci_new_descriptor($c, OCI_D_LOB); -oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB); -oci_execute($statement, OCI_DEFAULT); -$clob->save("data"); - -oci_commit($c); - -$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(2, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob"; -$statement = oci_parse($c, $init); -$clob = oci_new_descriptor($c, OCI_D_LOB); -oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB); -oci_execute($statement, OCI_DEFAULT); -$clob->save("long data"); - -oci_commit($c); - - -$query = 'SELECT * FROM lob_test ORDER BY mykey ASC'; -$statement = oci_parse ($c, $query); -oci_execute($statement, OCI_DEFAULT); - -while ($row = oci_fetch_array($statement, OCI_ASSOC)) { - $result = $row['LOB_1']->load(); - var_dump($result); -} - -$query = 'SELECT * FROM lob_test ORDER BY mykey DESC'; -$statement = oci_parse ($c, $query); -oci_execute($statement, OCI_DEFAULT); - -while ($row = oci_fetch_array($statement, OCI_ASSOC)) { - $result = $row['LOB_1']->load(); - var_dump($result); -} - -$drop = "DROP table lob_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -echo "Done\n"; - -?> ---EXPECTF-- -string(4) "data" -string(9) "long data" -string(9) "long data" -string(4) "data" -Done diff --git a/ext/oci8/tests/lob_019.phpt b/ext/oci8/tests/lob_019.phpt Binary files differdeleted file mode 100644 index fb9a3c8188..0000000000 --- a/ext/oci8/tests/lob_019.phpt +++ /dev/null diff --git a/ext/oci8/tests/lob_020.phpt b/ext/oci8/tests/lob_020.phpt Binary files differdeleted file mode 100644 index edd0f02490..0000000000 --- a/ext/oci8/tests/lob_020.phpt +++ /dev/null diff --git a/ext/oci8/tests/lob_021.phpt b/ext/oci8/tests/lob_021.phpt deleted file mode 100644 index 32ef6f9fef..0000000000 --- a/ext/oci8/tests/lob_021.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -oci_lob_free()/close() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -$blob; - -var_dump($blob->write("test")); -var_dump($blob->close()); -var_dump($blob->write("test")); -var_dump(oci_free_descriptor($blob)); -var_dump($blob->write("test")); - -var_dump(oci_free_descriptor($blob)); -var_dump(oci_free_descriptor(new stdclass)); - -$blob = oci_new_descriptor($c,OCI_D_LOB); -unset($blob->descriptor); -var_dump(oci_free_descriptor($blob)); - -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name.""; -$s = oci_parse($c, $select_sql); -oci_execute($s); - -var_dump(oci_fetch_array($s, OCI_NUM + OCI_RETURN_LOBS)); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -int(4) - -Warning: OCI-Lob::close(): ORA-22289: cannot perform operation on an unopened file or LOB in %s on line %d -bool(false) -int(4) -bool(true) - -Warning: OCI-Lob::write(): %d is not a valid oci8 descriptor resource in %s on line %d -bool(false) - -Warning: oci_free_descriptor(): %d is not a valid oci8 descriptor resource in %s on line %d -bool(false) - -Warning: oci_free_descriptor() expects parameter 1 to be OCI-Lob, object given in %s on line %d -NULL - -Warning: oci_free_descriptor(): Unable to find descriptor property in %s on line %d -bool(false) -array(1) { - [0]=> - string(8) "testtest" -} -Done diff --git a/ext/oci8/tests/lob_022.phpt b/ext/oci8/tests/lob_022.phpt deleted file mode 100644 index 5fb9dfab0e..0000000000 --- a/ext/oci8/tests/lob_022.phpt +++ /dev/null @@ -1,80 +0,0 @@ ---TEST-- -fetching the same lob several times ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$drop = "DROP table lob_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -$create = "CREATE table lob_test(mykey NUMBER, lob_1 CLOB)"; -$statement = oci_parse($c, $create); -oci_execute($statement); - -$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(1, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob"; -$statement = oci_parse($c, $init); -$clob = oci_new_descriptor($c, OCI_D_LOB); -oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB); -oci_execute($statement, OCI_DEFAULT); -$clob->save(); -oci_lob_save(); -oci_lob_save($clob, "data"); -unset($clob->descriptor); -oci_lob_save($clob, "data"); - -oci_commit($c); - -$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(2, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob"; -$statement = oci_parse($c, $init); -$clob = oci_new_descriptor($c, OCI_D_LOB); -oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB); -oci_execute($statement, OCI_DEFAULT); -$clob->save("long data"); -$clob->save("long data", -1); -$clob->save("long data", 0); - -oci_commit($c); - - -$query = 'SELECT * FROM lob_test ORDER BY mykey ASC'; -$statement = oci_parse ($c, $query); -oci_execute($statement, OCI_DEFAULT); - -while ($row = oci_fetch_array($statement, OCI_ASSOC)) { - $result = $row['LOB_1']->load(); - var_dump($result); -} - -$query = 'SELECT * FROM lob_test ORDER BY mykey DESC'; -$statement = oci_parse ($c, $query); -oci_execute($statement, OCI_DEFAULT); - -while ($row = oci_fetch_array($statement, OCI_ASSOC)) { - $result = $row['LOB_1']->load(); - var_dump($result); -} - -$drop = "DROP table lob_test"; -$statement = oci_parse($c, $drop); -@oci_execute($statement); - -echo "Done\n"; - -?> ---EXPECTF-- -Warning: OCI-Lob::save() expects at least 1 parameter, 0 given in %s on line %d - -Warning: oci_lob_save() expects at least 2 parameters, 0 given in %s on line %d - -Warning: oci_lob_save(): Unable to find descriptor property in %s on line %d - -Warning: OCI-Lob::save(): Offset parameter must be greater than or equal to 0 in %s on line %d -string(4) "data" -string(9) "long data" -string(9) "long data" -string(4) "data" -Done diff --git a/ext/oci8/tests/lob_023.phpt b/ext/oci8/tests/lob_023.phpt deleted file mode 100644 index 0c352956de..0000000000 --- a/ext/oci8/tests/lob_023.phpt +++ /dev/null @@ -1,84 +0,0 @@ ---TEST-- -oci_lob_import()/read() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -var_dump($blob); -var_dump($blob->seek(10, OCI_SEEK_CUR)); -var_dump($blob->import(dirname(__FILE__)."/lob_009.txt")); -var_dump($blob->import()); -var_dump(oci_lob_import($blob)); -var_dump(oci_lob_import($blob, dirname(__FILE__)."/lob_009.txt")); -unset($blob->descriptor); -var_dump(oci_lob_import($blob, dirname(__FILE__)."/lob_009.txt")); -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -var_dump($row = oci_fetch_array($s)); - -while (!$row[0]->eof()) { - var_dump($row[0]->read(1024)); -} - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) -} -bool(true) -bool(true) - -Warning: OCI-Lob::import() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: oci_lob_import() expects exactly 2 parameters, 1 given in %s on line %d -NULL -bool(true) - -Warning: oci_lob_import(): Unable to find descriptor property in %s on line %d -bool(false) -array(2) { - [0]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } - ["BLOB"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } -} -string(43) "this -is -a -test -file for -test lob_009.phpt -" -Done diff --git a/ext/oci8/tests/lob_024.phpt b/ext/oci8/tests/lob_024.phpt deleted file mode 100644 index 9a7f53240d..0000000000 --- a/ext/oci8/tests/lob_024.phpt +++ /dev/null @@ -1,75 +0,0 @@ ---TEST-- -oci_lob_load() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -var_dump($blob); - -var_dump($blob->size()); -var_dump($blob->write(str_repeat("string.", 1000))); -var_dump($blob->size()); -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -var_dump($row = oci_fetch_array($s)); - -var_dump(strlen($row[0]->load())); -var_dump(strlen(oci_lob_load($row[0]))); -var_dump(oci_lob_load()); -unset($row[0]->descriptor); -var_dump(oci_lob_load($row[0])); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) -} -int(0) -int(7000) -int(7000) -array(2) { - [0]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } - ["BLOB"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } -} -int(7000) -int(7000) - -Warning: oci_lob_load() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: oci_lob_load(): Unable to find descriptor property in %s on line %d -bool(false) -Done diff --git a/ext/oci8/tests/lob_025.phpt b/ext/oci8/tests/lob_025.phpt deleted file mode 100644 index 5b5e845a7a..0000000000 --- a/ext/oci8/tests/lob_025.phpt +++ /dev/null @@ -1,82 +0,0 @@ ---TEST-- -oci_lob_read() tests ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -var_dump($blob->size()); -var_dump($blob->write(str_repeat("string.", 1000))); -var_dump($blob->size()); -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -var_dump($row = oci_fetch_array($s)); - -var_dump(oci_lob_read($row[0], 2)); -var_dump(oci_lob_read($row[0])); -var_dump(oci_lob_read()); -var_dump(oci_lob_eof($row[0])); -var_dump(oci_lob_eof()); - -unset($row[0]->descriptor); -var_dump(oci_lob_read($row[0],1)); -var_dump(oci_lob_eof($row[0])); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -int(0) -int(7000) -int(7000) -array(2) { - [0]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } - ["BLOB"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } -} -string(2) "st" - -Warning: oci_lob_read() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: oci_lob_read() expects exactly 2 parameters, 0 given in %s on line %d -NULL -bool(false) - -Warning: oci_lob_eof() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: oci_lob_read(): Unable to find descriptor property in %s on line %d -bool(false) - -Warning: oci_lob_eof(): Unable to find descriptor property in %s on line %d -bool(false) -Done diff --git a/ext/oci8/tests/lob_026.phpt b/ext/oci8/tests/lob_026.phpt deleted file mode 100644 index 157d78a2b6..0000000000 --- a/ext/oci8/tests/lob_026.phpt +++ /dev/null @@ -1,100 +0,0 @@ ---TEST-- -oci_lob_seek()/rewind()/append() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$schema.$table_name." (blob) - VALUES (empty_blob()) - RETURNING - blob - INTO :v_blob "; - -$statement = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($statement, OCI_DEFAULT); - -var_dump($blob); - -var_dump(oci_lob_write($blob, "test")); -var_dump(oci_lob_rewind()); -var_dump(oci_lob_rewind($blob)); -var_dump(oci_lob_write($blob, "str")); -var_dump(oci_lob_seek(10, OCI_SEEK_SET)); -var_dump(oci_lob_seek($blob, 10, OCI_SEEK_SET)); - -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -var_dump($row = oci_fetch_array($s)); - -var_dump(oci_lob_append()); -var_dump(oci_lob_append($blob)); -var_dump(oci_lob_append($row[0], $blob)); -var_dump(oci_lob_read(10000)); -var_dump(oci_lob_read($row[0], 10000)); - -oci_commit($c); - -$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; -$s = oci_parse($c, $select_sql); -oci_execute($s, OCI_DEFAULT); - -$row = oci_fetch_array($s); - -var_dump(oci_lob_read($row[0], 10000)); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECTF-- -object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) -} -int(4) - -Warning: oci_lob_rewind() expects exactly 1 parameter, 0 given in %s on line %d -NULL -bool(true) -int(3) - -Warning: oci_lob_seek() expects parameter 1 to be OCI-Lob, integer given in %s on line %d -NULL -bool(true) -array(2) { - [0]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } - ["BLOB"]=> - object(OCI-Lob)#%d (1) { - ["descriptor"]=> - resource(%d) of type (oci8 descriptor) - } -} - -Warning: oci_lob_append() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: oci_lob_append() expects exactly 2 parameters, 1 given in %s on line %d -NULL -bool(true) - -Warning: oci_lob_read() expects exactly 2 parameters, 1 given in %s on line %d -NULL -string(4) "strt" -string(8) "strtstrt" -Done diff --git a/ext/oci8/tests/lob_temp.phpt b/ext/oci8/tests/lob_temp.phpt deleted file mode 100644 index cad2d39058..0000000000 --- a/ext/oci8/tests/lob_temp.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -temporary lobs ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$blob = oci_new_descriptor($c,OCI_D_LOB); -var_dump($blob->writeTemporary("test")); -var_dump($blob->load()); -var_dump($blob->seek(0, SEEK_SET)); -var_dump($blob->read(2)); - -$c = oci_pconnect($user, $password, $dbase); - -$blob = oci_new_descriptor($c,OCI_D_LOB); -var_dump($blob->writeTemporary("test")); -var_dump($blob->load()); -var_dump($blob->seek(0, SEEK_SET)); -var_dump($blob->read(2)); - -echo "Done\n"; - -?> ---EXPECTF-- -bool(true) -string(4) "test" -bool(true) -string(2) "te" -bool(true) -string(4) "test" -bool(true) -string(2) "te" -Done diff --git a/ext/oci8/tests/lob_temp1.phpt b/ext/oci8/tests/lob_temp1.phpt deleted file mode 100644 index 2482d65f64..0000000000 --- a/ext/oci8/tests/lob_temp1.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -closing temporary lobs ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -$blob = oci_new_descriptor($c,OCI_D_LOB); -var_dump($blob->writeTemporary("test")); -var_dump($blob->load()); -var_dump($blob->close()); - -$c = oci_pconnect($user, $password, $dbase); - -$blob = oci_new_descriptor($c,OCI_D_LOB); -var_dump($blob->writeTemporary("test")); -var_dump($blob->load()); -var_dump($blob->close()); - -echo "Done\n"; - -?> ---EXPECTF-- -bool(true) -string(4) "test" -bool(true) -bool(true) -string(4) "test" -bool(true) -Done diff --git a/ext/oci8/tests/num.phpt b/ext/oci8/tests/num.phpt deleted file mode 100644 index 3c333b4e3a..0000000000 --- a/ext/oci8/tests/num.phpt +++ /dev/null @@ -1,66 +0,0 @@ ---TEST-- -oci_num_*() family ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema.$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} - -var_dump(ocirowcount($s)); -var_dump(oci_num_rows($s)); -var_dump(ocinumcols($s)); -var_dump(oci_num_fields($s)); - -$delete_sql = "DELETE FROM ".$schema.$table_name.""; - -if (!($s = oci_parse($c, $delete_sql))) { - die("oci_parse(delete) failed!\n"); -} - -if (!oci_execute($s)) { - die("oci_execute(delete) failed!\n"); -} -oci_commit($c); - -var_dump(oci_num_rows($s)); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; - -?> ---EXPECT-- -int(0) -int(0) -int(5) -int(5) -int(3) -Done diff --git a/ext/oci8/tests/oci_execute_segfault.phpt b/ext/oci8/tests/oci_execute_segfault.phpt deleted file mode 100644 index 3859f4ffe0..0000000000 --- a/ext/oci8/tests/oci_execute_segfault.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -oci_execute() segfault after repeated bind ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; -require dirname(__FILE__).'/create_table.inc'; - -$ora_sql = "INSERT INTO - ".$table_name." (blob, clob) - VALUES (empty_blob(), empty_clob()) - RETURNING - blob - INTO :v_blob "; - -$s = oci_parse($c,$ora_sql); -$blob = oci_new_descriptor($c,OCI_D_LOB); -oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($s); - -oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB); -oci_execute($s); - -echo "Done\n"; - -?> ---EXPECT-- -Done diff --git a/ext/oci8/tests/old_oci_close.phpt b/ext/oci8/tests/old_oci_close.phpt deleted file mode 100644 index f15b7febea..0000000000 --- a/ext/oci8/tests/old_oci_close.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -oci8.old_oci_close_semantics On ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---INI-- -oci8.old_oci_close_semantics=1 ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -var_dump($c); -var_dump(oci_close($c)); -var_dump(oci_parse($c, "select 1 from dual")); - -echo "Done\n"; - -?> ---EXPECTF-- -resource(%d) of type (oci8 connection) -NULL -resource(%d) of type (oci8 statement) -Done diff --git a/ext/oci8/tests/old_oci_close1.phpt b/ext/oci8/tests/old_oci_close1.phpt deleted file mode 100644 index 9af2eeb398..0000000000 --- a/ext/oci8/tests/old_oci_close1.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -oci8.old_oci_close_semantics Off ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---INI-- -oci8.old_oci_close_semantics=0 ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -var_dump($c); -var_dump(oci_close($c)); -var_dump(oci_parse($c, "select 1 from dual")); - -echo "Done\n"; - -?> ---EXPECTF-- -resource(%d) of type (oci8 connection) -bool(true) - -Warning: oci_parse() expects parameter 1 to be resource, null given in %s on line %d -NULL -Done diff --git a/ext/oci8/tests/password.phpt b/ext/oci8/tests/password.phpt deleted file mode 100644 index a31843cfd0..0000000000 --- a/ext/oci8/tests/password.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -oci_password_change() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$new_password = "test"; -var_dump(oci_password_change($dbase, $user, $password, $new_password)); - -if (!empty($dbase)) { - var_dump($new_c = ocilogon($user,$new_password,$dbase)); -} -else { - var_dump($new_c = ocilogon($user,$new_password)); -} - -var_dump(oci_password_change($dbase, $user, $new_password, $password)); - - -echo "Done\n"; - -?> ---EXPECTF-- -resource(%d) of type (oci8 connection) -resource(%d) of type (oci8 connection) -resource(%d) of type (oci8 connection) -Done diff --git a/ext/oci8/tests/password_new.phpt b/ext/oci8/tests/password_new.phpt deleted file mode 100644 index a31843cfd0..0000000000 --- a/ext/oci8/tests/password_new.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -oci_password_change() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$new_password = "test"; -var_dump(oci_password_change($dbase, $user, $password, $new_password)); - -if (!empty($dbase)) { - var_dump($new_c = ocilogon($user,$new_password,$dbase)); -} -else { - var_dump($new_c = ocilogon($user,$new_password)); -} - -var_dump(oci_password_change($dbase, $user, $new_password, $password)); - - -echo "Done\n"; - -?> ---EXPECTF-- -resource(%d) of type (oci8 connection) -resource(%d) of type (oci8 connection) -resource(%d) of type (oci8 connection) -Done diff --git a/ext/oci8/tests/password_old.phpt b/ext/oci8/tests/password_old.phpt deleted file mode 100644 index d293fce870..0000000000 --- a/ext/oci8/tests/password_old.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -ocipasswordchange() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$new_password = "test"; -var_dump(ocipasswordchange($c, $user, $password, $new_password)); - -if (!empty($dbase)) { - var_dump($new_c = ocilogon($user,$new_password,$dbase)); -} -else { - var_dump($new_c = ocilogon($user,$new_password)); -} - -var_dump(ocipasswordchange($new_c, $user, $new_password, $password)); - - -echo "Done\n"; - -?> ---EXPECTF-- -bool(true) -resource(%d) of type (oci8 connection) -bool(true) -Done diff --git a/ext/oci8/tests/pecl_bug8816.phpt b/ext/oci8/tests/pecl_bug8816.phpt deleted file mode 100644 index c369711fcf..0000000000 --- a/ext/oci8/tests/pecl_bug8816.phpt +++ /dev/null @@ -1,98 +0,0 @@ ---TEST-- -PECL Bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column) ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$create_1 = "CREATE TABLE t1 (id INTEGER, l1 LONG)"; -$create_2 = "CREATE TABLE t2 (id INTEGER, l2 LONG)"; -$drop_1 = "DROP TABLE t1"; -$drop_2 = "DROP TABLE t2"; - -$s1 = oci_parse($c, $drop_1); -$s2 = oci_parse($c, $drop_2); -@oci_execute($s1); -@oci_execute($s2); - -$s1 = oci_parse($c, $create_1); -$s2 = oci_parse($c, $create_2); -oci_execute($s1); -oci_execute($s2); - -$values = array("1234567890111111111", "122222222222222", "985456745674567654567654567654", "123456789", "987654321"); - -$i = 0; -foreach ($values as $val) { - $i++; - $insert = "INSERT INTO t1 VALUES($i, ".$val.")"; - $s = oci_parse($c, $insert); - oci_execute($s); -} - -foreach ($values as $val) { - $insert = "INSERT INTO t2 VALUES($i, ".$val.")"; - $s = oci_parse($c, $insert); - oci_execute($s); - $i--; -} - -$query =" -SELECT - t1.l1, t2.l2 -FROM -t1, t2 -WHERE -t1.id = t2.id -ORDER BY t1.id ASC -"; - -$sth = oci_parse($c, $query); -oci_execute($sth); - -while ( $row = oci_fetch_assoc($sth) ) { - var_dump($row); -} - -$s1 = oci_parse($c, $drop_1); -$s2 = oci_parse($c, $drop_2); -@oci_execute($s1); -@oci_execute($s2); - -echo "Done\n"; - -?> ---EXPECT-- -array(2) { - ["L1"]=> - string(19) "1234567890111111111" - ["L2"]=> - string(9) "987654321" -} -array(2) { - ["L1"]=> - string(15) "122222222222222" - ["L2"]=> - string(9) "123456789" -} -array(2) { - ["L1"]=> - string(30) "985456745674567654567654567654" - ["L2"]=> - string(30) "985456745674567654567654567654" -} -array(2) { - ["L1"]=> - string(9) "123456789" - ["L2"]=> - string(15) "122222222222222" -} -array(2) { - ["L1"]=> - string(9) "987654321" - ["L2"]=> - string(19) "1234567890111111111" -} -Done diff --git a/ext/oci8/tests/persistent.phpt b/ext/oci8/tests/persistent.phpt deleted file mode 100644 index 884cd35a4c..0000000000 --- a/ext/oci8/tests/persistent.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -reusing persistent connections ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -var_dump(oci_pconnect($user, $password, $dbase)); -var_dump(oci_pconnect($user, $password, $dbase)); -var_dump(oci_pconnect($user, $password, $dbase)); -var_dump(oci_connect($user, $password, $dbase)); -var_dump(oci_connect($user, $password, $dbase)); -var_dump(oci_connect($user, $password, $dbase)); - -echo "Done\n"; -?> ---EXPECTF-- -resource(%d) of type (oci8 persistent connection) -resource(%d) of type (oci8 persistent connection) -resource(%d) of type (oci8 persistent connection) -resource(%d) of type (oci8 connection) -resource(%d) of type (oci8 connection) -resource(%d) of type (oci8 connection) -Done diff --git a/ext/oci8/tests/prefetch.phpt b/ext/oci8/tests/prefetch.phpt deleted file mode 100644 index fa4b8fdc60..0000000000 --- a/ext/oci8/tests/prefetch.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -oci_set_prefetch() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } -} - -if (!oci_commit($c)) { - die("oci_commit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema.$table_name.""; - -if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); -} - -var_dump(oci_set_prefetch($s, 10)); - -if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); -} - -var_dump(oci_fetch($s)); - -var_dump(oci_num_rows($s)); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECT-- -bool(true) -bool(true) -int(1) -Done diff --git a/ext/oci8/tests/prefetch_old.phpt b/ext/oci8/tests/prefetch_old.phpt deleted file mode 100644 index cb9cb390e6..0000000000 --- a/ext/oci8/tests/prefetch_old.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -ocisetprefetch() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; -require dirname(__FILE__).'/create_table.inc'; - -$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; - -if (!($s = ociparse($c, $insert_sql))) { - die("ociparse(insert) failed!\n"); -} - -for ($i = 0; $i<3; $i++) { - if (!ociexecute($s)) { - die("ociexecute(insert) failed!\n"); - } -} - -if (!ocicommit($c)) { - die("ocicommit() failed!\n"); -} - -$select_sql = "SELECT * FROM ".$schema.$table_name.""; - -if (!($s = ociparse($c, $select_sql))) { - die("ociparse(select) failed!\n"); -} - -var_dump(ocisetprefetch($s, 10)); - -if (!ociexecute($s)) { - die("ociexecute(select) failed!\n"); -} - -var_dump(ocifetch($s)); - -var_dump(ocirowcount($s)); - -require dirname(__FILE__).'/drop_table.inc'; - -echo "Done\n"; -?> ---EXPECT-- -bool(true) -bool(true) -int(1) -Done diff --git a/ext/oci8/tests/privileged_connect.phpt b/ext/oci8/tests/privileged_connect.phpt deleted file mode 100644 index 39122240a7..0000000000 --- a/ext/oci8/tests/privileged_connect.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -privileged connect tests ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -oci_connect("", "", "", false, OCI_SYSOPER); -oci_connect("", "", "", false, OCI_SYSDBA); -oci_connect("", "", "", false, -1); -oci_connect("", "", "", false, "qwe"); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_connect(): Privileged connect is disabled. Enable oci8.privileged_connect to be able to connect as SYSOPER or SYSDBA in %s on line %d - -Warning: oci_connect(): Privileged connect is disabled. Enable oci8.privileged_connect to be able to connect as SYSOPER or SYSDBA in %s on line %d - -Warning: oci_connect(): Invalid session mode specified (-1) in %s on line %d - -Warning: oci_connect() expects parameter 5 to be long, string given in %s on line %d -Done diff --git a/ext/oci8/tests/privileged_connect1.phpt b/ext/oci8/tests/privileged_connect1.phpt deleted file mode 100644 index a05a21093a..0000000000 --- a/ext/oci8/tests/privileged_connect1.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -privileged connect tests ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---INI-- -oci8.privileged_connect=1 ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -oci_connect("", "", "", false, OCI_SYSOPER); -oci_connect("", "", "", false, OCI_SYSDBA); -oci_connect("", "", "", false, -1); -oci_connect("", "", "", false, "qwe"); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d - -Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d - -Warning: oci_connect(): Invalid session mode specified (-1) in %s on line %d - -Warning: oci_connect() expects parameter 5 to be long, string given in %s on line %d -Done diff --git a/ext/oci8/tests/select_null.phpt b/ext/oci8/tests/select_null.phpt deleted file mode 100644 index 87c5b815fd..0000000000 --- a/ext/oci8/tests/select_null.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -SELECTing NULL values ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$pc = oci_pconnect($user, $password, $dbase); - -$stmt = oci_parse($pc, "select NULL from dual"); -oci_execute($stmt); -var_dump(oci_fetch_array($stmt, OCI_RETURN_NULLS)); - -echo "Done\n"; -?> ---EXPECT-- -array(2) { - [0]=> - NULL - ["NULL"]=> - NULL -} -Done diff --git a/ext/oci8/tests/serverversion.phpt b/ext/oci8/tests/serverversion.phpt deleted file mode 100644 index bf32fe4b54..0000000000 --- a/ext/oci8/tests/serverversion.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -oci_server_version() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -if (!empty($dbase)) { - var_dump($c = oci_connect($user, $password, $dbase)); -} -else { - var_dump($c = oci_connect($user, $password)); -} - -$v = oci_server_version($c); -var_dump(str_replace("\n", "", $v)); - -$v = ociserverversion($c); -var_dump(str_replace("\n", "", $v)); - -echo "Done\n"; - -?> ---EXPECTF-- -resource(%d) of type (oci8 connection) -string(%d) "%s" -string(%d) "%s" -Done diff --git a/ext/oci8/tests/skipif.inc b/ext/oci8/tests/skipif.inc deleted file mode 100644 index ed0992c8d9..0000000000 --- a/ext/oci8/tests/skipif.inc +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -if (!extension_loaded('oci8')) die("skip oci8 extension is not available\n"); - -/* - * Remove or comment this line to run tests - * - * */ -die("skip change default login/password\n"); -?> diff --git a/ext/oci8/tests/statement_cache.phpt b/ext/oci8/tests/statement_cache.phpt deleted file mode 100644 index 19e69d4c21..0000000000 --- a/ext/oci8/tests/statement_cache.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -statement cache ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$pc = oci_pconnect($user, $password, $dbase); - -$stmt = oci_parse($pc, "select 1+3 from dual"); -oci_execute($stmt); -var_dump(oci_fetch_array($stmt)); - -$stmt = oci_parse($pc, "select 1+3 from dual"); -oci_execute($stmt); -var_dump(oci_fetch_array($stmt)); - -echo "Done\n"; -?> ---EXPECTF-- -array(2) { - [0]=> - string(1) "4" - ["1+3"]=> - string(1) "4" -} -array(2) { - [0]=> - string(1) "4" - ["1+3"]=> - string(1) "4" -} -Done diff --git a/ext/oci8/tests/statement_type.phpt b/ext/oci8/tests/statement_type.phpt deleted file mode 100644 index 45221a6c77..0000000000 --- a/ext/oci8/tests/statement_type.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -oci_statement_type() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -if (!empty($dbase)) { - var_dump($c = oci_connect($user, $password, $dbase)); -} -else { - var_dump($c = oci_connect($user, $password)); -} - -$sqls = Array( - "SELECT * FROM table", - "DELETE FROM table WHERE id = 1", - "INSERT INTO table VALUES(1)", - "UPDATE table SET id = 1", - "DROP TABLE table", - "CREATE TABLE table (id NUMBER)", - "WRONG SYNTAX", - "" -); - -foreach ($sqls as $sql) { - $s = oci_parse($c, $sql); - var_dump(oci_statement_type($s)); -} - -echo "Done\n"; - -?> ---EXPECTF-- -resource(%d) of type (oci8 connection) -string(6) "SELECT" -string(6) "DELETE" -string(6) "INSERT" -string(6) "UPDATE" -string(4) "DROP" -string(6) "CREATE" -string(7) "UNKNOWN" -string(7) "UNKNOWN" -Done diff --git a/ext/oci8/tests/statement_type_old.phpt b/ext/oci8/tests/statement_type_old.phpt deleted file mode 100644 index 13da41bf76..0000000000 --- a/ext/oci8/tests/statement_type_old.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -ocistatementtype() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -if (!empty($dbase)) { - var_dump($c = ocilogon($user, $password, $dbase)); -} -else { - var_dump($c = ocilogon($user, $password)); -} - -$sqls = Array( - "SELECT * FROM table", - "DELETE FROM table WHERE id = 1", - "INSERT INTO table VALUES(1)", - "UPDATE table SET id = 1", - "DROP TABLE table", - "CREATE TABLE table (id NUMBER)", - "WRONG SYNTAX", - "" -); - -foreach ($sqls as $sql) { - $s = ociparse($c, $sql); - var_dump(ocistatementtype($s)); -} - -echo "Done\n"; - -?> ---EXPECTF-- -resource(%d) of type (oci8 connection) -string(6) "SELECT" -string(6) "DELETE" -string(6) "INSERT" -string(6) "UPDATE" -string(4) "DROP" -string(6) "CREATE" -string(7) "UNKNOWN" -string(7) "UNKNOWN" -Done diff --git a/ext/oci8/tests/test.gif b/ext/oci8/tests/test.gif Binary files differdeleted file mode 100644 index f352c7308f..0000000000 --- a/ext/oci8/tests/test.gif +++ /dev/null diff --git a/ext/oci8/tests/test.txt b/ext/oci8/tests/test.txt deleted file mode 100644 index fa9e8d2c2f..0000000000 --- a/ext/oci8/tests/test.txt +++ /dev/null @@ -1,9 +0,0 @@ -Feel so good, I feel so fine -Love that little lady always on my mind -She gives me loving every night and day -Never gonna leave her, never going away - -Someone to love me -You know she makes me feel all right, yeah (all right) -Someone to need me -Love me every single night, yeah diff --git a/ext/oci8/tests/uncommitted.phpt b/ext/oci8/tests/uncommitted.phpt deleted file mode 100644 index 3c341c8cb4..0000000000 --- a/ext/oci8/tests/uncommitted.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -uncommitted connection ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require dirname(__FILE__)."/connect.inc"; - -$stmt = oci_parse($c, "select 1 from dual"); -oci_execute($stmt, OCI_DEFAULT); - -echo "Done\n"; -?> ---EXPECTF-- -Done |