Removed ext/oci8 and ext/pdo_oci (#13327)

* Removed ext/oci8 and ext/pdo_oci

They now live in their own repositories:

https://github.com/php/pecl-database-oci8
https://github.com/php/pecl-database-pdo_oci

As per: https://wiki.php.net/rfc/unbundle_imap_pspell_oci8
This commit is contained in:
Derick Rethans 2024-02-07 15:34:39 +00:00 committed by GitHub
parent c149b4f56f
commit a4d64b2605
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
419 changed files with 1 additions and 54786 deletions

View file

@ -149,8 +149,6 @@ jobs:
--with-snmp \
`#--with-unixODBC` \
`#--with-pdo-odbc=unixODBC,/usr` \
`#--with-pdo-oci=shared,instantclient,/opt/oracle/instantclient` \
`#--with-oci8=shared,instantclient,/opt/oracle/instantclient` \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--with-pdo-firebird \

View file

@ -73,8 +73,6 @@ runs:
${{ inputs.skipSlow == 'false' && '--with-snmp' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-unixODBC' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-pdo-odbc=unixODBC,/usr' || '' }} \
$([ -d "/opt/oracle/instantclient" ] && echo '--with-pdo-oci=shared,instantclient,/opt/oracle/instantclient') \
$([ -d "/opt/oracle/instantclient" ] && echo '--with-oci8=shared,instantclient,/opt/oracle/instantclient') \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
${{ inputs.skipSlow == 'false' && '--with-pdo-firebird' || '' }} \

View file

@ -1,30 +0,0 @@
name: Create Oracle container
runs:
using: composite
steps:
- shell: bash
run: |
set -x
docker run \
-e "ORACLE_PASSWORD=pass" \
-p 1521:1521 \
--name oracle \
-h oracle \
-d gvenzl/oracle-xe:slim
mkdir /opt/oracle
wget -nv https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip
unzip instantclient-basiclite-linuxx64.zip && rm instantclient-basiclite-linuxx64.zip
wget -nv https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip
unzip instantclient-sdk-linuxx64.zip && rm instantclient-sdk-linuxx64.zip
mv instantclient_*_* /opt/oracle/instantclient
# interferes with libldap2 headers
rm /opt/oracle/instantclient/sdk/include/ldap.h
# fix debug build warning: zend_signal: handler was replaced for signal (2) after startup
echo DISABLE_INTERRUPT=on > /opt/oracle/instantclient/network/admin/sqlnet.ora
sudo sh -c 'echo /opt/oracle/instantclient >/etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig'
sudo mkdir -p /etc/php.d
sudo chmod 777 /etc/php.d
echo extension=oci8.so > /etc/php.d/oci8.ini
echo extension=pdo_oci.so > /etc/php.d/pdo_oci.ini

6
.github/labeler.yml vendored
View file

@ -95,9 +95,6 @@
"Extension: mysqlnd":
- ext/mysqlnd/**/*
"Extension: oci8":
- ext/oci8/**/*
"Extension: odbc":
- ext/odbc/**/*
@ -125,9 +122,6 @@
"Extension: pdo_mysql":
- ext/pdo_mysql/**/*
"Extension: pdo_oci":
- ext/pdo_oci/**/*
"Extension: pdo_odbc":
- ext/pdo_odbc/**/*

View file

@ -78,8 +78,6 @@ jobs:
ref: ${{ matrix.branch.ref }}
- name: Create MSSQL container
uses: ./.github/actions/setup-mssql
- name: Create Oracle container
uses: ./.github/actions/setup-oracle
- name: apt
uses: ./.github/actions/apt-x64
- name: System info

View file

@ -103,9 +103,6 @@ jobs:
- name: Create MSSQL container
if: ${{ !matrix.asan }}
uses: ./.github/actions/setup-mssql
- name: Create Oracle container
if: ${{ !matrix.asan }}
uses: ./.github/actions/setup-oracle
- name: Setup Caddy server
uses: ./.github/actions/setup-caddy
- name: ccache

2
.gitignore vendored
View file

@ -277,8 +277,6 @@ tmp-php.ini
# ------------------------------------------------------------------------------
# Generated by `./configure --enable-dtrace` for using DTrace framework
# ------------------------------------------------------------------------------
/ext/oci8/oci8_dtrace_gen.h
/ext/oci8/oci8_dtrace_gen.h.bak
/Zend/zend_dtrace_gen.h
/Zend/zend_dtrace_gen.h.bak

View file

@ -93,12 +93,6 @@ MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.3
-------------------------------------------------------------------------------
EXTENSION: oci8
PRIMARY MAINTAINER: Christopher Jones <sixd@php.net> (2007 - 2017)
Antony Dovgal <tony2001@php.net> (2003 - 2009)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: odbc
PRIMARY MAINTAINER: Daniel R. Kalowsky <kalowsky@php.net> (2000 - 2004)
MAINTENANCE: Maintained
@ -139,12 +133,6 @@ MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_oci
PRIMARY MAINTAINER: Christopher Jones <sixd@php.net> (2007 - 2017)
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_pgsql
PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net> (2004 - 2011)
MAINTENANCE: Odd fixes

View file

@ -308,14 +308,6 @@ static const func_info_t func_infos[] = {
F1("mysqli_stat", MAY_BE_STRING|MAY_BE_FALSE),
F1("mysqli_store_result", MAY_BE_OBJECT|MAY_BE_FALSE),
F1("mysqli_use_result", MAY_BE_OBJECT|MAY_BE_FALSE),
FN("oci_new_connect", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_connect", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_pconnect", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("oci_error", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
FN("oci_parse", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_get_implicit_resultset", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_password_change", MAY_BE_RESOURCE|MAY_BE_BOOL),
FN("oci_new_cursor", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_prepare", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_exec", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_connect", MAY_BE_RESOURCE|MAY_BE_FALSE),

View file

@ -128,7 +128,7 @@ clean:
distclean: clean
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h
rm -f main/build-defs.h scripts/phpize
rm -f ext/date/lib/timelib_config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
rm -f ext/date/lib/timelib_config.h ext/mbstring/libmbfl/config.h
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 sapi/phpdbg/phpdbg.1 ext/phar/phar.1 ext/phar/phar.phar.1
rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html
rm -f ext/phar/phar.phar ext/phar/phar.php

View file

@ -1843,24 +1843,6 @@ X
fi
fi
dnl Warn about Apache if oci8 extension is enabled on Linux.
if test "$PHP_OCI8" != "no"; then
if test "$PHP_SIGCHILD" != "yes"; then
if test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
cat <<X
+--------------------------------------------------------------------+
| Notice: |
| If you encounter <defunc> processes when using a local Oracle |
| database, set the value BEQUEATH_DETACH=YES in Oracle Net's |
| sqlnet.ora file on the PHP host, or set the environment variable |
| BEQUEATH_DETACH to YES before starting Apache. If the problem |
| still occurs, then recompile PHP and specify --enable-sigchild |
| when configuring. |
X
fi
fi
fi
fi
])
AC_OUTPUT

View file

@ -1,2 +0,0 @@
OCI8
Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson, Maxim Maletsky, Harald Radi, Antony Dovgal, Andi Gutmans, Wez Furlong, Christopher Jones, Oracle Corporation

View file

@ -1,68 +0,0 @@
--------------------------------------------------------------------
The PHP License, version 3.01
Copyright (c) 1999 - 2024 The PHP Group. All rights reserved.
--------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, is permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The name "PHP" must not be used to endorse or promote products
derived from this software without prior written permission. For
written permission, please contact group@php.net.
4. Products derived from this software may not be called "PHP", nor
may "PHP" appear in their name, without prior written permission
from group@php.net. You may indicate that your software works in
conjunction with PHP by saying "Foo for PHP" instead of calling
it "PHP Foo" or "phpfoo"
5. The PHP Group may publish revised and/or new versions of the
license from time to time. Each version will be given a
distinguishing version number.
Once covered code has been published under a particular version
of the license, you may always continue to use it under the terms
of that version. You may also choose to use such covered code
under the terms of any subsequent version of the license
published by the PHP Group. No one other than the PHP Group has
the right to modify the terms applicable to covered code created
under this License.
6. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes PHP software, freely available from
<http://www.php.net/software/>".
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------
This software consists of voluntary contributions made by many
individuals on behalf of the PHP Group.
The PHP Group can be contacted via Email at group@php.net.
For more information on the PHP Group and the PHP project,
please see <http://www.php.net>.
PHP includes the Zend Engine, freely available at
<http://www.zend.com>.

View file

@ -1,25 +0,0 @@
# The OCI8 Extension
Use the OCI8 extension to access Oracle Database.
Documentation is at https://www.php.net/oci8
Use `pecl install oci8` to install for PHP 8.2.
Use `pecl install oci8-3.2.1` to install for PHP 8.1.
Use `pecl install oci8-3.0.1` to install for PHP 8.0.
Use `pecl install oci8-2.2.0` to install for PHP 7.
The OCI8 extension can be linked with Oracle client libraries from Oracle
Database 11.2 or later. These libraries are found in your database
installation, or in the free Oracle Instant Client from
https://www.oracle.com/database/technologies/instant-client.html
Install the 'Basic' or 'Basic Light' Instant Client package. If building from
source, then also install the SDK package.
Oracle's standard cross-version connectivity applies. For example, PHP OCI8
linked with Instant Client 19c can connect to Oracle Database 11.2 onward. See
Oracle's note "Oracle Client / Server Interoperability Support" (ID 207303.1)
for details.

View file

@ -1,434 +0,0 @@
if test -z "$SED"; then
PHP_OCI8_SED="sed";
else
PHP_OCI8_SED="$SED";
fi
PHP_OCI8_TAIL1=`echo a | tail -n1 2>/dev/null`
if test "$PHP_OCI8_TAIL1" = "a"; then
PHP_OCI8_TAIL1="tail -n1"
else
PHP_OCI8_TAIL1="tail -1"
fi
AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[
AC_MSG_CHECKING([ORACLE_HOME library validity])
if test ! -d "$OCI8_DIR"; then
AC_MSG_ERROR([${OCI8_DIR} is not a directory])
fi
if test -d "$OCI8_DIR/lib" && test ! -d "$OCI8_DIR/lib32"; then
OCI8_LIB_DIR=lib
elif test ! -d "$OCI8_DIR/lib" && test -d "$OCI8_DIR/lib32"; then
OCI8_LIB_DIR=lib32
elif test -d "$OCI8_DIR/lib" && test -d "$OCI8_DIR/lib32"; then
OCI8_LIB_DIR=$PHP_OCI8_OH_LIBDIR
else
dnl This isn't an ORACLE_HOME. Try heuristic examination of the dir to help
dnl the user.
if test -f "$OCI8_DIR/libociei.$SHLIB_SUFFIX_NAME"; then
AC_MSG_ERROR([Expected an ORACLE_HOME top level directory but ${OCI8_DIR} appears to be an Instant Client directory. Try --with-oci8=instantclient,${OCI8_DIR}])
else
AC_MSG_ERROR([Oracle library directory not found in ${OCI8_DIR}])
fi
fi
AC_MSG_RESULT($OCI8_LIB_DIR)
])
AC_DEFUN([AC_OCI8IC_VERSION],[
AC_MSG_CHECKING([Oracle Instant Client library version compatibility])
OCI8_LCS_BASE=$PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME
dnl Oracle 10g, 11g etc
OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | $PHP_OCI8_TAIL1`
OCI8_NNZ=`ls $PHP_OCI8_INSTANT_CLIENT/libnnz*.$SHLIB_SUFFIX_NAME 2> /dev/null | $PHP_OCI8_TAIL1`
if test -f "$OCI8_NNZ" && test -f "$OCI8_LCS"; then
if test ! -f "$OCI8_LCS_BASE"; then
AC_MSG_ERROR([Link from $OCI8_LCS_BASE to $OCI8_LCS_BASE.*.1 not found])
fi
OCI8_ORACLE_VERSION=`echo $OCI8_LCS | $PHP_OCI8_SED -e 's/.*\.\(.*\)\.1$/\1.1/'`
else
AC_MSG_ERROR([Oracle Instant Client libraries libnnz.$SHLIB_SUFFIX_NAME and libclntsh.$SHLIB_SUFFIX_NAME not found])
fi
AC_MSG_RESULT([$OCI8_ORACLE_VERSION])
])
AC_DEFUN([AC_OCI8_ORACLE_VERSION],[
AC_MSG_CHECKING([Oracle library version compatibility])
OCI8_LCS_BASE=$OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME
dnl Oracle 10g, 11g etc
OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | $PHP_OCI8_TAIL1`
if test -s "$OCI8_DIR/orainst/unix.rgs"; then
OCI8_ORACLE_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | $PHP_OCI8_SED 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
test -z "$OCI8_ORACLE_VERSION" && OCI8_ORACLE_VERSION=7.3
elif test -f "$OCI8_LCS"; then
dnl Oracle 10g, 11g etc. The x.2 version libraries are named x.1 for drop in
dnl compatibility
OCI8_ORACLE_VERSION=`echo $OCI8_LCS | $PHP_OCI8_SED -e 's/.*\.\(.*\)\.1$/\1.1/'`
elif test -f $OCI8_LCS_BASE.9.0; then
dnl There is no case for Oracle 9.2. Oracle 9.2 libraries have a 9.0 suffix
dnl for drop-in compatibility with Oracle 9.0
OCI8_ORACLE_VERSION=9.0
elif test -f $OCI8_LCS_BASE.8.0; then
OCI8_ORACLE_VERSION=8.1
elif test -f $OCI8_LCS_BASE.1.0; then
OCI8_ORACLE_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_ORACLE_VERSION=8.0
else
OCI8_ORACLE_VERSION=8.1
fi
else
AC_MSG_ERROR(Oracle libclntsh.$SHLIB_SUFFIX_NAME client library not found)
fi
AC_MSG_RESULT($OCI8_ORACLE_VERSION)
])
dnl
dnl OCI8_INIT_DTRACE(providerdesc, header-file, sources)
dnl This mimics PHP_INIT_DTRACE from build/php.m4. It is necessarily different
dnl from PHP_INIT_DTRACE which doesn't currently support DTrace for extensions.
dnl Creating OCI8_INIT_DTRACE independently instead of using a refactored
dnl PHP_INIT_DTRACE allows OCI8 to be DTraced on versions of PHP where core PHP
dnl DTrace support isn't available.
dnl
AC_DEFUN([OCI8_INIT_DTRACE],[
ac_srcdir=[]PHP_EXT_SRCDIR([oci8])/
ac_bdir=[]PHP_EXT_BUILDDIR([oci8])/
dnl providerdesc
ac_provsrc=$1
dnl header-file
ac_hdrobj=$2
dnl DTrace objects
old_IFS=[$]IFS
for ac_src in $3; do
IFS=.
set $ac_src
ac_obj=[$]1
IFS=$old_IFS
OCI8_DTRACE_OBJS="[$]OCI8_DTRACE_OBJS [$]ac_bdir[$]ac_obj.lo"
done;
for ac_lo in $OCI8_DTRACE_OBJS; do
dtrace_oci8_objs="[$]dtrace_oci8_objs `echo $ac_lo | $SED -e 's,\.lo$,.o,' -e 's#\(.*\)\/#\1\/.libs\/#'`"
done;
dnl Generate Makefile.objects entry. The empty $ac_provsrc command stops an
dnl implicit circular dependency in GNU Make which causes the .d file to be
dnl overwritten (Bug 61268).
cat>>Makefile.objects<<EOF
PHP_EXT_SRCDIR([oci8])/$ac_provsrc:;
$ac_bdir[$]ac_hdrobj: $ac_srcdir[$]ac_provsrc
CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHPOCI_,DTRACE_,g' \$[]@.bak > \$[]@
\$(OCI8_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj
EOF
case $host_alias in
*solaris*|*linux*)
dtrace_prov_name="`echo $ac_provsrc | $SED -e 's#\(.*\)\/##'`.o"
dtrace_lib_dir="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/[^/]*#\1#'`/.libs"
dtrace_d_obj="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/\([^/]*\)#\1/.libs/\2#'`.o"
dtrace_nolib_objs='$(OCI8_DTRACE_OBJS:.lo=.o)'
for ac_lo in $OCI8_DTRACE_OBJS; do
dtrace_oci8_lib_objs="[$]dtrace_oci8_lib_objs `echo $ac_lo | $SED -e 's,\.lo$,.o,' -e 's#\(.*\)\/#\1\/.libs\/#'`"
done;
dnl Always attempt to create both PIC and non-PIC DTrace objects (Bug 63692)
cat>>Makefile.objects<<EOF
$ac_bdir[$]ac_provsrc.lo: \$(OCI8_DTRACE_OBJS)
echo "[#] Generated by Makefile for libtool" > \$[]@
@test -d "$dtrace_lib_dir" || mkdir $dtrace_lib_dir
if CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $dtrace_d_obj -s $ac_srcdir[$]ac_provsrc $dtrace_oci8_lib_objs 2> /dev/null && test -f "$dtrace_d_obj"; then [\\]
echo "pic_object=['].libs/$dtrace_prov_name[']" >> \$[]@ [;\\]
else [\\]
echo "pic_object='none'" >> \$[]@ [;\\]
fi
if CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $ac_bdir[$]ac_provsrc.o -s $ac_srcdir[$]ac_provsrc $dtrace_nolib_objs 2> /dev/null && test -f "$ac_bdir[$]ac_provsrc.o"; then [\\]
echo "non_pic_object=[']$dtrace_prov_name[']" >> \$[]@ [;\\]
else [\\]
echo "non_pic_object='none'" >> \$[]@ [;\\]
fi
EOF
;;
*)
AC_MSG_WARN([OCI8 extension: OCI8 DTrace support is not confirmed on this platform])
cat>>Makefile.objects<<EOF
$ac_bdir[$]ac_provsrc.o: \$(OCI8_DTRACE_OBJS)
CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $ac_srcdir[$]ac_provsrc $dtrace_oci8_objs
EOF
;;
esac
])
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 Database OCI8 support],
[AS_HELP_STRING([[--with-oci8[=DIR]]],
[Include Oracle Database OCI8 support. DIR defaults to $ORACLE_HOME. Use
--with-oci8=instantclient,/path/to/instant/client/lib to use an Oracle
Instant Client installation])])
if test "$PHP_OCI8" != "no"; then
if test -z "$PHP_OCI8"; then
dnl --with-oci8=$ORACLE_HOME where ORACLE_HOME isn't set (or is mistyped)
dnl will match this case.
AC_MSG_ERROR([Empty parameter value passed to --with-oci8])
fi
dnl Check PHP version is compatible with this extension.
AC_MSG_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|$PHP_OCI8_SED -e 's#\([0-9]\.[0-9]*\.[0-9]*\)\(.*\)#\1#'`
else
php_version=`echo "$tmp_version"|$PHP_OCI8_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" -lt "5002000"; then
AC_MSG_ERROR([You need at least PHP 8.1.0 to be able to use this version of OCI8. Use OCI8 1.4 for PHP $php_version])
elif test "$oci8_php_version" -lt "7000000"; then
AC_MSG_ERROR([You need at least PHP 8.1.0 to be able to use this version of OCI8. Use OCI8 2.0 for PHP $php_version])
elif test "$oci8_php_version" -lt "8000000"; then
AC_MSG_ERROR([You need at least PHP 8.1.0 to be able to use this version of OCI8. Use OCI8 2.2 for PHP $php_version])
elif test "$oci8_php_version" -lt "8001000"; then
AC_MSG_ERROR([You need at least PHP 8.1.0 to be able to use this version of OCI8. Use OCI8 3.0 for PHP $php_version])
else
AC_MSG_RESULT([$php_version, ok])
fi
dnl Check whether --enable-dtrace was set. To use DTrace with a PECL install,
dnl extract the OCI8 archive, phpize it, and set PHP_DTRACE=yes before running
dnl configure.
AC_MSG_CHECKING([OCI8 DTrace support])
oci8_do_dtrace="`echo $PHP_OCI8 | cut -d, -f3`"
if test "$PHP_DTRACE" = "yes" -o "$oci8_do_dtrace" = "dtrace" ; then
AC_MSG_RESULT([yes])
if test "$ext_shared" = "no"; then
AC_MSG_ERROR([For DTrace support OCI8 must be configured as a shared extension])
else
AC_CHECK_HEADERS([sys/sdt.h], [
OCI8_INIT_DTRACE([oci8_dtrace.d],[oci8_dtrace_gen.h],[oci8.c oci8_statement.c])
], [
AC_MSG_ERROR(
[Cannot find sys/sdt.h which is required for DTrace support])
])
PHP_SUBST(OCI8_DTRACE_OBJS)
AC_DEFINE(HAVE_OCI8_DTRACE,1,[Defined to 1 if PHP OCI8 DTrace support was enabled during configuration])
dnl Developer warning: hard coded extension is OK for the known supported
dnl environments.
shared_objects_oci8="$shared_objects_oci8 PHP_EXT_BUILDDIR(oci8)/oci8_dtrace.d.lo"
fi
else
AC_MSG_RESULT([no])
fi
dnl Set some port specific directory components for use later.
AC_CHECK_SIZEOF([long])
AC_MSG_CHECKING([if we're at 64-bit platform])
AS_IF([test "$ac_cv_sizeof_long" -eq 4],[
AC_MSG_RESULT([no])
PHP_OCI8_OH_LIBDIR=lib32
PHP_OCI8_IC_LIBDIR_SUFFIX=""
],[
AC_MSG_RESULT([yes])
PHP_OCI8_OH_LIBDIR=lib
PHP_OCI8_IC_LIBDIR_SUFFIX=64
])
dnl Determine if the user wants to use Oracle Instant Client libraries.
PHP_OCI8_INSTANT_CLIENT="no"
dnl PECL Bug 14268 (Allow "pecl install oci8" command to "autodetect" an
dnl Instant Client RPM install). This also has a benefit for non
dnl "pecl install" builds: if the user does --with-oci8 or --with-oci8=shared
dnl but the ORACLE_HOME environment variable is not actually set, the install
dnl tries to locate the Instant Client RPM.
if test "$PHP_OCI8" = "yes" && test -z "$ORACLE_HOME"; then
AC_MSG_WARN([OCI8 extension: ORACLE_HOME is not set, looking for default Oracle Instant Client instead])
PHP_OCI8=instantclient
fi
if test "`echo $PHP_OCI8`" = "instantclient"; then
PHP_OCI8_INSTANT_CLIENT="yes"
elif 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
if test -z "$PHP_OCI8"; then
PHP_OCI8=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
if test -z "$PHP_OCI8"; then
PHP_OCI8=yes
fi
fi
if test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
dnl ***************************************
dnl Branch for using an ORACLE_HOME install
dnl ***************************************
AC_MSG_CHECKING([Oracle ORACLE_HOME 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_ORACLE_VERSION($OCI8_DIR)
case $OCI8_ORACLE_VERSION in
7.3|8.0|8.1|9.0|10.1)
AC_MSG_ERROR([Oracle Client libraries < 11.2 are not supported])
;;
esac
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD)
PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c oci8_failover.c, $ext_shared)
AC_DEFINE(HAVE_OCI8,1,[Defined to 1 if the PHP OCI8 extension for Oracle Database is configured])
PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
PHP_SUBST_OLD(OCI8_DIR)
PHP_SUBST_OLD(OCI8_ORACLE_VERSION)
dnl Fix Bug #46623
AC_DEFINE_UNQUOTED(PHP_OCI8_DEF_DIR, "$OCI8_DIR", [ ])
AC_DEFINE_UNQUOTED(PHP_OCI8_DEF_SHARED_LIBADD, "$OCI8_SHARED_LIBADD", [ ])
else
dnl ***************************************************
dnl Branch for using an Oracle Instant Client directory
dnl ***************************************************
AC_MSG_CHECKING([Oracle Instant Client directory])
if test "$PHP_OCI8_INSTANT_CLIENT" = "yes"; then
dnl Find the directory if user specified "instantclient" but did not give
dnl a dir. Generally the Instant Client can be anywhere so the user must
dnl pass in the library directory. But on Linux we default to the most
dnl recent version in /usr/lib which is where the Oracle Instant Client
dnl RPM gets installed.
PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client${PHP_OCI8_IC_LIBDIR_SUFFIX}/lib/libclntsh.* 2> /dev/null | $PHP_OCI8_TAIL1 | $PHP_OCI8_SED -e 's#/libclntsh[^/]*##'`
if test -z "$PHP_OCI8_INSTANT_CLIENT"; then
AC_MSG_ERROR([Oracle Instant Client directory /usr/lib/oracle/.../client${PHP_OCI8_IC_LIBDIR_SUFFIX}/lib libraries 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\('${PHP_OCI8_IC_LIBDIR_SUFFIX}'\)*/lib[/]*$!/usr/include/oracle/\1/client\2!'`
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_ORACLE_VERSION in
10.1)
AC_MSG_ERROR([Oracle Client libraries < 11.2 are not supported])
;;
esac
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
PHP_ADD_LIBPATH($PHP_OCI8_INSTANT_CLIENT, OCI8_SHARED_LIBADD)
AC_DEFINE(HAVE_OCI_INSTANT_CLIENT,1,[Defined to 1 if OCI8 configuration located Oracle's Instant Client libraries])
PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c oci8_failover.c, $ext_shared)
AC_DEFINE(HAVE_OCI8,1,[Defined to 1 if the PHP OCI8 extension for Oracle Database is configured])
PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
PHP_SUBST_OLD(OCI8_DIR)
PHP_SUBST_OLD(OCI8_ORACLE_VERSION)
fi
fi

View file

@ -1,125 +0,0 @@
// vim:ft=javascript
if (PHP_OCI8_11G != "no" && PHP_OCI8_12C != "no") {
if (!PHP_OCI8_11G_SHARED && !PHP_OCI8_12C_SHARED) {
WARNING("oci8-11g and oci8-12c provide the same extension and cannot both be built statically");
PHP_OCI8_11G = "no"
}
}
if (PHP_OCI8_11G != "no" && PHP_OCI8_19 != "no") {
if (!PHP_OCI8_11G_SHARED && !PHP_OCI8_19_SHARED) {
WARNING("oci8-11g and oci8-19 provide the same extension and cannot both be built statically");
PHP_OCI8_11G = "no"
}
}
if (PHP_OCI8_12C != "no" && PHP_OCI8_19 != "no") {
if (!PHP_OCI8_12C_SHARED && !PHP_OCI8_19_SHARED) {
WARNING("oci8-12c and oci8-19 provide the same extension and cannot both be built statically");
PHP_OCI8_12C = "no"
}
}
ARG_WITH("oci8-11g", "OCI8 support using Oracle 11g Instant Client", "no");
if (PHP_OCI8_11G != "no") {
oci8_11g_dirs = new Array(
PHP_OCI8_11G
);
oci8_11g_lib_paths = "";
oci8_11g_inc_paths = "";
// find the Oracle install
for (i = 0; i < oci8_11g_dirs.length; i++) {
oci8_11g_lib_paths += oci8_11g_dirs[i] + "\\lib;";
oci8_11g_lib_paths += oci8_11g_dirs[i] + "\\lib\\msvc;";
oci8_11g_inc_paths += oci8_11g_dirs[i] + "\\include;";
}
oci8_11g_inc_paths += PHP_PHP_BUILD + "\\include\\instantclient_11;"
oci8_11g_lib_paths += PHP_PHP_BUILD + "\\lib\\instantclient_11;";
if (CHECK_HEADER_ADD_INCLUDE("oci.h", "CFLAGS_OCI8_11G", oci8_11g_inc_paths) &&
CHECK_LIB("oci.lib", "oci8_11g", oci8_11g_lib_paths))
{
EXTENSION('oci8_11g', 'oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c oci8_failover.c', null, null, null, "ext\\oci8_11g")
AC_DEFINE('HAVE_OCI8', 1);
AC_DEFINE('HAVE_OCI_INSTANT_CLIENT', 1);
} else {
WARNING("oci8-11g not enabled: Oracle Database client libraries or Oracle 11g Instant Client not found");
PHP_OCI8_11G = "no"
}
}
ARG_WITH("oci8-12c", "OCI8 support using Oracle Database 12c Instant Client", "no");
if (PHP_OCI8_12C != "no") {
oci8_12c_dirs = new Array(
PHP_OCI8_12C
);
oci8_12c_lib_paths = "";
oci8_12c_inc_paths = "";
// find the Oracle install
for (i = 0; i < oci8_12c_dirs.length; i++) {
oci8_12c_lib_paths += oci8_12c_dirs[i] + "\\lib;";
oci8_12c_lib_paths += oci8_12c_dirs[i] + "\\lib\\msvc;";
oci8_12c_inc_paths += oci8_12c_dirs[i] + "\\include;";
}
oci8_12c_inc_paths += PHP_PHP_BUILD + "\\include\\instantclient_12;"
oci8_12c_lib_paths += PHP_PHP_BUILD + "\\lib\\instantclient_12;";
if (CHECK_HEADER_ADD_INCLUDE("oci.h", "CFLAGS_OCI8_12C", oci8_12c_inc_paths) &&
CHECK_LIB("oci.lib", "oci8_12c", oci8_12c_lib_paths))
{
EXTENSION('oci8_12c', 'oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c oci8_failover.c', null, null, null, "ext\\oci8_12c")
AC_DEFINE('HAVE_OCI8', 1);
AC_DEFINE('HAVE_OCI_INSTANT_CLIENT', 1);
} else {
WARNING("oci8-12c not enabled: Oracle Database client libraries or Oracle Database 12c Instant Client not found");
PHP_OCI8_12C = "no"
}
}
ARG_WITH("oci8-19", "OCI8 support using Oracle Database 19 Instant Client", "no");
if (PHP_OCI8_19 != "no") {
oci8_19_dirs = new Array(
PHP_OCI8_19
);
oci8_19_lib_paths = "";
oci8_19_inc_paths = "";
// find the Oracle install
for (i = 0; i < oci8_19_dirs.length; i++) {
oci8_19_lib_paths += oci8_19_dirs[i] + "\\lib;";
oci8_19_lib_paths += oci8_19_dirs[i] + "\\lib\\msvc;";
oci8_19_inc_paths += oci8_19_dirs[i] + "\\include;";
}
oci8_19_inc_paths += PHP_PHP_BUILD + "\\include\\instantclient_19;"
oci8_19_lib_paths += PHP_PHP_BUILD + "\\lib\\instantclient_19;";
if (CHECK_HEADER_ADD_INCLUDE("oci.h", "CFLAGS_OCI8_19", oci8_19_inc_paths) &&
CHECK_LIB("oci.lib", "oci8_19", oci8_19_lib_paths))
{
EXTENSION('oci8_19', 'oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c oci8_failover.c', null, null, null, "ext\\oci8_19")
AC_DEFINE('HAVE_OCI8', 1);
AC_DEFINE('HAVE_OCI_INSTANT_CLIENT', 1);
} else {
WARNING("oci8-19 not enabled: Oracle Database client libraries or Oracle Database 19 Instant Client not found");
PHP_OCI8_19 = "no"
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

924
ext/oci8/oci8_arginfo.h generated
View file

@ -1,924 +0,0 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 850d4e63296c95a27cdfc1244d63b1ed496acd54 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_INFO(0, column, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(1, var, IS_MIXED, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
#define arginfo_ocidefinebyname arginfo_oci_define_by_name
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_bind_by_name, 0, 3, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_INFO(0, param, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(1, var, IS_MIXED, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_length, IS_LONG, 0, "-1")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
#define arginfo_ocibindbyname arginfo_oci_bind_by_name
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_bind_array_by_name, 0, 4, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_INFO(0, param, IS_STRING, 0)
ZEND_ARG_INFO(1, var)
ZEND_ARG_TYPE_INFO(0, max_array_length, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_item_length, IS_LONG, 0, "-1")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "SQLT_AFC")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_free_descriptor, 0, 1, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, lob, OCILob, 0)
ZEND_END_ARG_INFO()
#define arginfo_ocifreedesc arginfo_oci_free_descriptor
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_save, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, lob, OCILob, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
#define arginfo_ocisavelob arginfo_oci_lob_save
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_import, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, lob, OCILob, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_END_ARG_INFO()
#define arginfo_ocisavelobfile arginfo_oci_lob_import
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_lob_load, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, lob, OCILob, 0)
ZEND_END_ARG_INFO()
#define arginfo_ociloadlob arginfo_oci_lob_load
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_lob_read, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, lob, OCILob, 0)
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
ZEND_END_ARG_INFO()
#define arginfo_oci_lob_eof arginfo_oci_free_descriptor
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_lob_tell, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, lob, OCILob, 0)
ZEND_END_ARG_INFO()
#define arginfo_oci_lob_rewind arginfo_oci_free_descriptor
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_seek, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, lob, OCILob, 0)
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, whence, IS_LONG, 0, "OCI_SEEK_SET")
ZEND_END_ARG_INFO()
#define arginfo_oci_lob_size arginfo_oci_lob_tell
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_lob_write, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, lob, OCILob, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_append, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, to, OCILob, 0)
ZEND_ARG_OBJ_INFO(0, from, OCILob, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_truncate, 0, 1, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, lob, OCILob, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_lob_erase, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, lob, OCILob, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_flush, 0, 1, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, lob, OCILob, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flag, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ocisetbufferinglob, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, lob, OCILob, 0)
ZEND_ARG_TYPE_INFO(0, mode, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
#define arginfo_ocigetbufferinglob arginfo_oci_free_descriptor
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_copy, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, to, OCILob, 0)
ZEND_ARG_OBJ_INFO(0, from, OCILob, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_is_equal, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, lob1, OCILob, 0)
ZEND_ARG_OBJ_INFO(0, lob2, OCILob, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_export, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, lob, OCILob, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
#define arginfo_ociwritelobtofile arginfo_oci_lob_export
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_oci_new_descriptor, 0, 1, OCILob, 1)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "OCI_DTYPE_LOB")
ZEND_END_ARG_INFO()
#define arginfo_ocinewdescriptor arginfo_oci_new_descriptor
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_rollback, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, connection)
ZEND_END_ARG_INFO()
#define arginfo_ocirollback arginfo_oci_rollback
#define arginfo_oci_commit arginfo_oci_rollback
#define arginfo_ocicommit arginfo_oci_rollback
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_field_name, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_MASK(0, column, MAY_BE_STRING|MAY_BE_LONG, NULL)
ZEND_END_ARG_INFO()
#define arginfo_ocicolumnname arginfo_oci_field_name
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_field_size, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_MASK(0, column, MAY_BE_STRING|MAY_BE_LONG, NULL)
ZEND_END_ARG_INFO()
#define arginfo_ocicolumnsize arginfo_oci_field_size
#define arginfo_oci_field_scale arginfo_oci_field_size
#define arginfo_ocicolumnscale arginfo_oci_field_size
#define arginfo_oci_field_precision arginfo_oci_field_size
#define arginfo_ocicolumnprecision arginfo_oci_field_size
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_field_type, 0, 2, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_MASK(0, column, MAY_BE_STRING|MAY_BE_LONG, NULL)
ZEND_END_ARG_INFO()
#define arginfo_ocicolumntype arginfo_oci_field_type
#define arginfo_oci_field_type_raw arginfo_oci_field_size
#define arginfo_ocicolumntyperaw arginfo_oci_field_size
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_field_is_null, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_MASK(0, column, MAY_BE_STRING|MAY_BE_LONG, NULL)
ZEND_END_ARG_INFO()
#define arginfo_ocicolumnisnull arginfo_oci_field_is_null
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_execute, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "OCI_COMMIT_ON_SUCCESS")
ZEND_END_ARG_INFO()
#define arginfo_ociexecute arginfo_oci_execute
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_cancel, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
ZEND_END_ARG_INFO()
#define arginfo_ocicancel arginfo_oci_cancel
#define arginfo_oci_fetch arginfo_oci_cancel
#define arginfo_ocifetch arginfo_oci_cancel
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ocifetchinto, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_INFO(1, result)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "OCI_NUM")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_fetch_all, 0, 2, IS_LONG, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_INFO(1, output)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, limit, IS_LONG, 0, "-1")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "OCI_FETCHSTATEMENT_BY_COLUMN | OCI_ASSOC")
ZEND_END_ARG_INFO()
#define arginfo_ocifetchstatement arginfo_oci_fetch_all
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_oci_fetch_object, 0, 1, stdClass, MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "OCI_ASSOC | OCI_RETURN_NULLS")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_fetch_row, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_END_ARG_INFO()
#define arginfo_oci_fetch_assoc arginfo_oci_fetch_row
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_fetch_array, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "OCI_BOTH | OCI_RETURN_NULLS")
ZEND_END_ARG_INFO()
#define arginfo_oci_free_statement arginfo_oci_cancel
#define arginfo_ocifreestatement arginfo_oci_cancel
#define arginfo_oci_free_cursor arginfo_oci_cancel
#define arginfo_ocifreecursor arginfo_oci_cancel
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_close, 0, 1, _IS_BOOL, 1)
ZEND_ARG_INFO(0, connection)
ZEND_END_ARG_INFO()
#define arginfo_ocilogoff arginfo_oci_close
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_new_connect, 0, 0, 2)
ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, connection_string, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 0, "\"\"")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, session_mode, IS_LONG, 0, "OCI_DEFAULT")
ZEND_END_ARG_INFO()
#define arginfo_ocinlogon arginfo_oci_new_connect
#define arginfo_oci_connect arginfo_oci_new_connect
#define arginfo_ocilogon arginfo_oci_new_connect
#define arginfo_oci_pconnect arginfo_oci_new_connect
#define arginfo_ociplogon arginfo_oci_new_connect
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_error, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, connection_or_statement, "null")
ZEND_END_ARG_INFO()
#define arginfo_ocierror arginfo_oci_error
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_num_fields, 0, 1, IS_LONG, 0)
ZEND_ARG_INFO(0, statement)
ZEND_END_ARG_INFO()
#define arginfo_ocinumcols arginfo_oci_num_fields
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_parse, 0, 0, 2)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_TYPE_INFO(0, sql, IS_STRING, 0)
ZEND_END_ARG_INFO()
#define arginfo_ociparse arginfo_oci_parse
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_get_implicit_resultset, 0, 0, 1)
ZEND_ARG_INFO(0, statement)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_set_prefetch, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_INFO(0, rows, IS_LONG, 0)
ZEND_END_ARG_INFO()
#define arginfo_ocisetprefetch arginfo_oci_set_prefetch
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_set_prefetch_lob, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_INFO(0, prefetch_lob_size, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_set_client_identifier, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_TYPE_INFO(0, client_id, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_set_edition, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, edition, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_set_module_name, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_set_action, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_TYPE_INFO(0, action, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_set_client_info, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_TYPE_INFO(0, client_info, IS_STRING, 0)
ZEND_END_ARG_INFO()
#define arginfo_oci_set_db_operation arginfo_oci_set_action
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_set_call_timeout, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_password_change, 0, 0, 4)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, old_password, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, new_password, IS_STRING, 0)
ZEND_END_ARG_INFO()
#define arginfo_ocipasswordchange arginfo_oci_password_change
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_new_cursor, 0, 0, 1)
ZEND_ARG_INFO(0, connection)
ZEND_END_ARG_INFO()
#define arginfo_ocinewcursor arginfo_oci_new_cursor
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_result, 0, 2, IS_MIXED, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_MASK(0, column, MAY_BE_STRING|MAY_BE_LONG, NULL)
ZEND_END_ARG_INFO()
#define arginfo_ociresult arginfo_oci_result
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_client_version, 0, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_server_version, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection)
ZEND_END_ARG_INFO()
#define arginfo_ociserverversion arginfo_oci_server_version
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_statement_type, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_END_ARG_INFO()
#define arginfo_ocistatementtype arginfo_oci_statement_type
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_num_rows, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_END_ARG_INFO()
#define arginfo_ocirowcount arginfo_oci_num_rows
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_free_collection, 0, 1, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, collection, OCICollection, 0)
ZEND_END_ARG_INFO()
#define arginfo_ocifreecollection arginfo_oci_free_collection
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_collection_append, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, collection, OCICollection, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
ZEND_END_ARG_INFO()
#define arginfo_ocicollappend arginfo_oci_collection_append
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_collection_element_get, 0, 2, MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_NULL|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, collection, OCICollection, 0)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
ZEND_END_ARG_INFO()
#define arginfo_ocicollgetelem arginfo_oci_collection_element_get
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_collection_assign, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, to, OCICollection, 0)
ZEND_ARG_OBJ_INFO(0, from, OCICollection, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_collection_element_assign, 0, 3, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, collection, OCICollection, 0)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
ZEND_END_ARG_INFO()
#define arginfo_ocicollassignelem arginfo_oci_collection_element_assign
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_collection_size, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, collection, OCICollection, 0)
ZEND_END_ARG_INFO()
#define arginfo_ocicollsize arginfo_oci_collection_size
#define arginfo_oci_collection_max arginfo_oci_collection_size
#define arginfo_ocicollmax arginfo_oci_collection_size
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_collection_trim, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, collection, OCICollection, 0)
ZEND_ARG_TYPE_INFO(0, num, IS_LONG, 0)
ZEND_END_ARG_INFO()
#define arginfo_ocicolltrim arginfo_oci_collection_trim
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_oci_new_collection, 0, 2, OCICollection, MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_TYPE_INFO(0, type_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, schema, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
#define arginfo_ocinewcollection arginfo_oci_new_collection
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_register_taf_callback, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 1)
ZEND_END_ARG_INFO()
#define arginfo_oci_unregister_taf_callback arginfo_oci_rollback
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_save, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_import, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_END_ARG_INFO()
#define arginfo_class_OCILob_saveFile arginfo_class_OCILob_import
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_OCILob_load, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_OCILob_read, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_eof, 0, 0, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_OCILob_tell, 0, 0, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_END_ARG_INFO()
#define arginfo_class_OCILob_rewind arginfo_class_OCILob_eof
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_seek, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, whence, IS_LONG, 0, "OCI_SEEK_SET")
ZEND_END_ARG_INFO()
#define arginfo_class_OCILob_size arginfo_class_OCILob_tell
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_OCILob_write, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_append, 0, 1, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, from, OCILob, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_truncate, 0, 0, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_OCILob_erase, 0, 0, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_flush, 0, 0, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flag, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_setBuffering, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, mode, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
#define arginfo_class_OCILob_getBuffering arginfo_class_OCILob_eof
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_writeToFile, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
#define arginfo_class_OCILob_export arginfo_class_OCILob_writeToFile
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_writeTemporary, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "OCI_TEMP_CLOB")
ZEND_END_ARG_INFO()
#define arginfo_class_OCILob_close arginfo_class_OCILob_eof
#define arginfo_class_OCILob_free arginfo_class_OCILob_eof
#define arginfo_class_OCICollection_free arginfo_class_OCILob_eof
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCICollection_append, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_OCICollection_getElem, 0, 1, MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_NULL|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCICollection_assign, 0, 1, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, from, OCICollection, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCICollection_assignElem, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
ZEND_END_ARG_INFO()
#define arginfo_class_OCICollection_size arginfo_class_OCILob_tell
#define arginfo_class_OCICollection_max arginfo_class_OCILob_tell
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_OCICollection_trim, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, num, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_FUNCTION(oci_define_by_name);
ZEND_FUNCTION(oci_bind_by_name);
ZEND_FUNCTION(oci_bind_array_by_name);
ZEND_FUNCTION(oci_free_descriptor);
ZEND_FUNCTION(oci_lob_save);
ZEND_FUNCTION(oci_lob_import);
ZEND_FUNCTION(oci_lob_load);
ZEND_FUNCTION(oci_lob_read);
ZEND_FUNCTION(oci_lob_eof);
ZEND_FUNCTION(oci_lob_tell);
ZEND_FUNCTION(oci_lob_rewind);
ZEND_FUNCTION(oci_lob_seek);
ZEND_FUNCTION(oci_lob_size);
ZEND_FUNCTION(oci_lob_write);
ZEND_FUNCTION(oci_lob_append);
ZEND_FUNCTION(oci_lob_truncate);
ZEND_FUNCTION(oci_lob_erase);
ZEND_FUNCTION(oci_lob_flush);
ZEND_FUNCTION(ocisetbufferinglob);
ZEND_FUNCTION(ocigetbufferinglob);
ZEND_FUNCTION(oci_lob_copy);
ZEND_FUNCTION(oci_lob_is_equal);
ZEND_FUNCTION(oci_lob_export);
ZEND_FUNCTION(oci_new_descriptor);
ZEND_FUNCTION(oci_rollback);
ZEND_FUNCTION(oci_commit);
ZEND_FUNCTION(oci_field_name);
ZEND_FUNCTION(oci_field_size);
ZEND_FUNCTION(oci_field_scale);
ZEND_FUNCTION(oci_field_precision);
ZEND_FUNCTION(oci_field_type);
ZEND_FUNCTION(oci_field_type_raw);
ZEND_FUNCTION(oci_field_is_null);
ZEND_FUNCTION(oci_execute);
ZEND_FUNCTION(oci_cancel);
ZEND_FUNCTION(oci_fetch);
ZEND_FUNCTION(ocifetchinto);
ZEND_FUNCTION(oci_fetch_all);
ZEND_FUNCTION(oci_fetch_object);
ZEND_FUNCTION(oci_fetch_row);
ZEND_FUNCTION(oci_fetch_assoc);
ZEND_FUNCTION(oci_fetch_array);
ZEND_FUNCTION(oci_free_statement);
ZEND_FUNCTION(oci_close);
ZEND_FUNCTION(oci_new_connect);
ZEND_FUNCTION(oci_connect);
ZEND_FUNCTION(oci_pconnect);
ZEND_FUNCTION(oci_error);
ZEND_FUNCTION(oci_num_fields);
ZEND_FUNCTION(oci_parse);
ZEND_FUNCTION(oci_get_implicit_resultset);
ZEND_FUNCTION(oci_set_prefetch);
ZEND_FUNCTION(oci_set_prefetch_lob);
ZEND_FUNCTION(oci_set_client_identifier);
ZEND_FUNCTION(oci_set_edition);
ZEND_FUNCTION(oci_set_module_name);
ZEND_FUNCTION(oci_set_action);
ZEND_FUNCTION(oci_set_client_info);
ZEND_FUNCTION(oci_set_db_operation);
ZEND_FUNCTION(oci_set_call_timeout);
ZEND_FUNCTION(oci_password_change);
ZEND_FUNCTION(oci_new_cursor);
ZEND_FUNCTION(oci_result);
ZEND_FUNCTION(oci_client_version);
ZEND_FUNCTION(oci_server_version);
ZEND_FUNCTION(oci_statement_type);
ZEND_FUNCTION(oci_num_rows);
ZEND_FUNCTION(oci_free_collection);
ZEND_FUNCTION(oci_collection_append);
ZEND_FUNCTION(oci_collection_element_get);
ZEND_FUNCTION(oci_collection_assign);
ZEND_FUNCTION(oci_collection_element_assign);
ZEND_FUNCTION(oci_collection_size);
ZEND_FUNCTION(oci_collection_max);
ZEND_FUNCTION(oci_collection_trim);
ZEND_FUNCTION(oci_new_collection);
ZEND_FUNCTION(oci_register_taf_callback);
ZEND_FUNCTION(oci_unregister_taf_callback);
ZEND_METHOD(OCILob, writeTemporary);
ZEND_METHOD(OCILob, close);
static const zend_function_entry ext_functions[] = {
ZEND_FE(oci_define_by_name, arginfo_oci_define_by_name)
ZEND_DEP_FALIAS(ocidefinebyname, oci_define_by_name, arginfo_ocidefinebyname)
ZEND_FE(oci_bind_by_name, arginfo_oci_bind_by_name)
ZEND_DEP_FALIAS(ocibindbyname, oci_bind_by_name, arginfo_ocibindbyname)
ZEND_FE(oci_bind_array_by_name, arginfo_oci_bind_array_by_name)
ZEND_FE(oci_free_descriptor, arginfo_oci_free_descriptor)
ZEND_DEP_FALIAS(ocifreedesc, oci_free_descriptor, arginfo_ocifreedesc)
ZEND_FE(oci_lob_save, arginfo_oci_lob_save)
ZEND_DEP_FALIAS(ocisavelob, oci_lob_save, arginfo_ocisavelob)
ZEND_FE(oci_lob_import, arginfo_oci_lob_import)
ZEND_DEP_FALIAS(ocisavelobfile, oci_lob_import, arginfo_ocisavelobfile)
ZEND_FE(oci_lob_load, arginfo_oci_lob_load)
ZEND_DEP_FALIAS(ociloadlob, oci_lob_load, arginfo_ociloadlob)
ZEND_FE(oci_lob_read, arginfo_oci_lob_read)
ZEND_FE(oci_lob_eof, arginfo_oci_lob_eof)
ZEND_FE(oci_lob_tell, arginfo_oci_lob_tell)
ZEND_FE(oci_lob_rewind, arginfo_oci_lob_rewind)
ZEND_FE(oci_lob_seek, arginfo_oci_lob_seek)
ZEND_FE(oci_lob_size, arginfo_oci_lob_size)
ZEND_FE(oci_lob_write, arginfo_oci_lob_write)
ZEND_FE(oci_lob_append, arginfo_oci_lob_append)
ZEND_FE(oci_lob_truncate, arginfo_oci_lob_truncate)
ZEND_FE(oci_lob_erase, arginfo_oci_lob_erase)
ZEND_FE(oci_lob_flush, arginfo_oci_lob_flush)
ZEND_FE(ocisetbufferinglob, arginfo_ocisetbufferinglob)
ZEND_FE(ocigetbufferinglob, arginfo_ocigetbufferinglob)
ZEND_FE(oci_lob_copy, arginfo_oci_lob_copy)
ZEND_FE(oci_lob_is_equal, arginfo_oci_lob_is_equal)
ZEND_FE(oci_lob_export, arginfo_oci_lob_export)
ZEND_DEP_FALIAS(ociwritelobtofile, oci_lob_export, arginfo_ociwritelobtofile)
ZEND_FE(oci_new_descriptor, arginfo_oci_new_descriptor)
ZEND_DEP_FALIAS(ocinewdescriptor, oci_new_descriptor, arginfo_ocinewdescriptor)
ZEND_FE(oci_rollback, arginfo_oci_rollback)
ZEND_DEP_FALIAS(ocirollback, oci_rollback, arginfo_ocirollback)
ZEND_FE(oci_commit, arginfo_oci_commit)
ZEND_DEP_FALIAS(ocicommit, oci_commit, arginfo_ocicommit)
ZEND_FE(oci_field_name, arginfo_oci_field_name)
ZEND_DEP_FALIAS(ocicolumnname, oci_field_name, arginfo_ocicolumnname)
ZEND_FE(oci_field_size, arginfo_oci_field_size)
ZEND_DEP_FALIAS(ocicolumnsize, oci_field_size, arginfo_ocicolumnsize)
ZEND_FE(oci_field_scale, arginfo_oci_field_scale)
ZEND_DEP_FALIAS(ocicolumnscale, oci_field_scale, arginfo_ocicolumnscale)
ZEND_FE(oci_field_precision, arginfo_oci_field_precision)
ZEND_DEP_FALIAS(ocicolumnprecision, oci_field_precision, arginfo_ocicolumnprecision)
ZEND_FE(oci_field_type, arginfo_oci_field_type)
ZEND_DEP_FALIAS(ocicolumntype, oci_field_type, arginfo_ocicolumntype)
ZEND_FE(oci_field_type_raw, arginfo_oci_field_type_raw)
ZEND_DEP_FALIAS(ocicolumntyperaw, oci_field_type_raw, arginfo_ocicolumntyperaw)
ZEND_FE(oci_field_is_null, arginfo_oci_field_is_null)
ZEND_DEP_FALIAS(ocicolumnisnull, oci_field_is_null, arginfo_ocicolumnisnull)
ZEND_FE(oci_execute, arginfo_oci_execute)
ZEND_DEP_FALIAS(ociexecute, oci_execute, arginfo_ociexecute)
ZEND_FE(oci_cancel, arginfo_oci_cancel)
ZEND_DEP_FALIAS(ocicancel, oci_cancel, arginfo_ocicancel)
ZEND_FE(oci_fetch, arginfo_oci_fetch)
ZEND_DEP_FALIAS(ocifetch, oci_fetch, arginfo_ocifetch)
ZEND_DEP_FE(ocifetchinto, arginfo_ocifetchinto)
ZEND_FE(oci_fetch_all, arginfo_oci_fetch_all)
ZEND_DEP_FALIAS(ocifetchstatement, oci_fetch_all, arginfo_ocifetchstatement)
ZEND_FE(oci_fetch_object, arginfo_oci_fetch_object)
ZEND_FE(oci_fetch_row, arginfo_oci_fetch_row)
ZEND_FE(oci_fetch_assoc, arginfo_oci_fetch_assoc)
ZEND_FE(oci_fetch_array, arginfo_oci_fetch_array)
ZEND_FE(oci_free_statement, arginfo_oci_free_statement)
ZEND_DEP_FALIAS(ocifreestatement, oci_free_statement, arginfo_ocifreestatement)
ZEND_FALIAS(oci_free_cursor, oci_free_statement, arginfo_oci_free_cursor)
ZEND_DEP_FALIAS(ocifreecursor, oci_free_statement, arginfo_ocifreecursor)
ZEND_FE(oci_close, arginfo_oci_close)
ZEND_DEP_FALIAS(ocilogoff, oci_close, arginfo_ocilogoff)
ZEND_FE(oci_new_connect, arginfo_oci_new_connect)
ZEND_DEP_FALIAS(ocinlogon, oci_new_connect, arginfo_ocinlogon)
ZEND_FE(oci_connect, arginfo_oci_connect)
ZEND_DEP_FALIAS(ocilogon, oci_connect, arginfo_ocilogon)
ZEND_FE(oci_pconnect, arginfo_oci_pconnect)
ZEND_DEP_FALIAS(ociplogon, oci_pconnect, arginfo_ociplogon)
ZEND_FE(oci_error, arginfo_oci_error)
ZEND_DEP_FALIAS(ocierror, oci_error, arginfo_ocierror)
ZEND_FE(oci_num_fields, arginfo_oci_num_fields)
ZEND_DEP_FALIAS(ocinumcols, oci_num_fields, arginfo_ocinumcols)
ZEND_FE(oci_parse, arginfo_oci_parse)
ZEND_DEP_FALIAS(ociparse, oci_parse, arginfo_ociparse)
ZEND_FE(oci_get_implicit_resultset, arginfo_oci_get_implicit_resultset)
ZEND_FE(oci_set_prefetch, arginfo_oci_set_prefetch)
ZEND_DEP_FALIAS(ocisetprefetch, oci_set_prefetch, arginfo_ocisetprefetch)
ZEND_FE(oci_set_prefetch_lob, arginfo_oci_set_prefetch_lob)
ZEND_FE(oci_set_client_identifier, arginfo_oci_set_client_identifier)
ZEND_FE(oci_set_edition, arginfo_oci_set_edition)
ZEND_FE(oci_set_module_name, arginfo_oci_set_module_name)
ZEND_FE(oci_set_action, arginfo_oci_set_action)
ZEND_FE(oci_set_client_info, arginfo_oci_set_client_info)
ZEND_FE(oci_set_db_operation, arginfo_oci_set_db_operation)
ZEND_FE(oci_set_call_timeout, arginfo_oci_set_call_timeout)
ZEND_FE(oci_password_change, arginfo_oci_password_change)
ZEND_DEP_FALIAS(ocipasswordchange, oci_password_change, arginfo_ocipasswordchange)
ZEND_FE(oci_new_cursor, arginfo_oci_new_cursor)
ZEND_DEP_FALIAS(ocinewcursor, oci_new_cursor, arginfo_ocinewcursor)
ZEND_FE(oci_result, arginfo_oci_result)
ZEND_DEP_FALIAS(ociresult, oci_result, arginfo_ociresult)
ZEND_FE(oci_client_version, arginfo_oci_client_version)
ZEND_FE(oci_server_version, arginfo_oci_server_version)
ZEND_DEP_FALIAS(ociserverversion, oci_server_version, arginfo_ociserverversion)
ZEND_FE(oci_statement_type, arginfo_oci_statement_type)
ZEND_DEP_FALIAS(ocistatementtype, oci_statement_type, arginfo_ocistatementtype)
ZEND_FE(oci_num_rows, arginfo_oci_num_rows)
ZEND_DEP_FALIAS(ocirowcount, oci_num_rows, arginfo_ocirowcount)
ZEND_FE(oci_free_collection, arginfo_oci_free_collection)
ZEND_DEP_FALIAS(ocifreecollection, oci_free_collection, arginfo_ocifreecollection)
ZEND_FE(oci_collection_append, arginfo_oci_collection_append)
ZEND_DEP_FALIAS(ocicollappend, oci_collection_append, arginfo_ocicollappend)
ZEND_FE(oci_collection_element_get, arginfo_oci_collection_element_get)
ZEND_DEP_FALIAS(ocicollgetelem, oci_collection_element_get, arginfo_ocicollgetelem)
ZEND_FE(oci_collection_assign, arginfo_oci_collection_assign)
ZEND_FE(oci_collection_element_assign, arginfo_oci_collection_element_assign)
ZEND_DEP_FALIAS(ocicollassignelem, oci_collection_element_assign, arginfo_ocicollassignelem)
ZEND_FE(oci_collection_size, arginfo_oci_collection_size)
ZEND_DEP_FALIAS(ocicollsize, oci_collection_size, arginfo_ocicollsize)
ZEND_FE(oci_collection_max, arginfo_oci_collection_max)
ZEND_DEP_FALIAS(ocicollmax, oci_collection_max, arginfo_ocicollmax)
ZEND_FE(oci_collection_trim, arginfo_oci_collection_trim)
ZEND_DEP_FALIAS(ocicolltrim, oci_collection_trim, arginfo_ocicolltrim)
ZEND_FE(oci_new_collection, arginfo_oci_new_collection)
ZEND_DEP_FALIAS(ocinewcollection, oci_new_collection, arginfo_ocinewcollection)
ZEND_FE(oci_register_taf_callback, arginfo_oci_register_taf_callback)
ZEND_FE(oci_unregister_taf_callback, arginfo_oci_unregister_taf_callback)
ZEND_FE_END
};
static const zend_function_entry class_OCILob_methods[] = {
ZEND_ME_MAPPING(save, oci_lob_save, arginfo_class_OCILob_save, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(import, oci_lob_import, arginfo_class_OCILob_import, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(saveFile, oci_lob_import, arginfo_class_OCILob_saveFile, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(load, oci_lob_load, arginfo_class_OCILob_load, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(read, oci_lob_read, arginfo_class_OCILob_read, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(eof, oci_lob_eof, arginfo_class_OCILob_eof, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(tell, oci_lob_tell, arginfo_class_OCILob_tell, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(rewind, oci_lob_rewind, arginfo_class_OCILob_rewind, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(seek, oci_lob_seek, arginfo_class_OCILob_seek, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(size, oci_lob_size, arginfo_class_OCILob_size, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(write, oci_lob_write, arginfo_class_OCILob_write, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(append, oci_lob_append, arginfo_class_OCILob_append, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(truncate, oci_lob_truncate, arginfo_class_OCILob_truncate, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(erase, oci_lob_erase, arginfo_class_OCILob_erase, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(flush, oci_lob_flush, arginfo_class_OCILob_flush, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(setBuffering, ocisetbufferinglob, arginfo_class_OCILob_setBuffering, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(getBuffering, ocigetbufferinglob, arginfo_class_OCILob_getBuffering, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(writeToFile, oci_lob_export, arginfo_class_OCILob_writeToFile, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(export, oci_lob_export, arginfo_class_OCILob_export, ZEND_ACC_PUBLIC)
ZEND_ME(OCILob, writeTemporary, arginfo_class_OCILob_writeTemporary, ZEND_ACC_PUBLIC)
ZEND_ME(OCILob, close, arginfo_class_OCILob_close, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(free, oci_free_descriptor, arginfo_class_OCILob_free, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
static const zend_function_entry class_OCICollection_methods[] = {
ZEND_ME_MAPPING(free, oci_free_collection, arginfo_class_OCICollection_free, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(append, oci_collection_append, arginfo_class_OCICollection_append, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(getElem, oci_collection_element_get, arginfo_class_OCICollection_getElem, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(assign, oci_collection_assign, arginfo_class_OCICollection_assign, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(assignElem, oci_collection_element_assign, arginfo_class_OCICollection_assignElem, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(size, oci_collection_size, arginfo_class_OCICollection_size, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(max, oci_collection_max, arginfo_class_OCICollection_max, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(trim, oci_collection_trim, arginfo_class_OCICollection_trim, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
static void register_oci8_symbols(int module_number)
{
REGISTER_LONG_CONSTANT("OCI_DEFAULT", OCI_DEFAULT, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_SYSOPER", OCI_SYSOPER, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_SYSDBA", OCI_SYSDBA, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_CRED_EXT", PHP_OCI_CRED_EXT, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_DESCRIBE_ONLY", OCI_DESCRIBE_ONLY, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_COMMIT_ON_SUCCESS", OCI_COMMIT_ON_SUCCESS, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_NO_AUTO_COMMIT", OCI_DEFAULT, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_EXACT_FETCH", OCI_EXACT_FETCH, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_SEEK_SET", PHP_OCI_SEEK_SET, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_SEEK_CUR", PHP_OCI_SEEK_CUR, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_SEEK_END", PHP_OCI_SEEK_END, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_LOB_BUFFER_FREE", OCI_LOB_BUFFER_FREE, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_BFILEE", SQLT_BFILEE, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_CFILEE", SQLT_CFILEE, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_CLOB", SQLT_CLOB, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_BLOB", SQLT_BLOB, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_RDD", SQLT_RDD, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_INT", SQLT_INT, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_NUM", SQLT_NUM, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_RSET", SQLT_RSET, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_AFC", SQLT_AFC, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_CHR", SQLT_CHR, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_VCS", SQLT_VCS, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_AVC", SQLT_AVC, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_STR", SQLT_STR, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_LVC", SQLT_LVC, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_FLT", SQLT_FLT, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_UIN", SQLT_UIN, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_LNG", SQLT_LNG, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_LBI", SQLT_LBI, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_BIN", SQLT_BIN, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_ODT", SQLT_ODT, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_BDOUBLE", SQLT_BDOUBLE, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_BFLOAT", SQLT_BFLOAT, CONST_PERSISTENT);
#if OCI_MAJOR_VERSION >= 12
REGISTER_LONG_CONSTANT("SQLT_BOL", SQLT_BOL, CONST_PERSISTENT);
#endif
REGISTER_LONG_CONSTANT("OCI_B_NTY", SQLT_NTY, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLT_NTY", SQLT_NTY, CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("OCI_SYSDATE", "SYSDATE", CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_B_BFILE", SQLT_BFILEE, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_B_CFILEE", SQLT_CFILEE, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_B_CLOB", SQLT_CLOB, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_B_BLOB", SQLT_BLOB, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_B_ROWID", SQLT_RDD, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_B_CURSOR", SQLT_RSET, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_B_BIN", SQLT_BIN, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_B_INT", SQLT_INT, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_B_NUM", SQLT_NUM, CONST_PERSISTENT);
#if OCI_MAJOR_VERSION >= 12
REGISTER_LONG_CONSTANT("OCI_B_BOL", SQLT_BOL, CONST_PERSISTENT);
#endif
REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_COLUMN", PHP_OCI_FETCHSTATEMENT_BY_COLUMN, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_ROW", PHP_OCI_FETCHSTATEMENT_BY_ROW, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_ASSOC", PHP_OCI_ASSOC, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_NUM", PHP_OCI_NUM, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_BOTH", PHP_OCI_BOTH, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_RETURN_NULLS", PHP_OCI_RETURN_NULLS, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_RETURN_LOBS", PHP_OCI_RETURN_LOBS, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_DTYPE_FILE", OCI_DTYPE_FILE, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_DTYPE_LOB", OCI_DTYPE_LOB, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_DTYPE_ROWID", OCI_DTYPE_ROWID, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_D_FILE", OCI_DTYPE_FILE, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_D_LOB", OCI_DTYPE_LOB, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_D_ROWID", OCI_DTYPE_ROWID, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_TEMP_CLOB", OCI_TEMP_CLOB, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_TEMP_BLOB", OCI_TEMP_BLOB, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_FO_END", OCI_FO_END, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_FO_ABORT", OCI_FO_ABORT, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_FO_REAUTH", OCI_FO_REAUTH, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_FO_BEGIN", OCI_FO_BEGIN, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_FO_ERROR", OCI_FO_ERROR, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_FO_NONE", OCI_FO_NONE, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_FO_SESSION", OCI_FO_SESSION, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_FO_SELECT", OCI_FO_SELECT, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_FO_TXNAL", OCI_FO_TXNAL, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_FO_RETRY", OCI_FO_RETRY, CONST_PERSISTENT);
zend_add_parameter_attribute(zend_hash_str_find_ptr(CG(function_table), "oci_new_connect", sizeof("oci_new_connect") - 1), 1, ZSTR_KNOWN(ZEND_STR_SENSITIVEPARAMETER), 0);
zend_add_parameter_attribute(zend_hash_str_find_ptr(CG(function_table), "ocinlogon", sizeof("ocinlogon") - 1), 1, ZSTR_KNOWN(ZEND_STR_SENSITIVEPARAMETER), 0);
zend_add_parameter_attribute(zend_hash_str_find_ptr(CG(function_table), "oci_connect", sizeof("oci_connect") - 1), 1, ZSTR_KNOWN(ZEND_STR_SENSITIVEPARAMETER), 0);
zend_add_parameter_attribute(zend_hash_str_find_ptr(CG(function_table), "ocilogon", sizeof("ocilogon") - 1), 1, ZSTR_KNOWN(ZEND_STR_SENSITIVEPARAMETER), 0);
zend_add_parameter_attribute(zend_hash_str_find_ptr(CG(function_table), "oci_pconnect", sizeof("oci_pconnect") - 1), 1, ZSTR_KNOWN(ZEND_STR_SENSITIVEPARAMETER), 0);
zend_add_parameter_attribute(zend_hash_str_find_ptr(CG(function_table), "ociplogon", sizeof("ociplogon") - 1), 1, ZSTR_KNOWN(ZEND_STR_SENSITIVEPARAMETER), 0);
}
static zend_class_entry *register_class_OCILob(void)
{
zend_class_entry ce, *class_entry;
INIT_CLASS_ENTRY(ce, "OCILob", class_OCILob_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES;
zend_string *attribute_name_AllowDynamicProperties_class_OCILob_0 = zend_string_init_interned("AllowDynamicProperties", sizeof("AllowDynamicProperties") - 1, 1);
zend_add_class_attribute(class_entry, attribute_name_AllowDynamicProperties_class_OCILob_0, 0);
zend_string_release(attribute_name_AllowDynamicProperties_class_OCILob_0);
return class_entry;
}
static zend_class_entry *register_class_OCICollection(void)
{
zend_class_entry ce, *class_entry;
INIT_CLASS_ENTRY(ce, "OCICollection", class_OCICollection_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES;
zend_string *attribute_name_AllowDynamicProperties_class_OCICollection_0 = zend_string_init_interned("AllowDynamicProperties", sizeof("AllowDynamicProperties") - 1, 1);
zend_add_class_attribute(class_entry, attribute_name_AllowDynamicProperties_class_OCICollection_0, 0);
zend_string_release(attribute_name_AllowDynamicProperties_class_OCICollection_0);
return class_entry;
}

View file

@ -1,806 +0,0 @@
/*
+----------------------------------------------------------------------+
| Copyright (c) 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: |
| https://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@php.net> |
| Wez Furlong <wez@omniti.com> |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "ext/standard/info.h"
#include "php_ini.h"
#ifdef HAVE_OCI8
#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)
{
dvoid *dschp1 = NULL;
dvoid *parmp1;
dvoid *parmp2;
php_oci_collection *collection;
sword errstatus;
collection = emalloc(sizeof(php_oci_collection));
collection->connection = connection;
collection->collection = NULL;
GC_ADDREF(collection->connection->id);
/* get type handle by name */
PHP_OCI_CALL_RETURN(errstatus, 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 (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* allocate describe handle */
PHP_OCI_CALL_RETURN(errstatus, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0));
if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* describe TDO */
PHP_OCI_CALL_RETURN(errstatus, OCIDescribeAny,
(
connection->svc,
connection->err,
(dvoid *) collection->tdo,
(ub4) 0,
OCI_OTYPE_PTR,
(ub1) OCI_DEFAULT,
(ub1) OCI_PTYPE_TYPE,
dschp1
)
);
if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* get first parameter handle */
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err));
if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* get the collection type code of the attribute */
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet,
(
(dvoid*) parmp1,
(ub4) OCI_DTYPE_PARAM,
(dvoid*) &(collection->coll_typecode),
(ub4 *) 0,
(ub4) OCI_ATTR_COLLECTION_TYPECODE,
connection->err
)
);
if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
switch(collection->coll_typecode) {
case OCI_TYPECODE_TABLE:
case OCI_TYPECODE_VARRAY:
/* get collection element handle */
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet,
(
(dvoid*) parmp1,
(ub4) OCI_DTYPE_PARAM,
(dvoid*) &parmp2,
(ub4 *) 0,
(ub4) OCI_ATTR_COLLECTION_ELEMENT,
connection->err
)
);
if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* get REF of the TDO for the type */
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet,
(
(dvoid*) parmp2,
(ub4) OCI_DTYPE_PARAM,
(dvoid*) &(collection->elem_ref),
(ub4 *) 0,
(ub4) OCI_ATTR_REF_TDO,
connection->err
)
);
if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* get the TDO (only header) */
PHP_OCI_CALL_RETURN(errstatus, OCITypeByRef,
(
connection->env,
connection->err,
collection->elem_ref,
OCI_DURATION_SESSION,
OCI_TYPEGET_HEADER,
&(collection->element_type)
)
);
if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* get typecode */
PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet,
(
(dvoid*) parmp2,
(ub4) OCI_DTYPE_PARAM,
(dvoid*) &(collection->element_typecode),
(ub4 *) 0,
(ub4) OCI_ATTR_TYPECODE,
connection->err
)
);
if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
break;
/* we only support VARRAYs and TABLEs */
default:
php_error_docref(NULL, E_WARNING, "Unknown collection type %d", collection->coll_typecode);
break;
}
/* Create object to hold return table */
PHP_OCI_CALL_RETURN(errstatus, OCIObjectNew,
(
connection->env,
connection->err,
connection->svc,
OCI_TYPECODE_TABLE,
collection->tdo,
(dvoid *)0,
OCI_DURATION_DEFAULT,
TRUE,
(dvoid **) &(collection->collection)
)
);
if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* free the describe handle (Bug #44113) */
PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE));
PHP_OCI_REGISTER_RESOURCE(collection, le_collection);
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return collection;
CLEANUP:
if (dschp1) {
/* free the describe handle (Bug #44113) */
PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE));
}
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
php_oci_collection_close(collection);
return NULL;
}
/* }}} */
/* {{{ php_oci_collection_size()
Return size of the collection */
int php_oci_collection_size(php_oci_collection *collection, sb4 *size)
{
php_oci_connection *connection = collection->connection;
sword errstatus;
PHP_OCI_CALL_RETURN(errstatus, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
/* }}} */
/* {{{ php_oci_collection_max()
Return max number of elements in the collection */
int php_oci_collection_max(php_oci_collection *collection, zend_long *max)
{
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, zend_long trim_size)
{
php_oci_connection *connection = collection->connection;
sword errstatus;
PHP_OCI_CALL_RETURN(errstatus, OCICollTrim, (connection->env, connection->err, (sb4) trim_size, collection->collection));
if (errstatus != OCI_SUCCESS) {
errstatus = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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)
{
OCIInd null_index = OCI_IND_NULL;
php_oci_connection *connection = collection->connection;
sword errstatus;
/* append NULL element */
PHP_OCI_CALL_RETURN(errstatus, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection));
if (errstatus != OCI_SUCCESS) {
errstatus = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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)
{
OCIInd new_index = OCI_IND_NOTNULL;
OCIDate oci_date;
php_oci_connection *connection = collection->connection;
sword errstatus;
/* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date));
if (errstatus != OCI_SUCCESS) {
/* failed to convert string to date */
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
PHP_OCI_CALL_RETURN(errstatus, OCICollAppend,
(
connection->env,
connection->err,
(dvoid *) &oci_date,
(dvoid *) &new_index,
(OCIColl *) collection->collection
)
);
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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)
{
OCIInd new_index = OCI_IND_NOTNULL;
double element_double;
OCINumber oci_number;
php_oci_connection *connection = collection->connection;
sword errstatus;
element_double = zend_strtod(number, NULL);
PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
PHP_OCI_CALL_RETURN(errstatus, OCICollAppend,
(
connection->env,
connection->err,
(dvoid *) &oci_number,
(dvoid *) &new_index,
(OCIColl *) collection->collection
)
);
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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)
{
OCIInd new_index = OCI_IND_NOTNULL;
OCIString *ocistr = (OCIString *)0;
php_oci_connection *connection = collection->connection;
sword errstatus;
PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
PHP_OCI_CALL_RETURN(errstatus, OCICollAppend,
(
connection->env,
connection->err,
(dvoid *) ocistr,
(dvoid *) &new_index,
(OCIColl *) collection->collection
)
);
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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)
{
if (element_len == 0) {
return php_oci_collection_append_null(collection);
}
switch(collection->element_typecode) {
case OCI_TYPECODE_DATE:
return php_oci_collection_append_date(collection, element, element_len);
break;
case OCI_TYPECODE_VARCHAR2 :
return php_oci_collection_append_string(collection, element, element_len);
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);
break;
default:
php_error_docref(NULL, 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, zend_long index, zval *result_element)
{
php_oci_connection *connection = collection->connection;
dvoid *element;
OCIInd *element_index;
boolean exists;
oratext buff[1024];
ub4 buff_len = 1024;
sword errstatus;
ZVAL_NULL(result_element);
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
PHP_OCI_CALL_RETURN(errstatus, OCICollGetElem,
(
connection->env,
connection->err,
collection->collection,
(ub4)index,
&exists,
&element,
(dvoid **)&element_index
)
);
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
if (exists == 0) {
/* element doesn't exist */
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(errstatus, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
ZVAL_STRINGL(result_element, (char *)buff, buff_len);
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, (char *)str);
}
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(errstatus, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
ZVAL_DOUBLE(result_element, double_number);
return 0;
}
break;
default:
php_error_docref(NULL, E_NOTICE, "Unknown or unsupported type of element: %d", collection->element_typecode);
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, zend_long index)
{
OCIInd null_index = OCI_IND_NULL;
php_oci_connection *connection = collection->connection;
sword errstatus;
/* set NULL element */
PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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, zend_long index, char *date, int date_len)
{
OCIInd new_index = OCI_IND_NOTNULL;
OCIDate oci_date;
php_oci_connection *connection = collection->connection;
sword errstatus;
/* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date));
if (errstatus != OCI_SUCCESS) {
/* failed to convert string to date */
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem,
(
connection->env,
connection->err,
(ub4)index,
(dvoid *) &oci_date,
(dvoid *) &new_index,
(OCIColl *) collection->collection
)
);
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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, zend_long index, char *number, int number_len)
{
OCIInd new_index = OCI_IND_NOTNULL;
double element_double;
OCINumber oci_number;
php_oci_connection *connection = collection->connection;
sword errstatus;
element_double = zend_strtod(number, NULL);
PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem,
(
connection->env,
connection->err,
(ub4) index,
(dvoid *) &oci_number,
(dvoid *) &new_index,
(OCIColl *) collection->collection
)
);
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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, zend_long index, char *element, int element_len)
{
OCIInd new_index = OCI_IND_NOTNULL;
OCIString *ocistr = (OCIString *)0;
php_oci_connection *connection = collection->connection;
sword errstatus;
PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem,
(
connection->env,
connection->err,
(ub4)index,
(dvoid *) ocistr,
(dvoid *) &new_index,
(OCIColl *) collection->collection
)
);
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
/* }}} */
/* {{{ php_oci_collection_element_set()
Collection element setter */
int php_oci_collection_element_set(php_oci_collection *collection, zend_long index, char *value, int value_len)
{
if (value_len == 0) {
return php_oci_collection_element_set_null(collection, index);
}
switch(collection->element_typecode) {
case OCI_TYPECODE_DATE:
return php_oci_collection_element_set_date(collection, index, value, value_len);
break;
case OCI_TYPECODE_VARCHAR2 :
return php_oci_collection_element_set_string(collection, index, value, value_len);
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);
break;
default:
php_error_docref(NULL, 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)
{
php_oci_connection *connection = collection_dest->connection;
sword errstatus;
PHP_OCI_CALL_RETURN(errstatus, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
/* }}} */
/* {{{ php_oci_collection_close()
Destroy collection and all associated resources */
void php_oci_collection_close(php_oci_collection *collection)
{
php_oci_connection *connection = collection->connection;
sword errstatus;
if (collection->collection) {
PHP_OCI_CALL_RETURN(errstatus, OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
} else {
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
}
zend_list_delete(collection->connection->id);
efree(collection);
return;
}
/* }}} */
#endif /* HAVE_OCI8 */

View file

@ -1,36 +0,0 @@
/*
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
| Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+----------------------------------------------------------------------+
| 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: |
| https://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@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Christopher Jones <christopher.jones@oracle.com> |
+----------------------------------------------------------------------+
*/
provider phpoci {
probe oci8__check__connection(void *connection, char *client_id, int is_open, long errcode, unsigned long server_status);
probe oci8__connect__entry(char *username, char *dbname, char *charset, long session_mode, int persistent, int exclusive);
probe oci8__connect__return(void *connection);
probe oci8__connection__close(void *connection);
probe oci8__error(int status, long errcode);
probe oci8__execute__mode(void *connection, char *client_id, void *statement, unsigned int mode);
probe oci8__sqltext(void *connection, char *client_id, void *statement, char *sql);
probe oci8__connect__p__dtor__close(void *connection);
probe oci8__connect__p__dtor__release(void *connection);
probe oci8__connect__lookup(void *connection, int is_stub);
probe oci8__connect__expiry(void *connection, int is_stub, long idle_expiry, long timestamp);
probe oci8__connect__type(int persistent, int exclusive, void *connection, long num_persistent, long num_connections);
probe oci8__sesspool__create(void *session_pool);
probe oci8__sesspool__stats(unsigned long free, unsigned long busy, unsigned long open);
probe oci8__sesspool__type(int type, void *session_pool);
};

View file

@ -1,152 +0,0 @@
/*
+----------------------------------------------------------------------+
| Copyright (c) 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: |
| https://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@php.net> |
| Wez Furlong <wez@omniti.com> |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "ext/standard/info.h"
#include "php_ini.h"
#ifdef HAVE_OCI8
#include "php_oci8.h"
#include "php_oci8_int.h"
/* {{{ callback_fn()
OCI TAF callback function, calling userspace function */
sb4 callback_fn(void *svchp, void *envhp, void *fo_ctx, ub4 fo_type, ub4 fo_event)
{
/* Create zval */
zval retval, params[3];
php_oci_connection *connection = (php_oci_connection*)fo_ctx;
/* Default return value */
sb4 returnValue = 0;
/* Check if userspace callback function was unregistered */
if (Z_ISUNDEF(connection->taf_callback) || Z_ISNULL(connection->taf_callback)) {
return 0;
}
/* Initialize zval */
ZVAL_RES(&params[0], connection->id);
ZVAL_LONG(&params[1], fo_event);
ZVAL_LONG(&params[2], fo_type);
/* Call user function (if possible) */
if (call_user_function(NULL, NULL, &connection->taf_callback, &retval, 3, params) == FAILURE) {
php_error_docref(NULL, E_WARNING, "Unable to call Oracle TAF callback function");
}
/* Set return value */
if (Z_TYPE(retval) == IS_LONG) {
returnValue = (sb4) Z_LVAL(retval);
}
/* Setting params[0] to null so resource isn't destroyed on zval_ptr_dtor */
ZVAL_NULL(&params[0]);
/* Cleanup */
zval_ptr_dtor(&retval);
zval_ptr_dtor(&params[0]);
zval_ptr_dtor(&params[1]);
zval_ptr_dtor(&params[2]);
return returnValue;
}
/* }}} */
/* {{{ php_oci_unregister_taf_callback()
Unregister the userspace callback function for Oracle TAF,
while keeping the OCI callback alive */
int php_oci_unregister_taf_callback(php_oci_connection *connection)
{
return php_oci_register_taf_callback(connection, NULL);
}
/* }}} */
/* {{{ php_oci_register_taf_callback()
Register a callback function for Oracle TAF */
int php_oci_register_taf_callback(php_oci_connection *connection, zval *callback)
{
sword errstatus;
int registered = 0;
/* temporary failover callback structure */
OCIFocbkStruct failover;
if (!callback) {
/* Unregister callback */
if (Z_ISUNDEF(connection->taf_callback) || Z_ISNULL(connection->taf_callback)) {
return 0; // Nothing to unregister
}
registered = 1;
zval_ptr_dtor(&connection->taf_callback);
ZVAL_NULL(&connection->taf_callback);
} else {
if (!Z_ISUNDEF(connection->taf_callback)) {
registered = 1;
if (!Z_ISNULL(connection->taf_callback)) {
zval_ptr_dtor(&connection->taf_callback);
ZVAL_NULL(&connection->taf_callback);
}
}
/* Set userspace callback function */
ZVAL_COPY(&connection->taf_callback, callback);
}
/* OCI callback function already registered */
if (registered) {
return 0;
}
/* set context */
failover.fo_ctx = connection;
/* set callback function */
failover.callback_function = &callback_fn;
/* do the registration */
PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, (connection->server, (ub4) OCI_HTYPE_SERVER, (void *) &failover, (ub4) 0, (ub4) OCI_ATTR_FOCBK, connection->err));
if (errstatus != OCI_SUCCESS) {
zval_ptr_dtor(&connection->taf_callback);
ZVAL_UNDEF(&connection->taf_callback);
connection->errcode = php_oci_error(connection->err, errstatus);
return 1;
}
/* successful conclusion */
return 0;
}
/* }}} */
#endif /* HAVE_OCI8 */

File diff suppressed because it is too large Load diff

View file

@ -1,949 +0,0 @@
/*
+----------------------------------------------------------------------+
| Copyright (c) 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: |
| https://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@php.net> |
| Wez Furlong <wez@omniti.com> |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "ext/standard/info.h"
#include "php_ini.h"
#ifdef 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, zend_long type)
{
php_oci_descriptor *descriptor;
sword errstatus;
switch (type) {
case OCI_DTYPE_FILE:
case OCI_DTYPE_LOB:
case OCI_DTYPE_ROWID:
/* these three are allowed */
break;
default:
php_error_docref(NULL, E_WARNING, "Unknown descriptor type " ZEND_LONG_FMT, type);
return NULL;
break;
}
descriptor = ecalloc(1, sizeof(php_oci_descriptor));
descriptor->type = (ub4) type;
descriptor->connection = connection;
GC_ADDREF(descriptor->connection->id);
PHP_OCI_CALL_RETURN(errstatus, OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0));
if (errstatus != OCI_SUCCESS) {
OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus);
PHP_OCI_HANDLE_ERROR(connection, OCI_G(errcode));
efree(descriptor);
return NULL;
} else {
OCI_G(errcode) = 0; /* retain backwards compat with OCI8 1.4 */
}
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;
descriptor->is_open = 0;
descriptor->chunk_size = 0;
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);
connection->descriptor_count = 0;
}
descriptor->index = (connection->descriptor_count)++;
if (connection->descriptor_count == LONG_MAX) {
php_error_docref(NULL, E_WARNING, "Internal descriptor counter has reached limit");
php_oci_connection_descriptors_free(connection);
return NULL;
}
zend_hash_index_update_ptr(connection->descriptors, descriptor->index, descriptor);
}
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)
{
php_oci_connection *connection = descriptor->connection;
sword errstatus;
*length = 0;
if (descriptor->lob_size >= 0) {
*length = descriptor->lob_size;
return 0;
} else {
if (descriptor->type == OCI_DTYPE_FILE) {
PHP_OCI_CALL_RETURN(errstatus, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
}
PHP_OCI_CALL_RETURN(errstatus, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
descriptor->lob_size = *length;
if (descriptor->type == OCI_DTYPE_FILE) {
PHP_OCI_CALL_RETURN(errstatus, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
return 0;
}
/* }}} */
/* {{{ php_oci_lob_callback()
Append LOB portion to a memory buffer */
sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp)
{
ub4 lenp = (ub4) len;
php_oci_lob_ctx *ctx = (php_oci_lob_ctx *)ctxp;
switch (piece)
{
case OCI_LAST_PIECE:
if ((*(ctx->lob_len) + lenp) > (ctx->alloc_len)) {
/* this should not happen ever */
*(ctx->lob_data) = NULL;
*(ctx->lob_len) = 0;
return OCI_ERROR;
}
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:
if ((*(ctx->lob_len) + lenp) > ctx->alloc_len) {
/* this should not happen ever */
*(ctx->lob_data) = NULL;
*(ctx->lob_len) = 0;
return OCI_ERROR;
}
memcpy(*(ctx->lob_data) + *(ctx->lob_len), bufxp, (size_t) lenp);
*(ctx->lob_len) += lenp;
return OCI_CONTINUE;
default: {
php_error_docref(NULL, E_WARNING, "Unexpected LOB piece id received (value:%d)", piece);
*(ctx->lob_data) = NULL;
*(ctx->lob_len) = 0;
return OCI_ERROR;
}
}
}
/* }}} */
/* {{{ php_oci_lob_calculate_buffer()
Work out the size for LOB buffering */
static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, zend_long read_length)
{
php_oci_connection *connection = descriptor->connection;
ub4 chunk_size;
sword errstatus;
if (descriptor->type == OCI_DTYPE_FILE) {
return (int) read_length;
}
if (!descriptor->chunk_size) {
PHP_OCI_CALL_RETURN(errstatus, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return (int) read_length; /* we have to return original length here */
}
descriptor->chunk_size = chunk_size;
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
if ((read_length % descriptor->chunk_size) != 0) {
return (int) descriptor->chunk_size * (((int) read_length / descriptor->chunk_size) + 1);
}
return (int) read_length;
}
/* }}} */
/* {{{ php_oci_lob_read()
Read specified portion of the LOB into the buffer */
int php_oci_lob_read (php_oci_descriptor *descriptor, zend_long read_length, zend_long initial_offset, char **data, ub4 *data_len)
{
php_oci_connection *connection = descriptor->connection;
ub4 length = 0;
int buffer_size = PHP_OCI_LOB_BUFFER_SIZE;
php_oci_lob_ctx ctx;
ub1 *bufp;
oraub8 bytes_read, offset = 0;
oraub8 requested_len = read_length; /* this is by default */
oraub8 chars_read = 0;
int is_clob = 0;
sb4 bytes_per_char = 1;
sword errstatus;
*data_len = 0;
*data = NULL;
ctx.lob_len = data_len;
ctx.lob_data = data;
ctx.alloc_len = 0;
if (php_oci_lob_get_length(descriptor, &length)) {
return 1;
}
if (length <= 0) {
return 0;
}
if (initial_offset > length) {
php_error_docref(NULL, E_WARNING, "Offset must be less than size of the LOB");
return 1;
}
if (read_length == -1) {
requested_len = length;
}
if ((ub4) requested_len > (length - (ub4) 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(errstatus, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
} else {
ub2 charset_id = 0;
PHP_OCI_CALL_RETURN(errstatus, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
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) {
PHP_OCI_CALL_RETURN(errstatus, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
} else {
/* BLOBs don't have encoding, so bytes_per_char == 1 */
}
ctx.alloc_len = ((ub4) requested_len + 1) * bytes_per_char;
*data = ecalloc(bytes_per_char, requested_len + 1);
if (is_clob) {
chars_read = requested_len;
bytes_read = 0;
} else {
chars_read = 0;
bytes_read = requested_len;
}
buffer_size = ((int) requested_len < buffer_size ) ? (int) requested_len : buffer_size; /* optimize buffer size */
buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size); /* use chunk size */
bufp = (ub1 *) ecalloc(1, buffer_size);
PHP_OCI_CALL_RETURN(errstatus, 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;
}
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
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(errstatus, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
if (*data) {
efree(*data);
*data = NULL;
}
*data_len = 0;
return 1;
}
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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)
{
OCILobLocator *lob = (OCILobLocator *) descriptor->descriptor;
php_oci_connection *connection = (php_oci_connection *) descriptor->connection;
ub4 lob_length;
sword errstatus;
*bytes_written = 0;
if (php_oci_lob_get_length(descriptor, &lob_length)) {
return 1;
}
if (!data || data_len <= 0) {
return 0;
}
if (offset > descriptor->lob_current_position) {
offset = descriptor->lob_current_position;
}
PHP_OCI_CALL_RETURN(errstatus, 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 (errstatus) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
*bytes_written = 0;
return 1;
}
*bytes_written = data_len;
descriptor->lob_current_position += data_len;
if ((int) descriptor->lob_current_position > (int) 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;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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)
{
php_oci_connection *connection = descriptor->connection;
sword errstatus;
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(errstatus, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor));
} else {
PHP_OCI_CALL_RETURN(errstatus, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor));
}
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
descriptor->buffering = on_off ? PHP_OCI_LOB_BUFFER_ENABLED : PHP_OCI_LOB_BUFFER_DISABLED;
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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, zend_long length)
{
php_oci_connection *connection = descriptor_dest->connection;
ub4 length_dest, length_from, copy_len;
sword errstatus;
if (php_oci_lob_get_length(descriptor_dest, &length_dest)) {
return 1;
}
if (php_oci_lob_get_length(descriptor_from, &length_from)) {
return 1;
}
if (length == -1) {
copy_len = length_from - descriptor_from->lob_current_position;
} else {
copy_len = (ub4) length;
}
if ((int)copy_len <= 0) {
/* silently fail, there is nothing to copy */
return 1;
}
PHP_OCI_CALL_RETURN(errstatus, 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 (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
/* }}} */
/* {{{ php_oci_lob_close()
Close LOB */
int php_oci_lob_close (php_oci_descriptor *descriptor)
{
php_oci_connection *connection = descriptor->connection;
sword errstatus;
if (descriptor->is_open) {
PHP_OCI_CALL_RETURN(errstatus, OCILobClose, (connection->svc, connection->err, descriptor->descriptor));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
if (php_oci_temp_lob_close(descriptor)) {
return 1;
}
return 0;
}
/* }}} */
/* {{{ php_oci_temp_lob_close()
Close Temporary LOB */
int php_oci_temp_lob_close (php_oci_descriptor *descriptor)
{
php_oci_connection *connection = descriptor->connection;
int is_temporary;
sword errstatus;
PHP_OCI_CALL_RETURN(errstatus, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
if (is_temporary) {
PHP_OCI_CALL_RETURN(errstatus, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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, zend_long flush_flag)
{
OCILobLocator *lob = descriptor->descriptor;
php_oci_connection *connection = descriptor->connection;
sword errstatus;
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, E_WARNING, "Invalid flag value: " ZEND_LONG_FMT, 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(errstatus, OCILobFlushBuffer, (connection->svc, connection->err, lob, (ub4) flush_flag));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
/* marking buffer as enabled and not used */
descriptor->buffering = PHP_OCI_LOB_BUFFER_ENABLED;
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
/* }}} */
/* {{{ php_oci_lob_free()
Close LOB descriptor and free associated resources */
void php_oci_lob_free (php_oci_descriptor *descriptor)
{
if (!descriptor || !descriptor->connection) {
return;
}
if (descriptor->connection->descriptors) {
if (zend_hash_num_elements(descriptor->connection->descriptors) == 0) {
descriptor->connection->descriptor_count = 0;
} else {
/* delete descriptor from the hash */
zend_hash_index_del(descriptor->connection->descriptors, descriptor->index);
if (descriptor->index + 1 == descriptor->connection->descriptor_count) {
/* If the descriptor being freed is the end-most one
* allocated, then the descriptor_count is reduced so
* a future descriptor can reuse the hash table index.
* This can prevent the hash index range increasing in
* the common case that each descriptor is
* allocated/used/freed before another descriptor is
* needed. However it is possible that a script frees
* descriptors in arbitrary order which would prevent
* descriptor_count ever being reduced to zero until
* zend_hash_num_elements() returns 0.
*/
descriptor->connection->descriptor_count--;
}
}
}
/* 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);
}
if (descriptor->type == OCI_DTYPE_LOB) {
php_oci_temp_lob_close(descriptor);
}
PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type));
zend_list_delete(descriptor->connection->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)
{
int fp;
ub4 loblen;
OCILobLocator *lob = (OCILobLocator *)descriptor->descriptor;
php_oci_connection *connection = descriptor->connection;
char buf[8192];
ub4 offset = 1;
sword errstatus;
if (php_check_open_basedir(filename)) {
return 1;
}
if ((fp = VCWD_OPEN(filename, O_RDONLY|O_BINARY)) == -1) {
php_error_docref(NULL, E_WARNING, "Can't open file %s", filename);
return 1;
}
while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {
PHP_OCI_CALL_RETURN(errstatus,
OCILobWrite,
(
connection->svc,
connection->err,
lob,
&loblen,
offset,
(dvoid *) &buf,
loblen,
OCI_ONE_PIECE,
(dvoid *)0,
(OCICallbackLobWrite) 0,
(ub2) descriptor->charset_id,
(ub1) descriptor->charset_form
)
);
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
close(fp);
return 1;
} else {
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
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)
{
php_oci_connection *connection = descriptor_dest->connection;
OCILobLocator *lob_dest = descriptor_dest->descriptor;
OCILobLocator *lob_from = descriptor_from->descriptor;
ub4 dest_len, from_len;
sword errstatus;
if (php_oci_lob_get_length(descriptor_dest, &dest_len)) {
return 1;
}
if (php_oci_lob_get_length(descriptor_from, &from_len)) {
return 1;
}
if (from_len <= 0) {
return 0;
}
PHP_OCI_CALL_RETURN(errstatus, OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
/* }}} */
/* {{{ php_oci_lob_truncate()
Truncate LOB to the given length */
int php_oci_lob_truncate (php_oci_descriptor *descriptor, zend_long new_lob_length)
{
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
ub4 lob_length;
sword errstatus;
if (php_oci_lob_get_length(descriptor, &lob_length)) {
return 1;
}
if (lob_length <= 0) {
return 0;
}
if (new_lob_length < 0) {
php_error_docref(NULL, E_WARNING, "Size must be greater than or equal to 0");
return 1;
}
if (new_lob_length > lob_length) {
php_error_docref(NULL, E_WARNING, "Size must be less than or equal to the current LOB size");
return 1;
}
PHP_OCI_CALL_RETURN(errstatus, OCILobTrim, (connection->svc, connection->err, lob, (ub4) new_lob_length));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
descriptor->lob_size = (ub4) new_lob_length;
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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, zend_long offset, ub4 length, ub4 *bytes_erased)
{
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
ub4 lob_length;
sword errstatus;
*bytes_erased = 0;
if (php_oci_lob_get_length(descriptor, &lob_length)) {
return 1;
}
if (offset == -1) {
offset = descriptor->lob_current_position;
}
if (length == -1) {
length = lob_length;
}
PHP_OCI_CALL_RETURN(errstatus, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, (ub4) offset+1));
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
*bytes_erased = length;
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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)
{
php_oci_connection *connection = descriptor_first->connection;
OCILobLocator *first_lob = descriptor_first->descriptor;
OCILobLocator *second_lob = descriptor_second->descriptor;
sword errstatus;
PHP_OCI_CALL_RETURN(errstatus, OCILobIsEqual, (connection->env, first_lob, second_lob, result));
if (errstatus) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
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, zend_long type, char *data, int data_len)
{
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
ub4 bytes_written = 0;
sword errstatus;
switch (type) {
case OCI_TEMP_BLOB:
case OCI_TEMP_CLOB:
/* only these two are allowed */
break;
default:
php_error_docref(NULL, E_WARNING, "Invalid temporary lob type: " ZEND_LONG_FMT, type);
return 1;
break;
}
if (data_len < 0) {
return 1;
}
PHP_OCI_CALL_RETURN(errstatus, OCILobCreateTemporary,
(
connection->svc,
connection->err,
lob,
OCI_DEFAULT,
OCI_DEFAULT,
(ub1)type,
OCI_ATTR_NOCACHE,
OCI_DURATION_SESSION
)
);
if (errstatus) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
PHP_OCI_CALL_RETURN(errstatus, OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE));
if (errstatus) {
connection->errcode = php_oci_error(connection->err, errstatus);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
descriptor->is_open = 1;
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written);
}
/* }}} */
#endif /* HAVE_OCI8 */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,63 +0,0 @@
/*
+----------------------------------------------------------------------+
| Copyright (c) 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: |
| https://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@php.net> |
| Wez Furlong <wez@omniti.com> |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_OCI8
# ifndef PHP_OCI8_H
# define PHP_OCI8_H
#ifdef ZTS
# include "TSRM.h"
#endif
/*
* The version of the OCI8 extension.
*/
#ifdef PHP_OCI8_VERSION
/* The definition of PHP_OCI8_VERSION changed in PHP 5.3 and building
* this code with PHP 5.2 (e.g. when using OCI8 from PECL) will conflict.
*/
#undef PHP_OCI8_VERSION
#endif
#define PHP_OCI8_VERSION "3.3.0"
extern zend_module_entry oci8_module_entry;
#define phpext_oci8_ptr &oci8_module_entry
#define phpext_oci8_11g_ptr &oci8_module_entry
#define phpext_oci8_12c_ptr &oci8_module_entry
#define phpext_oci8_19_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 */

View file

@ -1,570 +0,0 @@
/*
+----------------------------------------------------------------------+
| Copyright (c) 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: |
| https://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@php.net> |
| Wez Furlong <wez@omniti.com> |
+----------------------------------------------------------------------+
*/
#ifdef 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 */
#ifdef HAVE_OCI8_DTRACE
#include "oci8_dtrace_gen.h"
#endif
#if defined(min)
#undef min
#endif
#if defined(max)
#undef max
#endif
/* }}} */
#include "ext/standard/php_string.h"
ZEND_DIAGNOSTIC_IGNORED_START("-Wstrict-prototypes")
#include <oci.h>
ZEND_DIAGNOSTIC_IGNORED_END
#if !defined(OCI_MAJOR_VERSION) || OCI_MAJOR_VERSION < 11 || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION < 2))
#error This version of PHP OCI8 requires Oracle Client libraries from 11.2 or later.
#endif
extern int le_connection;
extern int le_pconnection;
extern int le_statement;
extern int le_descriptor;
extern int le_collection;
extern int le_server;
extern int le_session;
extern zend_class_entry *oci_lob_class_entry_ptr;
extern zend_class_entry *oci_coll_class_entry_ptr;
/* {{{ 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
#ifdef OCI_ERROR_MAXMSG_SIZE2
/* Bigger size is defined from 11.2.0.3 onwards */
#define PHP_OCI_ERRBUF_LEN OCI_ERROR_MAXMSG_SIZE2
#else
#define PHP_OCI_ERRBUF_LEN OCI_ERROR_MAXMSG_SIZE
#endif
/* The mode parameter for oci_connect() is overloaded and accepts both
* privilege and external authentication flags OR'd together.
* PHP_OCI_CRED_EXT must be distinct from the OCI_xxx privilege
* values.
*/
#define PHP_OCI_CRED_EXT (1u<<31)
#if ((PHP_OCI_CRED_EXT == OCI_DEFAULT) || (PHP_OCI_CRED_EXT & (OCI_SYSOPER | OCI_SYSDBA)))
#error Invalid value for PHP_OCI_CRED_EXT
#endif
#define PHP_OCI_IMPRES_UNKNOWN 0
#define PHP_OCI_IMPRES_NO_CHILDREN 1
#define PHP_OCI_IMPRES_HAS_CHILDREN 2
#define PHP_OCI_IMPRES_IS_CHILD 3
/*
* Name passed to Oracle for tracing. Note some DB views only show
* the first nine characters of the driver name.
*/
#define PHP_OCI8_DRIVER_NAME "PHP OCI8 : " PHP_OCI8_VERSION
/* }}} */
/* {{{ php_oci_spool */
typedef struct {
zend_resource *id; /* resource id */
OCIEnv *env; /* env of this session pool */
OCIError *err; /* pool's error handle */
OCISPool *poolh; /* pool handle */
void *poolname; /* session pool name */
unsigned int poolname_len; /* length of session pool name */
zend_string *spool_hash_key; /* Hash key for session pool in plist */
} php_oci_spool;
/* }}} */
/* {{{ php_oci_connection */
typedef struct {
zend_resource *id; /* resource ID */
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 */
OCIAuthInfo *authinfo; /* Cached authinfo handle for OCISessionGet */
OCIError *err; /* private error handle */
php_oci_spool *private_spool; /* private session pool (for persistent) */
sb4 errcode; /* last ORA- error number */
HashTable *descriptors; /* descriptors hash, used to flush all the LOBs using this connection on commit */
zend_ulong descriptor_count; /* used to index the descriptors hash table. Not an accurate count */
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 rb_on_disconnect:1; /* helps to determine if we should rollback this connection on close/shutdown */
unsigned passwd_changed:1; /* helps determine if a persistent connection hash should be invalidated after a password change */
unsigned is_stub:1; /* flag to keep track whether the connection structure has a real OCI connection associated */
unsigned using_spool:1; /* Is this connection from session pool? */
time_t idle_expiry; /* time when the connection will be considered as expired */
time_t *next_pingp; /* (pointer to) time of the next ping */
zend_string *hash_key; /* hashed details of the connection */
#ifdef HAVE_OCI8_DTRACE
char *client_id; /* The oci_set_client_identifier() value */
#endif
zval taf_callback; /* The Oracle TAF callback function in the userspace */
} php_oci_connection;
/* }}} */
/* {{{ php_oci_descriptor */
typedef struct {
zend_resource *id;
zend_ulong index; /* descriptors hash table index */
php_oci_connection *connection; /* parent connection handle */
dvoid *descriptor; /* OCI descriptor handle */
ub4 type; /* descriptor type (FILE/LOB) */
ub4 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 */
unsigned is_open:1; /* helps to determine if lob is open or not */
} php_oci_descriptor;
/* }}} */
/* {{{ php_oci_lob_ctx */
typedef struct {
char **lob_data; /* address of pointer to LOB data */
ub4 *lob_len; /* address of LOB length variable (bytes) */
ub4 alloc_len;
} php_oci_lob_ctx;
/* }}} */
/* {{{ php_oci_collection */
typedef struct {
zend_resource *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;
/* }}} */
/* {{{ php_oci_define */
typedef struct {
zval val; /* zval used in define */
text *name; /* placeholder's name */
ub4 name_len; /* placeholder's name length */
ub4 type; /* define type */
} php_oci_define;
/* }}} */
/* {{{ php_oci_statement */
typedef struct {
zend_resource *id;
zend_resource *parent_stmtid; /* parent statement id */
struct php_oci_statement *impres_child_stmt;/* child of current Implicit Result Set statement handle */
ub4 impres_count; /* count of remaining Implicit Result children on parent statement handle */
php_oci_connection *connection; /* parent connection handle */
sb4 errcode; /* last ORA- error number */
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 received from Oracle */
char impres_flag; /* PHP_OCI_IMPRES_*_ */
zend_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 has_descr:1; /* statement has at least one descriptor or cursor column */
ub2 stmttype; /* statement type */
ub4 prefetch_count; /* row prefetch count */
ub4 prefetch_lob_size; /* LOB prefetch size */
} php_oci_statement;
/* }}} */
/* {{{ php_oci_bind */
typedef struct {
OCIBind *bind; /* bind handle */
zval val; /* 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 */
ub2 type; /* bind type */
struct {
void *elements;
sb2 *indicators;
ub2 *element_lengths;
ub4 current_length;
ub4 old_length;
ub4 max_length;
zend_long type;
} array;
sb2 indicator; /* -1 means NULL */
ub2 retcode;
ub4 dummy_len; /* a dummy var to store alenpp value in bind OUT callback */
} php_oci_bind;
/* }}} */
/* {{{ php_oci_out_column */
typedef struct {
php_oci_statement *statement; /* statement handle. used when fetching REFCURSORS */
php_oci_statement *nested_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 */
zend_resource *stmtid; /* statement id for cursors */
zend_resource *descid; /* descriptor id for descriptors */
void *data;
php_oci_define *define; /* define handle */
int piecewise; /* column is fetched piece-by-piece */
ub4 cb_retlen;
sb1 scale; /* column scale */
sb2 precision; /* column precision */
ub1 charset_form; /* charset form, required for NCLOBs */
ub2 charset_id; /* charset ID */
ub4 chunk_size; /* LOB chunk size */
} php_oci_out_column;
/* }}} */
/* {{{ macros */
#define PHP_OCI_CALL(func, params) \
do { \
OCI_G(in_call) = 1; \
func params; \
OCI_G(in_call) = 0; \
} while (0)
#define PHP_OCI_CALL_RETURN(__retval, func, params) \
do { \
OCI_G(in_call) = 1; \
__retval = func params; \
OCI_G(in_call) = 0; \
} while (0)
/* Check for errors that indicate the connection to the DB is no
* longer valid. If it isn't, then the PHP connection is marked to be
* reopened by the next PHP OCI8 connect command. This is most useful
* for persistent connections. The error number list is not
* exclusive. The error number comparisons and the
* OCI_ATTR_SERVER_STATUS check are done for maximum cross-version
* compatibility. In the far future, only the attribute check will be
* needed.
*/
#define PHP_OCI_HANDLE_ERROR(connection, errcode) \
do { \
ub4 serverStatus = OCI_SERVER_NORMAL; \
switch (errcode) { \
case 1013: \
zend_bailout(); \
break; \
case 22: \
case 28: \
case 378: \
case 602: \
case 603: \
case 604: \
case 609: \
case 1012: \
case 1033: \
case 1041: \
case 1043: \
case 1089: \
case 1090: \
case 1092: \
case 3113: \
case 3114: \
case 3122: \
case 3135: \
case 3136: \
case 12153: \
case 12161: \
case 27146: \
case 28511: \
(connection)->is_open = 0; \
break; \
default: \
{ \
PHP_OCI_CALL(OCIAttrGet, ((dvoid *)(connection)->server, OCI_HTYPE_SERVER, (dvoid *)&serverStatus, \
(ub4 *)0, OCI_ATTR_SERVER_STATUS, (connection)->err)); \
if (serverStatus != OCI_SERVER_NORMAL) { \
(connection)->is_open = 0; \
} \
} \
break; \
} \
php_oci_dtrace_check_connection(connection, errcode, serverStatus); \
} while (0)
#define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \
do { \
resource->id = zend_register_resource(resource, le_resource); \
} while (0)
#define PHP_OCI_ZVAL_TO_CONNECTION(zval, connection) \
if ((connection = (php_oci_connection *)zend_fetch_resource2(Z_RES_P(zval), "oci8 connection", le_connection, le_pconnection)) == NULL) { \
RETURN_THROWS(); \
}
#define PHP_OCI_ZVAL_TO_STATEMENT(zval, statement) \
if ((statement = (php_oci_statement *)zend_fetch_resource(Z_RES_P(zval), "oci8 statement", le_statement)) == NULL) { \
RETURN_THROWS(); \
}
#define PHP_OCI_ZVAL_TO_DESCRIPTOR(zval, descriptor) \
if ((descriptor = (php_oci_descriptor *)zend_fetch_resource(Z_RES_P(zval), "oci8 descriptor", le_descriptor)) == NULL) { \
RETURN_THROWS(); \
}
#define PHP_OCI_ZVAL_TO_COLLECTION(zval, collection) \
if ((collection = (php_oci_collection *)zend_fetch_resource(Z_RES_P(zval), "oci8 collection", le_collection)) == NULL) { \
RETURN_THROWS(); \
}
#define PHP_OCI_FETCH_RESOURCE_EX(zval, var, type, name, resource_type) \
do { \
var = (type) zend_fetch_resource(Z_RES_P(zval), name, resource_type); \
if (!var) { \
return 1; \
} \
} while (0)
#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(zval *data);
void php_oci_define_hash_dtor(zval *data);
void php_oci_bind_hash_dtor(zval *data);
void php_oci_descriptor_flush_hash_dtor(zval *data);
void php_oci_connection_descriptors_free(php_oci_connection *connection);
sb4 php_oci_error(OCIError *err_p, sword status);
sb4 php_oci_fetch_errmsg(OCIError *error_handle, text *error_buf, size_t error_buf_size);
int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, ub2 *error_offset);
void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclusive);
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, zend_long session_mode, int persistent, int exclusive);
int php_oci_connection_rollback(php_oci_connection *connection);
int php_oci_connection_commit(php_oci_connection *connection);
int php_oci_connection_release(php_oci_connection *connection);
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);
void php_oci_client_get_version(char *version, size_t version_size);
int php_oci_server_get_version(php_oci_connection *connection, char *version, size_t version_size);
void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_args);
int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode);
void php_oci_dtrace_check_connection(php_oci_connection *connection, sb4 errcode, ub4 serverStatus);
/* }}} */
/* {{{ lob related prototypes */
php_oci_descriptor *php_oci_lob_create(php_oci_connection *connection, zend_long type);
int php_oci_lob_get_length(php_oci_descriptor *descriptor, ub4 *length);
int php_oci_lob_read(php_oci_descriptor *descriptor, zend_long read_length, zend_long inital_offset, char **data, ub4 *data_len);
int php_oci_lob_write(php_oci_descriptor *descriptor, ub4 offset, char *data, int data_len, ub4 *bytes_written);
int php_oci_lob_flush(php_oci_descriptor *descriptor, zend_long flush_flag);
int php_oci_lob_set_buffering(php_oci_descriptor *descriptor, int on_off);
int php_oci_lob_get_buffering(php_oci_descriptor *descriptor);
int php_oci_lob_copy(php_oci_descriptor *descriptor, php_oci_descriptor *descriptor_from, zend_long length);
int php_oci_lob_close(php_oci_descriptor *descriptor);
int php_oci_temp_lob_close(php_oci_descriptor *descriptor);
int php_oci_lob_write_tmp(php_oci_descriptor *descriptor, zend_long type, char *data, int data_len);
void php_oci_lob_free(php_oci_descriptor *descriptor);
int php_oci_lob_import(php_oci_descriptor *descriptor, char *filename);
int php_oci_lob_append(php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from);
int php_oci_lob_truncate(php_oci_descriptor *descriptor, zend_long new_lob_length);
int php_oci_lob_erase(php_oci_descriptor *descriptor, zend_long offset, ub4 length, ub4 *bytes_erased);
int php_oci_lob_is_equal(php_oci_descriptor *descriptor_first, php_oci_descriptor *descriptor_second, boolean *result);
sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp);
/* }}} */
/* {{{ collection related prototypes */
php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len);
int php_oci_collection_size(php_oci_collection *collection, sb4 *size);
int php_oci_collection_max(php_oci_collection *collection, zend_long *max);
int php_oci_collection_trim(php_oci_collection *collection, zend_long trim_size);
int php_oci_collection_append(php_oci_collection *collection, char *element, int element_len);
int php_oci_collection_element_get(php_oci_collection *collection, zend_long index, zval *result_element);
int php_oci_collection_element_set(php_oci_collection *collection, zend_long index, char *value, int value_len);
int php_oci_collection_element_set_null(php_oci_collection *collection, zend_long index);
int php_oci_collection_element_set_date(php_oci_collection *collection, zend_long index, char *date, int date_len);
int php_oci_collection_element_set_number(php_oci_collection *collection, zend_long index, char *number, int number_len);
int php_oci_collection_element_set_string(php_oci_collection *collection, zend_long index, char *element, int element_len);
int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_collection *collection_from);
void php_oci_collection_close(php_oci_collection *collection);
int php_oci_collection_append_null(php_oci_collection *collection);
int php_oci_collection_append_date(php_oci_collection *collection, char *date, int date_len);
int php_oci_collection_append_number(php_oci_collection *collection, char *number, int number_len);
int php_oci_collection_append_string(php_oci_collection *collection, char *element, int element_len);
/* }}} */
/* {{{ statement related prototypes */
php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len);
php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement);
int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch);
int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows);
php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, zend_long column_index, char *column_name, int column_name_len);
int php_oci_statement_execute(php_oci_statement *statement, ub4 mode);
int php_oci_statement_cancel(php_oci_statement *statement);
void php_oci_statement_free(php_oci_statement *statement);
int php_oci_bind_pre_exec(zval *data, void *result);
int php_oci_bind_post_exec(zval *data);
int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_len, zval *var, zend_long maxlength, ub2 type);
sb4 php_oci_bind_in_callback(dvoid *ictxp, OCIBind *bindp, ub4 iter, ub4 index, dvoid **bufpp, ub4 *alenp, ub1 *piecep, dvoid **indpp);
sb4 php_oci_bind_out_callback(dvoid *octxp, OCIBind *bindp, ub4 iter, ub4 index, dvoid **bufpp, ub4 **alenpp, ub1 *piecep, dvoid **indpp, ub2 **rcodepp);
php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data);
int php_oci_cleanup_pre_fetch(zval *data);
int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type);
int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows);
int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t name_len, zval *var, zend_long max_table_length, zend_long maxlength, zend_long type);
php_oci_bind *php_oci_bind_array_helper_number(zval *var, zend_long max_table_length);
php_oci_bind *php_oci_bind_array_helper_double(zval *var, zend_long max_table_length);
php_oci_bind *php_oci_bind_array_helper_string(zval *var, zend_long max_table_length, zend_long maxlength);
php_oci_bind *php_oci_bind_array_helper_date(zval *var, zend_long max_table_length, php_oci_connection *connection);
/* }}} */
ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ Module globals */
sb4 errcode; /* global last ORA- error number. Used when connect fails, for example */
OCIError *err; /* global error handle */
zend_long max_persistent; /* maximum number of persistent connections per process */
zend_long num_persistent; /* number of existing persistent connections */
zend_long num_links; /* non-persistent + persistent connections */
zend_long num_statements; /* number of statements open */
zend_long ping_interval; /* time interval between pings */
zend_long persistent_timeout; /* time period after which idle persistent connection is considered expired */
zend_long statement_cache_size; /* statement cache size. used with 9i+ clients only*/
zend_long default_prefetch; /* default prefetch setting */
zend_long prefetch_lob_size; /* amount of LOB data to read when initially getting a LOB locator */
bool privileged_connect; /* privileged connect flag (On/Off) */
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 */
bool in_call;
char *connection_class;
bool events;
char *edition;
ZEND_END_MODULE_GLOBALS(oci) /* }}} */
/* {{{ transparent failover related prototypes */
int php_oci_register_taf_callback(php_oci_connection *connection, zval *callback);
int php_oci_unregister_taf_callback(php_oci_connection *connection);
/* }}} */
#ifdef ZTS
#define OCI_G(v) TSRMG(oci_globals_id, zend_oci_globals *, v)
#else
#define OCI_G(v) (oci_globals.v)
#endif
/* Allow install from PECL on PHP < 7.3 */
#ifndef GC_ADDREF
# define GC_ADDREF(p) (++GC_REFCOUNT(p))
#endif
#ifndef GC_DELREF
# define GC_DELREF(p) (GC_REFCOUNT(p)--)
#endif
ZEND_EXTERN_MODULE_GLOBALS(oci)
# endif /* !PHP_OCI8_INT_H */
#else /* !HAVE_OCI8 */
# define oci8_module_ptr NULL
#endif /* HAVE_OCI8 */

View file

@ -1,2 +0,0 @@
# OCI tests are network intensive and may cause timeouts in other tests
all

View file

@ -1,73 +0,0 @@
--TEST--
oci_bind_array_by_name() and invalid values 1
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_001_PKG AS
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_001_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_001_PKG 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 ARRAY_BIND_001_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_001_pkg.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-%r(01008|57000)%r: %s in %s on line %d
array(1) {
[0]=>
string(0) ""
}
Done

View file

@ -1,85 +0,0 @@
--TEST--
oci_bind_array_by_name() and invalid values 2
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_002_PKG AS
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_002_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_002_PKG 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 ARRAY_BIND_002_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_002_pkg.iobind(:c1); END;");
$array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17","05-NOV-05");
try {
oci_bind_array_by_name($statement, ":c1", $array, 0, 0, SQLT_ODT);
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}
oci_execute($statement);
var_dump($array);
echo "Done\n";
?>
--EXPECTF--
oci_bind_array_by_name(): Argument #4 ($max_array_length) must be greater than 0
Warning: oci_execute(): ORA-%r(01008|57000)%r: %s 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

View file

@ -1,81 +0,0 @@
--TEST--
oci_bind_array_by_name() and invalid values 3
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_003_PKG AS
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_003_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_003_PKG 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 ARRAY_BIND_003_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_003_pkg.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(): ORA-01403: %s
ORA-06512: at "%s.ARRAY_BIND_003_PKG", line %d
ORA-06512: at line %d in %sarray_bind_003.php 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

View file

@ -1,73 +0,0 @@
--TEST--
oci_bind_array_by_name() and invalid values 4
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_004_PKG AS
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_004_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_004_PKG 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 ARRAY_BIND_004_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_004_pkg.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(): ORA-01403: %s
ORA-06512: at "%s.ARRAY_BIND_004_PKG", line %d
ORA-06512: at line %d in %sarray_bind_004.php on line %d
array(0) {
}
Done

View file

@ -1,80 +0,0 @@
--TEST--
oci_bind_array_by_name() and invalid values 5
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_005_PKG AS
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_005_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_005_PKG 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 ARRAY_BIND_005_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_005_pkg.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";
?>
--EXPECT--
array(5) {
[0]=>
string(0) ""
[1]=>
string(0) ""
[2]=>
string(0) ""
[3]=>
string(0) ""
[4]=>
string(0) ""
}
Done

View file

@ -1,80 +0,0 @@
--TEST--
oci_bind_array_by_name(), SQLT_CHR and default max_length
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_006_PKG AS
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_006_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_006_PKG 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 ARRAY_BIND_006_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_006_pkg.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

View file

@ -1,81 +0,0 @@
--TEST--
oci_bind_array_by_name() and invalid values 7
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_007_PKG AS
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_007_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_007_PKG 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 ARRAY_BIND_007_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_007_pkg.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-%r(01008|57000)%r: %s in %s on line %d
array(5) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
}
Done

View file

@ -1,84 +0,0 @@
--TEST--
oci_bind_array_by_name() and invalid values 8
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_008_PKG AS
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_008_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_008_PKG 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 ARRAY_BIND_008_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_008_pkg.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: %s
ORA-06550: %s
PL/SQL: %s
array(5) {
[0]=>
string(1) "1"
[1]=>
string(1) "2"
[2]=>
string(1) "3"
[3]=>
string(1) "4"
[4]=>
string(1) "5"
}
Done

View file

@ -1,21 +0,0 @@
--TEST--
oci_bind_array_by_name() and invalid values 9
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
var_dump(oci_bind_array_by_name($c, ":c1", $array, 5, 5, SQLT_CHR));
?>
--EXPECTF--
Fatal error: Uncaught TypeError: oci_bind_array_by_name(): supplied resource is not a valid oci8 statement resource in %s:%d
Stack trace:
#0 %s: oci_bind_array_by_name(%s)
#1 {main}
thrown in %s on line %d

View file

@ -1,40 +0,0 @@
--TEST--
oci_bind_array_by_name() and invalid values 8
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
$statement = oci_parse($c, 'SELECT user FROM all_objects');
$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

View file

@ -1,71 +0,0 @@
--TEST--
oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_011_PKG AS
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_011_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_011_PKG 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 ARRAY_BIND_011_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_011_pkg.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-%r(01008|57000)%r: %s in %s on line %d
array(0) {
}
Done

View file

@ -1,30 +0,0 @@
--TEST--
oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
$statement = oci_parse($c, 'SELECT user FROM all_objects');
$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

View file

@ -1,47 +0,0 @@
--TEST--
oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
$statement = oci_parse($c, 'SELECT user FROM v$session');
$array = array();
try {
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -10, SQLT_CHR, -10));
} catch (ArgumentCountError $exception) {
echo $exception->getMessage() . "\n";
}
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--
oci_bind_array_by_name() expects at most 6 arguments, 7 given
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

View file

@ -1,79 +0,0 @@
--TEST--
oci_bind_array_by_name() and NUMBERs
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_014_PKG AS
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_014_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_014_PKG AS
CURSOR CUR IS SELECT name FROM bind_test;
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
BEGIN
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 ARRAY_BIND_014_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
for ($i = 1; $i < 6; $i++) {
$statement = oci_parse($c, "INSERT INTO bind_test VALUES (".$i.")");
oci_execute($statement);
}
$statement = oci_parse($c, "BEGIN array_bind_014_pkg.iobind(:c1); END;");
$array = Array();
oci_bind_array_by_name($statement, ":c1", $array, 5, -1, SQLT_INT);
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

View file

@ -1,25 +0,0 @@
--TEST--
Unsupported type: oci_bind_array_by_name() and SQLT_BDOUBLE
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
if (!defined('SQLT_BDOUBLE')) die('skip SQLT_BDOUBLE type not available on older Oracle clients');
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
$statement = oci_parse($c, "BEGIN array_bind_bdouble_pkg.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_BDOUBLE);
echo "Done\n";
?>
--EXPECTF--
Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: 22 in %sarray_bind_bdouble.php on line %d
Done

View file

@ -1,25 +0,0 @@
--TEST--
Unsupported type: oci_bind_array_by_name() and SQLT_BFLOAT
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
if (!defined('SQLT_BFLOAT')) die('skip SQLT_BFLOAT type not available on older Oracle clients');
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
$statement = oci_parse($c, "BEGIN array_bind_bfloat_pkg.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_BFLOAT);
echo "Done\n";
?>
--EXPECTF--
Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: 21 in %sarray_bind_bfloat.php on line %d
Done

View file

@ -1,80 +0,0 @@
--TEST--
oci_bind_array_by_name() and SQLT_ODT
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_DATE_PKG AS
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_DATE_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_DATE_PKG 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 ARRAY_BIND_DATE_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_date_pkg.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

View file

@ -1,80 +0,0 @@
--TEST--
oci_bind_array_by_name() and SQLT_ODT
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_DATE1_PKG AS
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_DATE1_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_DATE1_PKG 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 ARRAY_BIND_DATE1_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_date1_pkg.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

View file

@ -1,80 +0,0 @@
--TEST--
oci_bind_array_by_name() and SQLT_FLT
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_FLOAT_PKG AS
TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_FLOAT_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_FLOAT_PKG 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 ARRAY_BIND_FLOAT_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_float_pkg.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";
?>
--EXPECTF--
array(5) {
[0]=>
float(5.9999)
[1]=>
float(4.2123)
[2]=>
float(3.4234)
[3]=>
float(2.5658%S)
[4]=>
float(1.243)
}
Done

View file

@ -1,80 +0,0 @@
--TEST--
oci_bind_array_by_name() and SQLT_FLT
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_FLOAT1_PKG AS
TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_FLOAT1_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_FLOAT1_PKG 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 ARRAY_BIND_FLOAT1_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_float1_pkg.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";
?>
--EXPECTF--
array(5) {
[0]=>
float(5.9999)
[1]=>
float(4.2123)
[2]=>
float(3.4234)
[3]=>
float(2.5658%S)
[4]=>
float(1.243)
}
Done

View file

@ -1,80 +0,0 @@
--TEST--
oci_bind_array_by_name() and SQLT_INT
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_INT_PKG AS
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_INT_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_INT_PKG 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 ARRAY_BIND_INT_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_int_pkg.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

View file

@ -1,80 +0,0 @@
--TEST--
oci_bind_array_by_name() and SQLT_INT
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_INT1_PKG AS
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_INT1_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_INT1_PKG 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 ARRAY_BIND_INT1_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_int1_pkg.iobind(:c1); END;");
$array = Array(1,2,3,4,5);
oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_INT);
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

View file

@ -1,80 +0,0 @@
--TEST--
oci_bind_array_by_name() and SQLT_CHR
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_STR_PKG AS
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_STR_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_STR_PKG 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 ARRAY_BIND_STR_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_str_pkg.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

View file

@ -1,80 +0,0 @@
--TEST--
oci_bind_array_by_name() and SQLT_CHR
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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 ARRAY_BIND_STR1_PKG AS
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAY_BIND_STR1_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAY_BIND_STR1_PKG 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 ARRAY_BIND_STR1_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN array_bind_str1_pkg.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

View file

@ -1,24 +0,0 @@
--TEST--
Unsupported type: oci_bind_array_by_name() and SQLT_UIN
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
$statement = oci_parse($c, "BEGIN array_bind_uin_pkg.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_UIN);
echo "Done\n";
?>
--EXPECTF--
Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: 68 in %sarray_bind_uin.php on line %d
Done

View file

@ -1,27 +0,0 @@
--TEST--
Bug #47243 (Crash on exit with ZTS mode)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Run Test
$s = oci_parse($c, "select cursor(select dummy from dual) from dual");
oci_execute($s);
oci_fetch_all($s, $r);
// No explicit free or close
?>
===DONE===
--EXPECT--
===DONE===

View file

@ -1,28 +0,0 @@
--TEST--
Bug #47243 (Crash on exit with ZTS mode)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Run Test
$s = oci_parse($c, "select cursor(select dummy from dual) from dual");
oci_execute($s);
oci_fetch_all($s, $r);
oci_free_statement($s);
// no explicit close
?>
===DONE===
--EXPECT--
===DONE===

View file

@ -1,29 +0,0 @@
--TEST--
Bug #47243 (Crash on exit with ZTS mode)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Run Test
$s = oci_parse($c, "select cursor(select dummy from dual) from dual");
oci_execute($s);
oci_fetch_all($s, $r);
// With explicit free and close
oci_free_statement($s);
oci_close($c);
?>
===DONE===
--EXPECT--
===DONE===

View file

@ -1,137 +0,0 @@
--TEST--
Basic PL/SQL "BOOLEAN" (SQLT_BOL) bind test
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
require __DIR__.'/connect.inc';
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
if (!(isset($matches[0]) && $matches[1] >= 12)) {
die("skip expected output only valid when using Oracle Database 12c or greater");
}
preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
if (!(isset($matches[0]) && $matches[0] >= 12)) {
die("skip works only with Oracle 12c or greater version of Oracle client libraries");
}
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Run Test
echo "Test 1\n";
$sql = "begin
:output1 := true;
:output2 := false;
end;";
$s = oci_parse($c, $sql);
oci_bind_by_name($s, ':output1', $output1, -1, OCI_B_BOL);
oci_bind_by_name($s, ':output2', $output2, -1, OCI_B_BOL);
oci_execute($s);
var_dump($output1);
var_dump($output2);
echo "Test 2\n";
$b = "abc"; // bind var type will change
$sql = "begin :b := true; end;";
$s = oci_parse($c, $sql);
oci_bind_by_name($s, ':b', $b, -1, OCI_B_BOL);
oci_execute($s);
var_dump($b);
echo "Test 3\n";
$sql =
"begin
if (:input < 10) then
:output := true;
else
:output := false;
end if;
end;";
$s = oci_parse($c, $sql);
oci_bind_by_name($s, ':output', $output, -1, OCI_B_BOL);
for ($input = 5; $input < 15; ++$input) {
oci_bind_by_name($s, ':input', $input);
oci_execute($s);
var_dump($output);
}
echo "Test 4\n";
$sql =
"begin
if (mod(:userid,2) = 0) then
:b := true;
else
:b := false;
end if;
end;";
$s = oci_parse($c, $sql);
oci_bind_by_name($s, ':b', $b, -1, OCI_B_BOL);
for ($userid = 1; $userid <= 10; ++$userid) {
oci_bind_by_name($s, ':userid', $userid, -1, SQLT_INT);
oci_execute($s);
var_dump($b);
}
echo "Test 5\n";
$sql =
"declare
l boolean;
begin
l := :b1;
:b1 := :b2;
:b2 := l;
end;";
$s = oci_parse($c, $sql);
$b1 = true;
$b2 = false;
var_dump($b1, $b2);
oci_bind_by_name($s, ':b1', $b1, -1, OCI_B_BOL);
oci_bind_by_name($s, ':b2', $b2, -1, OCI_B_BOL);
oci_execute($s);
var_dump($b1, $b2);
?>
--EXPECT--
Test 1
bool(true)
bool(false)
Test 2
bool(true)
Test 3
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
Test 4
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
Test 5
bool(true)
bool(false)
bool(false)
bool(true)

View file

@ -1,293 +0,0 @@
--TEST--
SELECT oci_bind_by_name with SQLT_AFC aka CHAR
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
require __DIR__.'/connect.inc';
// The bind buffer size edge cases seem to change each DB version.
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
if (!(isset($matches[0]) && $matches[1] >= 12)) {
die("skip expected output only valid when using Oracle 12c database");
}
?>
--ENV--
NLS_LANG=.AL32UTF8
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"drop table bind_char_tab",
"create table bind_char_tab (id number, c1 char(10), c2 varchar2(10))",
"insert into bind_char_tab values (1, 'abc', NULL)",
"insert into bind_char_tab values (2, NULL, 'abc')",
"insert into bind_char_tab values (3, NULL, 'abc ')"
);
oci8_test_sql_execute($c, $stmtarray);
// Run Test
echo "*** Non-null Data Tests against CHAR***\n";
$bv1 = 'abc';
echo "Test 1.1: Type: default. Length: default\n";
$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv");
$r = oci_bind_by_name($s, ":bv", $bv1);
if ($r)
do_e_q($s);
echo "Test 1.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 1.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 1.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 1.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 1.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
if ($r)
do_e_q($s);
echo "\n\n*** NULL data tests against CHAR ***\n";
$bv1 = null;
echo "Test 2.1: Type: default. Length: default\n";
$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv");
$r = oci_bind_by_name($s, ":bv", $bv1);
if ($r)
do_e_q($s);
echo "Test 2.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 2.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 2.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 2.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 2.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 1, SQLT_AFC);
if ($r)
do_e_q($s);
echo "\n\n*** Non-null Data Tests against VARCHAR2***\n";
$bv1 = 'abc';
echo "Test 3.1: Type: default. Length: default\n";
$s = oci_parse($c, "select * from bind_char_tab where c2 = :bv");
$r = oci_bind_by_name($s, ":bv", $bv1);
if ($r)
do_e_q($s);
echo "Test 3.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 3.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 3.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 3.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 3.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
if ($r)
do_e_q($s);
echo "\n\n*** NULL data tests against VARCHAR2 ***\n";
$bv1 = null;
echo "Test 4.1: Type: default. Length: default\n";
$s = oci_parse($c, "select * from bind_char_tab where c2 = :bv");
$r = oci_bind_by_name($s, ":bv", $bv1);
if ($r)
do_e_q($s);
echo "Test 4.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 4.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 4.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 4.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 4.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, +1, SQLT_AFC);
if ($r)
do_e_q($s);
function do_e_q($s)
{
echo " Querying:\n";
$r = @oci_execute($s);
if (!$r) {
$m = oci_error($s);
echo " Oci_execute error ORA-".$m['code']." Exiting Query\n";
return;
}
while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
foreach ($row as $item) {
echo " :" . $item . ":\n";
}
}
}
// Cleanup
$stmtarray = array(
"drop table bind_char_tab"
);
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECT--
*** Non-null Data Tests against CHAR***
Test 1.1: Type: default. Length: default
Querying:
Test 1.2: Type: AFC. Length: default
Querying:
:1:
:abc :
::
Test 1.3: Type: AFC: Length: 0
Querying:
:1:
:abc :
::
Test 1.4: Type: AFC: Length: strlen
Querying:
:1:
:abc :
::
Test 1.5: Type: AFC. Length: strlen-1
Querying:
Test 1.6: Type: AFC. Length: strlen+1
Querying:
:1:
:abc :
::
*** NULL data tests against CHAR ***
Test 2.1: Type: default. Length: default
Querying:
Test 2.2: Type: AFC. Length: default
Querying:
Test 2.3: Type: AFC: Length: 0
Querying:
Test 2.4: Type: AFC: Length: strlen
Querying:
Test 2.5: Type: AFC. Length: strlen-1
Querying:
Test 2.6: Type: AFC. Length: strlen+1
Querying:
*** Non-null Data Tests against VARCHAR2***
Test 3.1: Type: default. Length: default
Querying:
:2:
::
:abc:
Test 3.2: Type: AFC. Length: default
Querying:
:2:
::
:abc:
Test 3.3: Type: AFC: Length: 0
Querying:
:2:
::
:abc:
Test 3.4: Type: AFC: Length: strlen
Querying:
:2:
::
:abc:
Test 3.5: Type: AFC. Length: strlen-1
Querying:
Test 3.6: Type: AFC. Length: strlen+1
Querying:
:2:
::
:abc:
*** NULL data tests against VARCHAR2 ***
Test 4.1: Type: default. Length: default
Querying:
Test 4.2: Type: AFC. Length: default
Querying:
Test 4.3: Type: AFC: Length: 0
Querying:
Test 4.4: Type: AFC: Length: strlen
Querying:
Test 4.5: Type: AFC. Length: strlen-1
Querying:
Test 4.6: Type: AFC. Length: strlen+1
Querying:
Done

View file

@ -1,119 +0,0 @@
--TEST--
SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
require __DIR__.'/connect.inc';
// The bind buffer size edge cases seem to change each DB version.
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
if (!(isset($matches[0]) && $matches[1] >= 12)) {
die("skip expected output only valid when using Oracle 12c database");
}
?>
--ENV--
NLS_LANG=.AL32UTF8
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"alter session set nls_date_format='YYYY-MM-DD'",
"drop table bind_char_tab",
"create table bind_char_tab (id number, c1 date)",
"insert into bind_char_tab values (1, '2008-04-20')",
);
oci8_test_sql_execute($c, $stmtarray);
// Run Test
$bv1 = '2008-04-20';
echo "Test 1.1: Type: default. Length: default\n";
$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv");
$r = oci_bind_by_name($s, ":bv", $bv1);
if ($r)
do_e_q($s);
echo "Test 1.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 1.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 1.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 1.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
if ($r)
do_e_q($s);
echo "Test 1.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
if ($r)
do_e_q($s);
function do_e_q($s)
{
echo " Querying:\n";
$r = @oci_execute($s);
if (!$r) {
$m = oci_error($s);
echo " Oci_execute error ORA-".$m['code']." Exiting Query\n";
return;
}
while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
foreach ($row as $item) {
echo " :" . $item . ":\n";
}
}
}
// Cleanup
$stmtarray = array(
"drop table bind_char_tab"
);
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECT--
Test 1.1: Type: default. Length: default
Querying:
:1:
:2008-04-20:
Test 1.2: Type: AFC. Length: default
Querying:
:1:
:2008-04-20:
Test 1.3: Type: AFC: Length: 0
Querying:
:1:
:2008-04-20:
Test 1.4: Type: AFC: Length: strlen
Querying:
:1:
:2008-04-20:
Test 1.5: Type: AFC. Length: strlen-1
Querying:
Test 1.6: Type: AFC. Length: strlen+1
Querying:
:1:
:2008-04-20:
Done

View file

@ -1,338 +0,0 @@
--TEST--
PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
require __DIR__.'/connect.inc';
// The bind buffer size edge cases seem to change each DB version.
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
if (!(isset($matches[0]) && $matches[1] >= 12)) {
die("skip expected output only valid when using Oracle 12c database");
}
?>
--ENV--
NLS_LANG=.AL32UTF8
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
);
oci8_test_sql_execute($c, $stmtarray);
// Run Test
echo "Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default\n";
$s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;");
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n";
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC\n";
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC\n";
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC\n";
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "\n\nTests with ''\n\n";
echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 2.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n";
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC\n";
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. Out Type: AFC\n";
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. Out Type: AFC\n";
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "\n\nTests with NULL\n";
echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 3.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n";
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC\n";
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. Out Type: AFC\n";
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
function do_e($s)
{
echo " Executing:\n";
$r = @oci_execute($s);
if (!$r) {
$m = oci_error($s);
echo " Oci_execute error ORA-".$m['code']."\n";
return;
}
}
// Cleanup
$stmtarray = array(
"drop function bind_char_3_fn"
);
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECT--
Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default
Executing:
Oci_execute error ORA-6502
string(3) "abc"
NULL
Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default
Executing:
string(3) "abc"
string(3) "abc"
Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default
Executing:
string(3) "abc"
string(3) "abc"
Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
Executing:
string(3) "abc"
string(10) "abc "
Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC
Executing:
string(3) "abc"
string(3) "abc"
Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC
Executing:
Oci_execute error ORA-6502
string(3) "abc"
string(3) "abc"
Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC
Executing:
string(3) "abc"
string(4) "abc "
Tests with ''
Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
Executing:
string(0) ""
NULL
Test 2.2 In Length: default. In Type: default. Out Length: 10. Out Type: default
Executing:
string(0) ""
NULL
Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default
Executing:
string(0) ""
NULL
Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
Executing:
string(0) ""
NULL
Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC
Executing:
string(0) ""
NULL
Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. Out Type: AFC
Executing:
string(0) ""
NULL
Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. Out Type: AFC
Executing:
string(0) ""
NULL
Tests with NULL
Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
Executing:
NULL
NULL
Test 3.2 In Length: default. In Type: default. Out Length: 10. Out Type: default
Executing:
NULL
NULL
Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default
Executing:
NULL
NULL
Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
Executing:
NULL
NULL
Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC
Executing:
NULL
NULL
Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. Out Type: AFC
Executing:
NULL
NULL
Done

View file

@ -1,340 +0,0 @@
--TEST--
PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
require __DIR__.'/connect.inc';
// The bind buffer size edge cases seem to change each DB version.
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
if (!(isset($matches[0]) && $matches[1] >= 12)) {
die("skip expected output only valid when using Oracle 12c database");
}
?>
--ENV--
NLS_LANG=.AL32UTF8
--FILE--
<?php
// Same test as bind_char_3 but the PL/SQL function uses VARCHAR2 instead of CHAR
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
);
oci8_test_sql_execute($c, $stmtarray);
// Run Test
echo "Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default\n";
$s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;");
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n";
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC\n";
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC\n";
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC\n";
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "\n\nTests with ''\n\n";
echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 2.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n";
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC\n";
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. Out Type: AFC\n";
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. Out Type: AFC\n";
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "\n\nTests with NULL\n";
echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 3.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n";
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n";
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC\n";
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. Out Type: AFC\n";
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
if ($r)
do_e($s);
var_dump($bv1, $bv2);
function do_e($s)
{
echo " Executing:\n";
$r = @oci_execute($s);
if (!$r) {
$m = oci_error($s);
echo " Oci_execute error ORA-".$m['code']."\n";
return;
}
}
// Cleanup
$stmtarray = array(
"drop function bind_char_3_fn"
);
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECT--
Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default
Executing:
Oci_execute error ORA-6502
string(3) "abc"
NULL
Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default
Executing:
string(3) "abc"
string(3) "abc"
Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default
Executing:
string(3) "abc"
string(3) "abc"
Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
Executing:
string(3) "abc"
string(10) "abc "
Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC
Executing:
string(3) "abc"
string(3) "abc"
Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC
Executing:
Oci_execute error ORA-6502
string(3) "abc"
string(3) "abc"
Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC
Executing:
string(3) "abc"
string(4) "abc "
Tests with ''
Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
Executing:
string(0) ""
NULL
Test 2.2 In Length: default. In Type: default. Out Length: 10. Out Type: default
Executing:
string(0) ""
NULL
Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default
Executing:
string(0) ""
NULL
Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
Executing:
string(0) ""
NULL
Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC
Executing:
string(0) ""
NULL
Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. Out Type: AFC
Executing:
string(0) ""
NULL
Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. Out Type: AFC
Executing:
string(0) ""
NULL
Tests with NULL
Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
Executing:
NULL
NULL
Test 3.2 In Length: default. In Type: default. Out Length: 10. Out Type: default
Executing:
NULL
NULL
Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default
Executing:
NULL
NULL
Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC
Executing:
NULL
NULL
Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC
Executing:
NULL
NULL
Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. Out Type: AFC
Executing:
NULL
NULL
Done

View file

@ -1,128 +0,0 @@
--TEST--
binding empty values
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
$drop = "DROP table bind_empty_tab";
$statement = oci_parse($c, $drop);
@oci_execute($statement);
$create = "CREATE table bind_empty_tab(name VARCHAR(10))";
$statement = oci_parse($c, $create);
oci_execute($statement);
echo "Test 1\n";
$name = null;
$stmt = oci_parse($c, "UPDATE bind_empty_tab SET name=:name");
oci_bind_by_name($stmt, ":name", $name);
var_dump(oci_execute($stmt));
echo "Test 2\n";
$name = "";
$stmt = oci_parse($c, "UPDATE bind_empty_tab SET name=:name");
oci_bind_by_name($stmt, ":name", $name);
var_dump(oci_execute($stmt));
echo "Test 3\n";
$stmt = oci_parse($c, "INSERT INTO bind_empty_tab (NAME) VALUES ('abc')");
$res = oci_execute($stmt);
$stmt = oci_parse($c, "INSERT INTO bind_empty_tab (NAME) VALUES ('def')");
$res = oci_execute($stmt);
$name = null;
$stmt = oci_parse($c, "UPDATE bind_empty_tab SET name=:name WHERE NAME = 'abc'");
oci_bind_by_name($stmt, ":name", $name);
var_dump(oci_execute($stmt));
$stid = oci_parse($c, "select * from bind_empty_tab order by 1");
oci_execute($stid);
oci_fetch_all($stid, $res);
var_dump($res);
echo "Test 4\n";
$name = "";
$stmt = oci_parse($c, "UPDATE bind_empty_tab SET name=:name WHERE NAME = 'def'");
oci_bind_by_name($stmt, ":name", $name);
var_dump(oci_execute($stmt));
$stid = oci_parse($c, "select * from bind_empty_tab order by 1");
oci_execute($stid);
oci_fetch_all($stid, $res);
var_dump($res);
echo "Test 5\n";
$av = $bv = 'old';
$s = oci_parse($c, "begin :bv := null; end; ");
oci_bind_by_name($s, ":bv", $bv);
oci_execute($s);
var_dump($av);
var_dump($bv);
echo "Test 6\n";
$av = $bv = null;
$s = oci_parse($c, "begin :bv := null; end; ");
oci_bind_by_name($s, ":bv", $bv);
oci_execute($s);
var_dump($av);
var_dump($bv);
// Clean up
$drop = "DROP table bind_empty_tab";
$statement = oci_parse($c, $drop);
@oci_execute($statement);
?>
--EXPECT--
Test 1
bool(true)
Test 2
bool(true)
Test 3
bool(true)
array(1) {
["NAME"]=>
array(2) {
[0]=>
string(3) "def"
[1]=>
NULL
}
}
Test 4
bool(true)
array(1) {
["NAME"]=>
array(2) {
[0]=>
NULL
[1]=>
NULL
}
}
Test 5
string(3) "old"
NULL
Test 6
NULL
NULL

View file

@ -1,72 +0,0 @@
--TEST--
bind LONG field
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
$stmt = oci_parse($c, "drop table phptestlng");
@oci_execute($stmt);
$stmt = oci_parse($c, "create table phptestlng( id number(10), filetxt long)");
oci_execute($stmt);
echo "Test 1\n";
$stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)");
$i=1;
$filetxt1 = file_get_contents( __DIR__."/test.txt");
$filetxt = str_replace("\r", "", $filetxt1);
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 where id = 1");
oci_execute($stmt);
$row = oci_fetch_row($stmt);
var_dump(md5($row[0]));
var_dump(strlen($row[0]));
echo "Test 2 - test multi chunk fetch\n";
$stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)");
$i=2;
$filetxt = str_repeat($filetxt, 600);
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 where id = 2");
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--
Test 1
string(32) "5c7c34abf7ea51936785062dbfcaeddc"
int(394)
Test 2 - test multi chunk fetch
string(32) "ee2e98b977341cfb8e037066e5fcb909"
int(236400)
Done

View file

@ -1,44 +0,0 @@
--TEST--
bind LONG RAW field
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__."/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( __DIR__."/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

View file

@ -1,366 +0,0 @@
--TEST--
Bind miscellaneous column types using default types
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"alter session set nls_date_format = 'DD-MON-YY'",
"drop table bind_misccoltypes_tab",
"create table bind_misccoltypes_tab (
id number,
char_t char(1),
char_t10 char(10),
varchar2_t10 varchar2(10),
number_t number,
number_t92 number(9,2),
number_t6 number(6),
date_t date,
timestamp_t timestamp,
float_t float,
binary_float_t binary_float,
binary_double_t binary_double,
decimal_t decimal,
integer_t integer,
nchar_t nchar(10),
nvarchar2_t10 nvarchar2(10),
varchar_t10 varchar(10) )",
);
oci8_test_sql_execute($c, $stmtarray);
function check_col($c, $colname, $id)
{
$s = oci_parse($c, "select $colname from bind_misccoltypes_tab where id = :id");
oci_bind_by_name($s, ":id", $id);
oci_execute($s);
oci_fetch_all($s, $r);
var_dump($r);
}
// Tests
echo "\nTEST86 insert all ORATYPE values\n";
$insert_sql = "INSERT INTO bind_misccoltypes_tab ( id, "
. " char_t, "
. " char_t10, "
. " varchar2_t10, "
. " number_t, "
. " number_t92, "
. " number_t6, "
. " date_t, "
. " timestamp_t, "
. " float_t, "
. " binary_float_t, "
. " binary_double_t, "
. " decimal_t, "
. " integer_t, "
. " nchar_t, "
. " nvarchar2_t10, "
. " varchar_t10) "
. " VALUES (:n1, "
. " :c1, "
. " :c2, "
. " :c3, "
. " :n2, "
. " :n3, "
. " :n4, "
. " to_date(:d1, 'YYYY-MM-DD HH24:MI:SS'), "
. " to_timestamp(:d1, 'YYYY-MM-DD HH24:MI:SS'), "
. " :n5, "
. " :n5, "
. " :n5, "
. " :n1, "
. " :n1, "
. " :c4, "
. " :c5, "
. " :c6) ";
$n1 = "86";
$c1 = "C";
$c2 = "char10";
$c3 = "varchar210";
$n2 = "-123.456";
$n3 = "789.346";
$n4 = "123456.023";
$n5 = "12345678901234567890123456789012345678.723";
$d1 = "2010-03-29 13:09:15";
$c4 = "nchar10";
$c5 = "nvarchar2x";
$c6 = "varchar";
$s = oci_parse($c, $insert_sql);
oci_bind_by_name($s, ":n1", $n1);
oci_bind_by_name($s, ":c1", $c1);
oci_bind_by_name($s, ":c2", $c2);
oci_bind_by_name($s, ":c3", $c3);
oci_bind_by_name($s, ":n2", $n2);
oci_bind_by_name($s, ":n3", $n3);
oci_bind_by_name($s, ":n4", $n4);
oci_bind_by_name($s, ":d1", $d1);
oci_bind_by_name($s, ":n5", $n5);
oci_bind_by_name($s, ":c4", $c4);
oci_bind_by_name($s, ":c5", $c5);
oci_bind_by_name($s, ":c6", $c6);
oci_execute($s);
echo "\nTEST87 SELECT all values using DEFINEs\n";
$select_sql = "select "
. "id, "
. "char_t, "
. "char_t10, "
. "varchar2_t10, "
. "number_t, "
. "number_t92, "
. "number_t6, "
. "date_t, "
. "timestamp_t, "
. "float_t, "
. "binary_float_t, "
. "binary_double_t, "
. "decimal_t, "
. "integer_t, "
. "nchar_t, "
. "nvarchar2_t10, "
. "varchar_t10 "
. "from bind_misccoltypes_tab where id = 86";
$s = oci_parse($c, $select_sql);
oci_define_by_name($s, "ID", $ID);
oci_define_by_name($s, "CHAR_T", $CHAR_T);
oci_define_by_name($s, "CHAR_T10", $CHAR_T10);
oci_define_by_name($s, "VARCHAR2_T10", $VARCHAR2_T10);
oci_define_by_name($s, "NUMBER_T", $NUMBER_T);
oci_define_by_name($s, "NUMBER_T92", $NUMBER_T92);
oci_define_by_name($s, "NUMBER_T6", $NUMBER_T6);
oci_define_by_name($s, "DATE_T", $DATE_T);
oci_define_by_name($s, "TIMESTAMP_T", $TIMESTAMP_T);
oci_define_by_name($s, "FLOAT_T", $FLOAT_T);
oci_define_by_name($s, "BINARY_FLOAT_T", $BINARY_FLOAT_T);
oci_define_by_name($s, "BINARY_DOUBLE_T", $BINARY_DOUBLE_T);
oci_define_by_name($s, "DECIMAL_T", $DECIMAL_T);
oci_define_by_name($s, "INTEGER_T", $INTEGER_T);
oci_define_by_name($s, "NCHAR_T", $NCHAR_T);
oci_define_by_name($s, "NVARCHAR2_T10", $NVARCHAR2_T10);
oci_define_by_name($s, "VARCHAR_T10", $VARCHAR_T10);
oci_execute($s);
while (oci_fetch($s)) {
echo "ID is " . "$ID\n";
echo "CHAR_T is " . "$CHAR_T\n";
echo "CHAR_T10 is " . "$CHAR_T10\n";
echo "VARCHAR2_T10 is " . "$VARCHAR2_T10\n";
echo "NUMBER_T is " . "$NUMBER_T\n";
echo "NUMBER_T92 is " . "$NUMBER_T92\n";
echo "NUMBER_T6 is " . "$NUMBER_T6\n";
echo "DATE_T is " . "$DATE_T\n";
echo "TIMESTAMP_T is " . "$TIMESTAMP_T\n";
echo "FLOAT_T is " . "$FLOAT_T\n";
echo "BINARY_FLOAT_T is " . "$BINARY_FLOAT_T\n";
echo "BINARY_DOUBLE_T is " . "$BINARY_DOUBLE_T\n";
echo "DECIMAL_T is " . "$DECIMAL_T\n";
echo "INTEGER_T is " . "$INTEGER_T\n";
echo "NCHAR_T is " . "$NCHAR_T\n";
echo "NVARCHAR2_T10 is " . "$NVARCHAR2_T10\n";
echo "VARCHAR_T10 is " . "$VARCHAR_T10\n";
}
echo "\nTEST52 insert numbers\n";
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t92) VALUES (52, :n1)");
$n1 = 3;
oci_bind_by_name($s, ":n1", $n1);
oci_execute($s);
check_col($c, 'number_t92', 52);
echo "\nTEST53 insert numbers \n";
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t92) VALUES (53, :n1)");
$n1 = 8.67;
oci_bind_by_name($s, ":n1", $n1);
oci_execute($s);
check_col($c, 'number_t92', 53);
echo "\nTEST54 insert numbers \n";
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t) VALUES (54, :n1)");
$n1 = 4.67;
oci_bind_by_name($s, ":n1", $n1);
oci_execute($s);
check_col($c, 'number_t', 54);
echo "\nTEST55 insert numbers \n";
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t) VALUES (55, :n1)");
$n1 = "7.67";
oci_bind_by_name($s, ":n1", $n1);
oci_execute($s);
check_col($c, 'number_t', 55);
echo "\nTEST56 insert numbers \n";
$n1 = -5.67;
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t) VALUES (56, :n1)");
oci_bind_by_name($s, ":n1", $n1);
oci_execute($s);
check_col($c, 'number_t', 56);
echo "\nTEST58 insert a VARCHAR2\n";
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, varchar2_t10) VALUES (58, :c2)");
$c2 = "Hood";
oci_bind_by_name($s, ":c2", $c2);
oci_execute($s);
check_col($c, 'varchar2_t10', 58);
echo "\nTEST59 insert a VARCHAR2\n";
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, char_t10) VALUES (59, :c2)");
$c2 = "Hood";
oci_bind_by_name($s, ":c2", $c2);
oci_execute($s);
check_col($c, 'char_t10', 59);
echo "\nTEST60 insert a date\n";
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, date_t) VALUES (60, to_date(:c2, 'YYYY-MM-DD'))");
$c2 = '2010-04-09';
oci_bind_by_name($s, ":c2", $c2);
oci_execute($s);
check_col($c, 'date_t', 60);
// Clean up
$stmtarray = array(
"drop table bind_misccoltypes_tab"
);
oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
?>
--EXPECT--
TEST86 insert all ORATYPE values
TEST87 SELECT all values using DEFINEs
ID is 86
CHAR_T is C
CHAR_T10 is char10
VARCHAR2_T10 is varchar210
NUMBER_T is -123.456
NUMBER_T92 is 789.35
NUMBER_T6 is 123456
DATE_T is 29-MAR-10
TIMESTAMP_T is 29-MAR-10 01.09.15.000000 PM
FLOAT_T is 12345678901234567890123456789012345679
BINARY_FLOAT_T is 1.23456784E+037
BINARY_DOUBLE_T is 1.2345678901234568E+037
DECIMAL_T is 86
INTEGER_T is 86
NCHAR_T is nchar10
NVARCHAR2_T10 is nvarchar2x
VARCHAR_T10 is varchar
TEST52 insert numbers
array(1) {
["NUMBER_T92"]=>
array(1) {
[0]=>
string(1) "3"
}
}
TEST53 insert numbers
array(1) {
["NUMBER_T92"]=>
array(1) {
[0]=>
string(4) "8.67"
}
}
TEST54 insert numbers
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(4) "4.67"
}
}
TEST55 insert numbers
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(4) "7.67"
}
}
TEST56 insert numbers
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(5) "-5.67"
}
}
TEST58 insert a VARCHAR2
array(1) {
["VARCHAR2_T10"]=>
array(1) {
[0]=>
string(4) "Hood"
}
}
TEST59 insert a VARCHAR2
array(1) {
["CHAR_T10"]=>
array(1) {
[0]=>
string(10) "Hood "
}
}
TEST60 insert a date
array(1) {
["DATE_T"]=>
array(1) {
[0]=>
string(9) "09-APR-10"
}
}

View file

@ -1,170 +0,0 @@
--TEST--
Bind miscellaneous column types and generating errors
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"drop table bind_misccoltypes_errs_tab",
"create table bind_misccoltypes_errs_tab (
id number,
char_t char(1),
char_t10 char(10),
varchar2_t10 varchar2(10),
number_t number,
number_t92 number(9,2),
number_t6 number(6),
date_t date,
timestamp_t timestamp,
float_t float,
binary_float_t binary_float,
binary_double_t binary_double,
decimal_t decimal,
integer_t integer,
nchar_t nchar(10),
nvarchar2_t10 nvarchar2(10),
varchar_t10 varchar(10) )",
);
oci8_test_sql_execute($c, $stmtarray);
function check_col($c, $colname, $id)
{
$s = oci_parse($c, "select $colname from bind_misccoltypes_errs_tab where id = :id");
oci_bind_by_name($s, ":id", $id);
oci_execute($s);
oci_fetch_all($s, $r);
var_dump($r);
}
// Tests
echo "\nTest 1 insert numbers\n";
$n1 = -23253245.3432467;
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, number_t6) VALUES (1, :n1)");
oci_bind_by_name($s, ":n1", $n1);
oci_execute($s);
check_col($c, 'number_t6', 57);
echo "\nTest 2 insert numbers\n";
$n1 = "Hello";
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, number_t6) VALUES (2, :n1)");
oci_bind_by_name($s, ":n1", $n1);
oci_execute($s);
check_col($c, 'number_t6', 57);
echo "\nTest 3 - too long CHAR\n";
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, char_t) VALUES (3, :c2)");
$c2 = "AB";
oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
oci_execute($s);
echo "\nTest 4 - too long VARCHAR2\n";
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, varchar2_t10) VALUES (4, :c2)");
$c2 = "AAAAAAAAAAB";
oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
oci_execute($s);
echo "\nTest 5 - invalid number\n";
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, number_t) VALUES (5, :c2)");
$c2 = "ABC";
oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
oci_execute($s);
echo "\nTest 6 - insert a VARCHAR2 with SQLT_BIN\n";
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, varchar2_t10) VALUES (6, :c2)");
$c2 = "Hood 6";
oci_bind_by_name($s, ":c2", $c2, -1, SQLT_BIN);
oci_execute($s);
check_col($c, 'varchar2_t10', 6);
echo "\nTest 7 - insert a VARCHAR2 with SQLT_LBI\n";
$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, varchar2_t10) VALUES (7, :c2)");
$c2 = "Hood 7";
oci_bind_by_name($s, ":c2", $c2, -1, SQLT_LBI);
oci_execute($s);
check_col($c, 'varchar2_t10', 7);
// Clean up
$stmtarray = array(
"drop table bind_misccoltypes_errs_tab"
);
oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
?>
--EXPECTF--
Test 1 insert numbers
Warning: oci_execute(): ORA-01438: %s in %sbind_misccoltypes_errs.php on line %d
array(1) {
["NUMBER_T6"]=>
array(0) {
}
}
Test 2 insert numbers
Warning: oci_execute(): ORA-01722: %s in %sbind_misccoltypes_errs.php on line %d
array(1) {
["NUMBER_T6"]=>
array(0) {
}
}
Test 3 - too long CHAR
Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."CHAR_T" \(%s: 2, %s: 1\)|String data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
Test 4 - too long VARCHAR2
Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."VARCHAR2_T10" \(%s: 11, %s: 10\)|%s data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
Test 5 - invalid number
Warning: oci_execute(): ORA-01722: %s in %sbind_misccoltypes_errs.php on line %d
Test 6 - insert a VARCHAR2 with SQLT_BIN
Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."VARCHAR2_T10" \(%s: 12, %s: 10\)|String data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
array(1) {
["VARCHAR2_T10"]=>
array(0) {
}
}
Test 7 - insert a VARCHAR2 with SQLT_LBI
Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."VARCHAR2_T10" \(%s: 12, %s: 10\)|String data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
array(1) {
["VARCHAR2_T10"]=>
array(0) {
}
}

View file

@ -1,214 +0,0 @@
--TEST--
Bind with NUMBER column variants
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--INI--
precision = 14
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"drop table bind_number_tab",
"create table bind_number_tab (
id number,
number_t6 number(6),
float_t float,
binary_float_t binary_float,
binary_double_t binary_double,
decimal_t decimal,
integer_t integer)"
);
oci8_test_sql_execute($c, $stmtarray);
function check_col($c, $colname, $id)
{
$s = oci_parse($c, "select $colname from bind_number_tab where id = :id");
oci_bind_by_name($s, ":id", $id);
oci_execute($s);
oci_fetch_all($s, $r);
var_dump($r);
}
// Run Test
echo "Test 1 - invalid number\n";
$s = oci_parse($c, "INSERT INTO bind_number_tab (id, number_t6) VALUES (1, :n1)");
$n1 = "Hello";
oci_bind_by_name($s, ":n1", $n1);
oci_execute($s);
check_col($c, "number_t6", 1);
echo "\nTEST66 insert a float\n";
$s = oci_parse($c, "INSERT INTO bind_number_tab (id, float_t) VALUES (66, :f1)");
$f1 = 123.456;
oci_bind_by_name($s, ":f1", $f1);
oci_execute($s);
check_col($c, 'float_t', 66);
echo "\nTEST67 insert a binary float\n";
$s = oci_parse($c, "INSERT INTO bind_number_tab (id, binary_float_t) VALUES (67, :f1)");
$f1 = 567.456;
oci_bind_by_name($s, ":f1", $f1);
oci_execute($s);
check_col($c, 'binary_float_t', 67);
echo "\nTEST69 insert a binary double\n";
$s = oci_parse($c, "INSERT INTO bind_number_tab (id, binary_double_t) VALUES (69, :f1)");
$f1 = 567.456;
oci_bind_by_name($s, ":f1", $f1);
oci_execute($s);
check_col($c, 'binary_double_t', 69);
echo "\nTEST71 insert a decimal\n";
$s = oci_parse($c, "INSERT INTO bind_number_tab (id, decimal_t) VALUES (71, :f1)");
$f1 = 123.789;
oci_bind_by_name($s, ":f1", $f1);
oci_execute($s);
check_col($c, 'decimal_t', 71);
echo "\nTEST72 insert a decimal\n";
$s = oci_parse($c, "INSERT INTO bind_number_tab (id, decimal_t) VALUES (72, :f1)");
$f1 = 123.789;
oci_bind_by_name($s, ":f1", $f1, -1, SQLT_NUM);
oci_execute($s);
check_col($c, 'decimal_t', 72);
echo "\nTEST73 insert a double\n";
$s = oci_parse($c, "INSERT INTO bind_number_tab (id, binary_double_t) VALUES (73, :f1)");
$f1 = 483.589;
oci_bind_by_name($s, ":f1", $f1);
oci_execute($s);
check_col($c, 'binary_double_t', 73);
echo "\nTEST75 insert a INTEGER\n";
$s = oci_parse($c, "INSERT INTO bind_number_tab (id, integer_t) VALUES (75, :f1)");
$f1 = 589;
oci_bind_by_name($s, ":f1", $f1);
oci_execute($s);
check_col($c, 'integer_t', 75);
echo "\nTEST76 insert a INTEGER\n";
$s = oci_parse($c, "INSERT INTO bind_number_tab (id, integer_t) VALUES (76, :f1)");
$f1 = 42;
oci_bind_by_name($s, ":f1", $f1, -1, SQLT_INT);
oci_execute($s);
check_col($c, 'integer_t', 76);
// Clean up
$stmtarray = array(
"drop table bind_number_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECTF--
Test 1 - invalid number
Warning: oci_execute(): ORA-01722: %s in %sbind_number.php on line %d
array(1) {
["NUMBER_T6"]=>
array(0) {
}
}
TEST66 insert a float
array(1) {
["FLOAT_T"]=>
array(1) {
[0]=>
string(7) "123.456"
}
}
TEST67 insert a binary float
array(1) {
["BINARY_FLOAT_T"]=>
array(1) {
[0]=>
string(%r15|8%r) "%r(5.67455994E\+002|567.4560)%r"
}
}
TEST69 insert a binary double
array(1) {
["BINARY_DOUBLE_T"]=>
array(1) {
[0]=>
string(%r23|16%r) "%r(5.6745600000000002E\+002|567.456000000000)%r"
}
}
TEST71 insert a decimal
array(1) {
["DECIMAL_T"]=>
array(1) {
[0]=>
string(3) "124"
}
}
TEST72 insert a decimal
array(1) {
["DECIMAL_T"]=>
array(1) {
[0]=>
string(1) "0"
}
}
TEST73 insert a double
array(1) {
["BINARY_DOUBLE_T"]=>
array(1) {
[0]=>
string(%r12|16%r) "%r(4.83589E\+002|483.589000000000)%r"
}
}
TEST75 insert a INTEGER
array(1) {
["INTEGER_T"]=>
array(1) {
[0]=>
string(3) "589"
}
}
TEST76 insert a INTEGER
array(1) {
["INTEGER_T"]=>
array(1) {
[0]=>
string(2) "42"
}
}

View file

@ -1,79 +0,0 @@
--TEST--
Bind with various WHERE conditions
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"drop table bind_query_tab",
"create table bind_query_tab (empno number(4), ename varchar2(10), sal number(7,2))",
"insert into bind_query_tab values (7934, 'MILLER', 1300)",
"insert into bind_query_tab values (7902, 'FORD', 3000)"
);
oci8_test_sql_execute($c, $stmtarray);
// Run Test
echo "Test 1\n";
$e = 7934;
$s = oci_parse($c, "select ename from bind_query_tab where empno = :eno");
oci_bind_by_name( $s, ":eno", $e, -1, SQLT_INT);
oci_execute($s);
var_dump(oci_fetch_row($s));
echo "Test 2\n";
$v = 1000;
$s = oci_parse($c, 'select ename from bind_query_tab where sal > :v order by ename');
oci_bind_by_name( $s, ":v", $v);
oci_define_by_name($s, "ENAME", $ename, 20);
oci_execute($s);
while (oci_fetch($s)) {
var_dump($ename);
}
echo "Test 3\n";
$s = oci_parse($c, 'select ename from bind_query_tab where sal > :v order by ename');
oci_bind_by_name( $s, ":v", $v);
$v = 2000;
oci_define_by_name($s, "ENAME", $ename, 20);
oci_execute($s);
while (oci_fetch($s)) {
var_dump($ename);
}
// Clean up
$stmtarray = array(
"drop table bind_query_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECT--
Test 1
array(1) {
[0]=>
string(6) "MILLER"
}
Test 2
string(4) "FORD"
string(6) "MILLER"
Test 3
string(4) "FORD"

View file

@ -1,45 +0,0 @@
--TEST--
bind RAW field
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__."/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( __DIR__."/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

View file

@ -1,45 +0,0 @@
--TEST--
bind RAW field with OCI_B_BIN
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__."/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( __DIR__."/test.gif");
$fileimage = substr($fileimage, 0, 300);
oci_bind_by_name( $stmt, ":id", $i, -1);
oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, OCI_B_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

View file

@ -1,86 +0,0 @@
--TEST--
Test ROWID bind
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
function do_query($c)
{
$s = oci_parse($c, 'select address from rid_tab order by id');
$id = 1;
oci_execute($s, OCI_DEFAULT);
while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
var_dump($row);
}
}
$stmtarray = array(
"drop table rid_tab",
"create table rid_tab (id number, address varchar2(40))",
"insert into rid_tab (id, address) values (1, 'original text #1')",
"insert into rid_tab (id, address) values (2, 'original text #2')"
);
oci8_test_sql_execute($c, $stmtarray);
echo "Initial Data\n";
do_query($c);
$s = oci_parse($c, 'select rowid, address from rid_tab where id = :l_bv for update');
$id = 1;
oci_bind_by_name($s, ':l_bv', $id);
oci_execute($s, OCI_DEFAULT);
$row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS);
$rid = $row['ROWID'];
$addr = $row['ADDRESS'];
$addr = 'Some new text';
// Save changes
$s = oci_parse($c,'update rid_tab set address = :a_bv where rowid = :r_bv');
oci_bind_by_name($s, ':r_bv', $rid, -1, OCI_B_ROWID);
oci_bind_by_name($s, ':a_bv', $addr);
oci_execute($s);
echo "Verify Change\n";
do_query($c);
// Cleanup
$stmtarray = array(
"drop table rid_tab"
);
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECT--
Initial Data
array(1) {
["ADDRESS"]=>
string(16) "original text #1"
}
array(1) {
["ADDRESS"]=>
string(16) "original text #2"
}
Verify Change
array(1) {
["ADDRESS"]=>
string(13) "Some new text"
}
array(1) {
["ADDRESS"]=>
string(16) "original text #2"
}
Done

View file

@ -1,209 +0,0 @@
--TEST--
Bind tests with SQLT_AFC
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"drop table bind_sqltafc_tab",
"create table bind_sqltafc_tab (id number, char_t char(1), char_t10 char(10), varchar2_t10 varchar2(10), number_t number)",
"insert into bind_sqltafc_tab values (0, 'a', 'abcd', 'efghij', 1.1)"
);
oci8_test_sql_execute($c, $stmtarray);
// Run Test
function q($c, $id)
{
$s = oci_parse($c, "select * from bind_sqltafc_tab where id = $id");
oci_execute($s);
oci_fetch_all($s, $r);
var_dump($r);
}
echo "Test 0 - base table creation without binds\n";
q($c, 0);
echo "\nTest 1 - successful insert\n";
$s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (1, :c2, :c3, :c4, :c5)");
$c2 = "H";
$c3 = "AAAAAAAAAA"; // max length allowed in column
$c4 = "BBBBBBBBBB"; // max length allowed in column
$c5 = "123.45";
oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC);
oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC);
oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC);
oci_execute($s);
q($c, 1);
echo "\nTest 2 - Empty Strings\n";
$s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (5, :c2, :c3, :c4, :c5)");
$c2 = "";
$c3 = "";
$c4 = "";
$c5 = "";
oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC);
oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC);
oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC);
oci_execute($s);
q($c, 5);
echo "\nTest 3 - NULLs\n";
$s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (6, :c2, :c3, :c4, :c5)");
$c2 = null;
$c3 = null;
$c4 = null;
$c5 = null;
oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC);
oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC);
oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC);
oci_execute($s);
q($c, 6);
// Clean up
$stmtarray = array(
"drop table bind_sqltafc_tab"
);
oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
?>
--EXPECT--
Test 0 - base table creation without binds
array(5) {
["ID"]=>
array(1) {
[0]=>
string(1) "0"
}
["CHAR_T"]=>
array(1) {
[0]=>
string(1) "a"
}
["CHAR_T10"]=>
array(1) {
[0]=>
string(10) "abcd "
}
["VARCHAR2_T10"]=>
array(1) {
[0]=>
string(6) "efghij"
}
["NUMBER_T"]=>
array(1) {
[0]=>
string(3) "1.1"
}
}
Test 1 - successful insert
array(5) {
["ID"]=>
array(1) {
[0]=>
string(1) "1"
}
["CHAR_T"]=>
array(1) {
[0]=>
string(1) "H"
}
["CHAR_T10"]=>
array(1) {
[0]=>
string(10) "AAAAAAAAAA"
}
["VARCHAR2_T10"]=>
array(1) {
[0]=>
string(10) "BBBBBBBBBB"
}
["NUMBER_T"]=>
array(1) {
[0]=>
string(6) "123.45"
}
}
Test 2 - Empty Strings
array(5) {
["ID"]=>
array(1) {
[0]=>
string(1) "5"
}
["CHAR_T"]=>
array(1) {
[0]=>
NULL
}
["CHAR_T10"]=>
array(1) {
[0]=>
NULL
}
["VARCHAR2_T10"]=>
array(1) {
[0]=>
NULL
}
["NUMBER_T"]=>
array(1) {
[0]=>
NULL
}
}
Test 3 - NULLs
array(5) {
["ID"]=>
array(1) {
[0]=>
string(1) "6"
}
["CHAR_T"]=>
array(1) {
[0]=>
NULL
}
["CHAR_T10"]=>
array(1) {
[0]=>
NULL
}
["VARCHAR2_T10"]=>
array(1) {
[0]=>
NULL
}
["NUMBER_T"]=>
array(1) {
[0]=>
NULL
}
}

View file

@ -1,229 +0,0 @@
--TEST--
Bind with SQLT_CHR
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"drop table bind_sqltchr_tab",
"create table bind_sqltchr_tab (
id number,
varchar2_t10 varchar2(10),
number_t number,
number_t92 number(9,2))"
);
oci8_test_sql_execute($c, $stmtarray);
function check_col($c, $colname, $id)
{
$s = oci_parse($c, "select $colname from bind_sqltchr_tab where id = :id");
oci_bind_by_name($s, ":id", $id);
oci_execute($s);
oci_fetch_all($s, $r);
var_dump($r);
}
// Run Test
echo "\nTEST241 bind SQLT_CHR\n";
$c2 = "Hood241";
$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, varchar2_t10) VALUES (241, :c2)");
oci_bind_by_name($s, ":c2", $c2, -1, SQLT_CHR);
oci_execute($s);
check_col($c, 'varchar2_t10', 241);
echo "\nTEST242 insert numbers SQLT_CHR\n";
$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (242, :n1)");
$n1 = 42;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
oci_execute($s);
check_col($c, 'number_t', 242);
echo "\nTEST243 insert numbers, SQLT_CHR\n";
$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (243, :n1)");
$n1 = 42.69;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
oci_execute($s);
check_col($c, 'number_t', 243);
echo "\nTEST244 insert numbers with SQLT_CHR\n";
$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (244, :n1)");
$n1 = 0;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
oci_execute($s);
check_col($c, 'number_t', 244);
echo "\nTEST245 insert numbers with SQLT_CHR\n";
$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (245, :n1)");
$n1 = -23;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
oci_execute($s);
check_col($c, 'number_t', 245);
echo "\nTEST246 insert numbers\n";
$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (246, :n1)");
$n1 = "-23";
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
oci_execute($s);
check_col($c, 'number_t', 246);
echo "\nTEST247 insert numbers with SQLT_CHR\n";
$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (247, :n1)");
$n1 = "23";
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
oci_execute($s);
check_col($c, 'number_t', 247);
echo "\nTEST248 insert numbers with SQLT_CHR\n";
$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (248, :n1)");
$n1 = 123.56;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
oci_execute($s);
check_col($c, 'number_t92', 248);
echo "\nTEST249 insert numbers with SQLT_CHR\n";
$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (249, :n1)");
$n1 = "123.56";
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
oci_execute($s);
check_col($c, 'number_t92', 249);
echo "\nTEST250 insert numbers with SQLT_CHR\n";
$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (250, :n1)");
$n1 = "";
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
oci_execute($s);
check_col($c, 'number_t92', 250);
// Clean up
$stmtarray = array(
"drop table bind_sqltchr_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECT--
TEST241 bind SQLT_CHR
array(1) {
["VARCHAR2_T10"]=>
array(1) {
[0]=>
string(7) "Hood241"
}
}
TEST242 insert numbers SQLT_CHR
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(2) "42"
}
}
TEST243 insert numbers, SQLT_CHR
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(5) "42.69"
}
}
TEST244 insert numbers with SQLT_CHR
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(1) "0"
}
}
TEST245 insert numbers with SQLT_CHR
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(3) "-23"
}
}
TEST246 insert numbers
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(3) "-23"
}
}
TEST247 insert numbers with SQLT_CHR
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(2) "23"
}
}
TEST248 insert numbers with SQLT_CHR
array(1) {
["NUMBER_T92"]=>
array(1) {
[0]=>
string(6) "123.56"
}
}
TEST249 insert numbers with SQLT_CHR
array(1) {
["NUMBER_T92"]=>
array(1) {
[0]=>
string(6) "123.56"
}
}
TEST250 insert numbers with SQLT_CHR
array(1) {
["NUMBER_T92"]=>
array(1) {
[0]=>
NULL
}
}

View file

@ -1,51 +0,0 @@
--TEST--
PL/SQL bind with SQLT_CHR
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"create or replace procedure bind_sqltchr_proc (msg_in in varchar2, msg_out out varchar2)
as
begin
msg_out := upper(msg_in);
end;"
);
oci8_test_sql_execute($c, $stmtarray);
// Run Test
echo "Test 1 - PL/SQL IN and OUT variables\n";
$stmt = oci_parse($c, "BEGIN bind_sqltchr_proc(:a, :b); END;");
$msg_in = "Cat got your keyboard?";
oci_bind_by_name($stmt, ":a", $msg_in, -1, SQLT_CHR);
oci_bind_by_name($stmt, ":b", $msg_out, 800, SQLT_CHR);
oci_execute($stmt);
var_dump($msg_in);
var_dump($msg_out);
// Clean up
$stmtarray = array(
"drop procedure bind_sqltchr_proc"
);
oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECT--
Test 1 - PL/SQL IN and OUT variables
string(22) "Cat got your keyboard?"
string(22) "CAT GOT YOUR KEYBOARD?"

View file

@ -1,337 +0,0 @@
--TEST--
Bind with SQLT_INT
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"drop table bind_sqltint_tab",
"create table bind_sqltint_tab (
id number,
varchar2_t10 varchar2(10),
number_t number,
number_t92 number(9,2))",
);
oci8_test_sql_execute($c, $stmtarray);
function check_col($c, $colname, $id)
{
$s = oci_parse($c, "select $colname from bind_sqltint_tab where id = :id");
oci_bind_by_name($s, ":id", $id);
oci_execute($s);
oci_fetch_all($s, $r);
var_dump($r);
}
// Run Test
echo "\nTEST141 wrong bind type SQLT_INT\n";
$c2 = "Hood141";
$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, varchar2_t10) VALUES (141, :c2)");
oci_bind_by_name($s, ":c2", $c2, -1, SQLT_INT);
oci_execute($s);
check_col($c, 'varchar2_t10', 141);
echo "\nTEST142 insert numbers SQLT_INT\n";
$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (142, :n1)");
$n1 = 42;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
oci_execute($s);
check_col($c, 'number_t', 142);
echo "\nTEST143 insert numbers, SQLT_INT\n";
$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (143, :n1)");
$n1 = 42.69;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
oci_execute($s);
check_col($c, 'number_t', 143);
echo "\nTEST144 insert numbers with SQLT_INT\n";
$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (144, :n1)");
$n1 = 0;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
oci_execute($s);
check_col($c, 'number_t', 144);
echo "\nTEST145 insert numbers with SQLT_INT\n";
$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (145, :n1)");
$n1 = -23;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
oci_execute($s);
check_col($c, 'number_t', 145);
echo "\nTEST146 insert numbers\n";
$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (146, :n1)");
$n1 = "-23";
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
oci_execute($s);
check_col($c, 'number_t', 146);
echo "\nTEST147 insert numbers with SQLT_INT\n";
$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (147, :n1)");
$n1 = "23";
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
oci_execute($s);
check_col($c, 'number_t', 147);
echo "\nTEST148 insert numbers with SQLT_INT\n";
$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (148, :n1)");
$n1 = 123.56;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
oci_execute($s);
check_col($c, 'number_t92', 148);
echo "\nTEST149 insert numbers with SQLT_INT\n";
$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (149, :n1)");
$n1 = "123.56";
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
oci_execute($s);
check_col($c, 'number_t92', 149);
echo "\nTEST150 insert numbers with SQLT_INT\n";
$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (150, :n1)");
$n1 = "";
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
oci_execute($s);
check_col($c, 'number_t92', 150);
echo "\nTEST151 - 159 Initialization tests\n";
$s = oci_parse($c, "begin :p2 := :p1; end;");
unset($p1);
unset($p2);
oci_bind_by_name($s, ":p1", $p1, 10);
oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
oci_execute($s);
var_dump($p2);
echo "\nTEST152\n";
unset($p1);
$p2 = null;
oci_bind_by_name($s, ":p1", $p1, 10);
oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
oci_execute($s);
var_dump($p2);
echo "\nTEST153\n";
unset($p1);
$p2 = 1111;
oci_bind_by_name($s, ":p1", $p1, 10);
oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
oci_execute($s);
var_dump($p2);
echo "\nTEST154\n";
$p1 = null;
unset($p2);
oci_bind_by_name($s, ":p1", $p1, 10);
oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
oci_execute($s);
var_dump($p2);
echo "\nTEST155\n";
$p1 = null;
$p2 = null;
oci_bind_by_name($s, ":p1", $p1, 10);
oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
oci_execute($s);
var_dump($p2);
echo "\nTEST156\n";
$p1 = null;
$p2 = 2222;
oci_bind_by_name($s, ":p1", $p1, 10);
oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
oci_execute($s);
var_dump($p2);
echo "\nTEST157\n";
$p1 = 3333;
unset($p2);
oci_bind_by_name($s, ":p1", $p1, 10);
oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
oci_execute($s);
var_dump($p2);
echo "\nTEST158\n";
$p1 = 4444;
$p2 = null;
oci_bind_by_name($s, ":p1", $p1, 10);
oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
oci_execute($s);
var_dump($p2);
echo "\nTEST159\n";
$p1 = 5555;
$p2 = 6666;
oci_bind_by_name($s, ":p1", $p1, 10);
oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
oci_execute($s);
var_dump($p2);
// Clean up
$stmtarray = array(
"drop table bind_sqltint_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECT--
TEST141 wrong bind type SQLT_INT
array(1) {
["VARCHAR2_T10"]=>
array(1) {
[0]=>
string(1) "0"
}
}
TEST142 insert numbers SQLT_INT
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(2) "42"
}
}
TEST143 insert numbers, SQLT_INT
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(2) "42"
}
}
TEST144 insert numbers with SQLT_INT
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(1) "0"
}
}
TEST145 insert numbers with SQLT_INT
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(3) "-23"
}
}
TEST146 insert numbers
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(3) "-23"
}
}
TEST147 insert numbers with SQLT_INT
array(1) {
["NUMBER_T"]=>
array(1) {
[0]=>
string(2) "23"
}
}
TEST148 insert numbers with SQLT_INT
array(1) {
["NUMBER_T92"]=>
array(1) {
[0]=>
string(3) "123"
}
}
TEST149 insert numbers with SQLT_INT
array(1) {
["NUMBER_T92"]=>
array(1) {
[0]=>
string(3) "123"
}
}
TEST150 insert numbers with SQLT_INT
array(1) {
["NUMBER_T92"]=>
array(1) {
[0]=>
string(1) "0"
}
}
TEST151 - 159 Initialization tests
NULL
TEST152
NULL
TEST153
NULL
TEST154
NULL
TEST155
NULL
TEST156
NULL
TEST157
int(3333)
TEST158
int(4444)
TEST159
int(5555)

View file

@ -1,278 +0,0 @@
--TEST--
Bind with SQLT_NUM
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
if (!(isset($matches[0]) && $matches[0] >= 12)) {
die("skip works only with Oracle 12c or greater version of Oracle client libraries");
}
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"drop table bind_sqltnum_tab",
"create table bind_sqltnum_tab (
id number,
varchar2_t10 varchar2(10),
number_t number,
number_t92 number(9,2))"
);
oci8_test_sql_execute($c, $stmtarray);
function check_col($c, $colname, $id)
{
$s = oci_parse($c, "select dump($colname) from bind_sqltnum_tab where id = :id");
oci_bind_by_name($s, ":id", $id);
oci_execute($s);
oci_fetch_all($s, $r);
var_dump($r);
}
// Run Test
echo "Test 1 - baseline test\n";
$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, varchar2_t10) VALUES (100, :c2)");
$c2 = "Hood";
$r = oci_bind_by_name($s, ":c2", $c2, -1);
if (!$r) {
$e = oci_error($s);
var_dump($e);
}
$r = oci_execute($s, OCI_DEFAULT);
if (!$r) {
$e = oci_error($s);
var_dump($e);
}
$s = oci_parse($c, "select id, varchar2_t10 from bind_sqltnum_tab");
oci_execute($s);
oci_fetch_all($s, $data);
var_dump($data);
echo "Test 2 - SQLT_NUM to a VARCHAR2 column\n";
$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, varchar2_t10) VALUES (100, :c2)");
$c2 = "Hood";
$r = oci_bind_by_name($s, ":c2", $c2, -1, SQLT_NUM);
if (!$r) {
$e = oci_error($s);
var_dump($e['message']);
}
$r = oci_execute($s, OCI_DEFAULT);
if (!$r) {
$e = oci_error($s);
var_dump($e['message']);
}
echo "\nTEST41 wrong bind type SQLT_NUM\n";
$c2 = "Hood41";
$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, varchar2_t10) VALUES (41, :c2)");
oci_bind_by_name($s, ":c2", $c2, -1, SQLT_NUM);
oci_execute($s);
echo "\nTEST42 insert numbers SQLT_NUM\n";
$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (42, :n1)");
$n1 = 42;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
oci_execute($s);
check_col($c, 'number_t', 42);
echo "\nTEST43 insert numbers SQLT_NUM\n";
$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (43, :n1)");
$n1 = 42.69;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
oci_execute($s);
check_col($c, 'number_t', 43);
echo "\nTEST44\n";
$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (44, :n1)");
$n1 = 0;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
oci_execute($s);
check_col($c, 'number_t', 44);
echo "\nTEST45\n";
$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (45, :n1)");
$n1 = -23;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
oci_execute($s);
check_col($c, 'number_t', 45);
echo "\nTEST46 insert numbers\n";
$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (46, :n1)");
$n1 = "-23";
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
oci_execute($s);
check_col($c, 'number_t', 46);
echo "\nTEST47\n";
$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (47, :n1)");
$n1 = "23";
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
oci_execute($s);
check_col($c, 'number_t', 47);
echo "\nTEST48\n";
$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t92) VALUES (48, :n1)");
$n1 = 123.56;
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
oci_execute($s);
check_col($c, 'number_t92', 48);
echo "\nTEST49\n";
$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t92) VALUES (49, :n1)");
$n1 = "123.56";
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
oci_execute($s);
check_col($c, 'number_t92', 49);
echo "\nTEST50\n";
$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t92) VALUES (50, :n1)");
$n1 = "";
oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
oci_execute($s);
check_col($c, 'number_t92', 50);
// Clean up
$stmtarray = array(
"drop table bind_sqltnum_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECTF--
Test 1 - baseline test
array(2) {
["ID"]=>
array(1) {
[0]=>
string(3) "100"
}
["VARCHAR2_T10"]=>
array(1) {
[0]=>
string(4) "Hood"
}
}
Test 2 - SQLT_NUM to a VARCHAR2 column
Warning: oci_execute(): ORA-12899: %s (%s: 40, %s: 10) in %sbind_sqltnum.php on line %d
string(%d) "ORA-12899: %s"
TEST41 wrong bind type SQLT_NUM
Warning: oci_execute(): ORA-12899: %s "%s"."BIND_SQLTNUM_TAB"."VARCHAR2_T10" (%s: 40, %s: 10) in %sbind_sqltnum.php on line %d
TEST42 insert numbers SQLT_NUM
array(1) {
["DUMP(NUMBER_T)"]=>
array(1) {
[0]=>
string(29) "Typ=2 Len=8: 42,0,0,0,0,0,0,0"
}
}
TEST43 insert numbers SQLT_NUM
array(1) {
["DUMP(NUMBER_T)"]=>
array(1) {
[0]=>
string(29) "Typ=2 Len=8: 42,0,0,0,0,0,0,0"
}
}
TEST44
array(1) {
["DUMP(NUMBER_T)"]=>
array(1) {
[0]=>
string(28) "Typ=2 Len=8: 0,0,0,0,0,0,0,0"
}
}
TEST45
array(1) {
["DUMP(NUMBER_T)"]=>
array(1) {
[0]=>
string(44) "Typ=2 Len=8: 233,255,255,255,255,255,255,255"
}
}
TEST46 insert numbers
array(1) {
["DUMP(NUMBER_T)"]=>
array(1) {
[0]=>
string(44) "Typ=2 Len=8: 233,255,255,255,255,255,255,255"
}
}
TEST47
array(1) {
["DUMP(NUMBER_T)"]=>
array(1) {
[0]=>
string(29) "Typ=2 Len=8: 23,0,0,0,0,0,0,0"
}
}
TEST48
array(1) {
["DUMP(NUMBER_T92)"]=>
array(1) {
[0]=>
string(16) "Typ=2 Len=1: 128"
}
}
TEST49
array(1) {
["DUMP(NUMBER_T92)"]=>
array(1) {
[0]=>
string(16) "Typ=2 Len=1: 128"
}
}
TEST50
Warning: oci_execute(): ORA-01438: %s in %sbind_sqltnum.php on line %d
array(1) {
["DUMP(NUMBER_T92)"]=>
array(0) {
}
}

View file

@ -1,59 +0,0 @@
--TEST--
Bind with various unsupported bind types
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// These types are defined in oci8.c
$types = array(
"SQLT_AVC" => SQLT_AVC,
"SQLT_STR" => SQLT_STR,
"SQLT_VCS" => SQLT_VCS,
"SQLT_AVC" => SQLT_AVC,
"SQLT_STR" => SQLT_STR,
"SQLT_LVC" => SQLT_LVC,
"SQLT_FLT" => SQLT_FLT,
"SQLT_UIN" => SQLT_UIN,
"SQLT_ODT" => SQLT_ODT,
);
foreach ($types as $t => $v) {
echo "Test - $t\n";
$s = oci_parse($c, "select * from dual where dummy = :c1");
$c1 = "Doug";
oci_bind_by_name($s, ":c1", $c1, -1, $v);
}
?>
--EXPECTF--
Test - SQLT_AVC
Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 97 in %sbind_unsupported_1.php on line %d
Test - SQLT_STR
Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 5 in %sbind_unsupported_1.php on line %d
Test - SQLT_VCS
Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 9 in %sbind_unsupported_1.php on line %d
Test - SQLT_LVC
Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 94 in %sbind_unsupported_1.php on line %d
Test - SQLT_FLT
Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 4 in %sbind_unsupported_1.php on line %d
Test - SQLT_UIN
Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 68 in %sbind_unsupported_1.php on line %d
Test - SQLT_ODT
Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 156 in %sbind_unsupported_1.php on line %d

View file

@ -1,35 +0,0 @@
--TEST--
Bind with various unsupported 10g+ bind types
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
$types = array(
"SQLT_BDOUBLE" => SQLT_BDOUBLE,
"SQLT_BFLOAT" => SQLT_BFLOAT,
);
foreach ($types as $t => $v) {
echo "Test - $t\n";
$s = oci_parse($c, "select * from dual where dummy = :c1");
$c1 = "Doug";
oci_bind_by_name($s, ":c1", $c1, -1, $v);
}
?>
--EXPECTF--
Test - SQLT_BDOUBLE
Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 22 in %sbind_unsupported_2.php on line %d
Test - SQLT_BFLOAT
Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 21 in %sbind_unsupported_2.php on line %d

View file

@ -1,45 +0,0 @@
--TEST--
Bind with various bind types not supported by TimesTen
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => false, 'timesten' => true); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
$types = array(
"SQLT_CLOB" => SQLT_CLOB,
"SQLT_BLOB" => SQLT_BLOB,
"OCI_B_CLOB" => OCI_B_CLOB,
"OCI_B_BLOB" => OCI_B_BLOB,
);
foreach ($types as $t => $v) {
echo "Test - $t\n";
$s = oci_parse($c, "select * from dual where dummy = :c1");
$c1 = "Doug";
oci_bind_by_name($s, ":c1", $c1, -1, $v);
}
?>
--EXPECTF--
Test - SQLT_CLOB
Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
Test - SQLT_BLOB
Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
Test - OCI_B_CLOB
Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
Test - OCI_B_BLOB
Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d

View file

@ -1,47 +0,0 @@
--TEST--
Bug #26133 (ocifreedesc() segfault)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialize
$stmtarray = array(
"drop table bug26133_tab",
"create table bug26133_tab (id number, value number)",
);
oci8_test_sql_execute($c, $stmtarray);
// Run Test
$ora_sql = "INSERT INTO bug26133_tab (id, value) VALUES (1,'1') RETURNING ROWID INTO :v_rowid ";
$statement = oci_parse($c,$ora_sql);
$rowid = oci_new_descriptor($c,OCI_D_ROWID);
oci_bind_by_name($statement,":v_rowid", $rowid,-1,OCI_B_ROWID);
if (oci_execute($statement)) {
oci_commit($c);
}
oci_free_statement($statement);
$rowid->free();
// Cleanup
$stmtarray = array(
"drop table bug26133_tab"
);
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECT--
Done

View file

@ -1,258 +0,0 @@
--TEST--
Bug #27303 (OCIBindByName binds numeric PHP values as characters)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
require __DIR__.'/connect.inc';
// The bind buffer size edge cases seem to change each DB version.
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
if (!(isset($matches[0]) && $matches[1] >= 12)) {
die("skip expected output only valid when using Oracle 12c database");
}
?>
--ENV--
NLS_LANG=
--FILE--
<?php
require __DIR__.'/connect.inc';
$stmtarray = array(
"drop sequence myseq",
"drop table mytab",
"create sequence myseq",
"create table mytab (mydata varchar2(20), seqcol number)"
);
oci8_test_sql_execute($c, $stmtarray);
define('MYLIMIT', 200);
$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
$stid = oci_parse($c, $stmt);
if (!$stid) { echo "Parse error"; die; }
$r = oci_bind_by_name($stid, ':MYBV', $mybv);
if (!$r) { echo "Bind error"; die; }
for ($i = 1; $i < MYLIMIT; $i++) {
$r = oci_execute($stid, OCI_DEFAULT);
if (!$r) { echo "Execute error"; die; }
var_dump($mybv);
}
oci_commit($c);
$stmtarray = array(
"drop sequence myseq",
"drop table mytab"
);
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECT--
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

View file

@ -1,260 +0,0 @@
--TEST--
Bug #27303 (OCIBindByName binds numeric PHP values as characters)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
require __DIR__.'/connect.inc';
// The bind buffer size edge cases seem to change each DB version.
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
if (!(isset($matches[0]) && $matches[1] >= 12)) {
die("skip expected output only valid when using Oracle 12c database");
}
?>
--ENV--
NLS_LANG=
--FILE--
<?php
require __DIR__.'/connect.inc';
$stmtarray = array(
"drop sequence myseq",
"drop table mytab",
"create sequence myseq",
"create table mytab (mydata varchar2(20), seqcol number)"
);
oci8_test_sql_execute($c, $stmtarray);
define('MYLIMIT', 200);
define('INITMYBV', 11);
$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
$stid = oci_parse($c, $stmt);
if (!$stid) { echo "Parse error"; die; }
$mybv = INITMYBV;
$r = oci_bind_by_name($stid, ':MYBV', $mybv);
if (!$r) { echo "Bind error"; die; }
for ($i = 1; $i < MYLIMIT; $i++) {
$r = oci_execute($stid, OCI_DEFAULT);
if (!$r) { echo "Execute error"; die; }
var_dump($mybv);
}
oci_commit($c);
$stmtarray = array(
"drop sequence myseq",
"drop table mytab"
);
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECT--
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

View file

@ -1,256 +0,0 @@
--TEST--
Bug #27303 (OCIBindByName binds numeric PHP values as characters)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/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 = oci_parse($c, $stmt);
if (!$stid) { echo "Parse error"; die; }
$mybv = INITMYBV;
$r = oci_bind_by_name($stid, ':MYBV', $mybv, 5, SQLT_INT);
if (!$r) { echo "Bind error"; die; }
for ($i = 1; $i < MYLIMIT; $i++) {
$r = oci_execute($stid, OCI_DEFAULT);
if (!$r) { echo "Execute error"; die; }
var_dump($mybv);
}
oci_commit($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";
?>
--EXPECT--
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

View file

@ -1,256 +0,0 @@
--TEST--
Bug #27303 (OCIBindByName binds numeric PHP values as characters)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
require __DIR__.'/connect.inc';
// The bind buffer size edge cases seem to change each DB version.
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
if (!(isset($matches[0]) && $matches[1] >= 12)) {
die("skip expected output only valid when using Oracle 12c database");
}
?>
--ENV--
NLS_LANG=
--FILE--
<?php
require __DIR__.'/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)";
oci8_test_sql_execute($c, $create_st);
define('MYLIMIT', 200);
$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
$stid = oci_parse($c, $stmt);
if (!$stid) { echo "Parse error"; die; }
$r = oci_bind_by_name($stid, ':MYBV', $mybv, 0 );
if (!$r) { echo "Bind error"; die; }
for ($i = 1; $i < MYLIMIT; $i++) {
$r = oci_execute($stid, OCI_DEFAULT);
if (!$r) { echo "Execute error"; die; }
var_dump($mybv);
}
oci_commit($c);
$drop_st = array();
$drop_st[] = "drop sequence myseq";
$drop_st[] = "drop table mytab";
oci8_test_sql_execute($c, $drop_st);
echo "Done\n";
?>
--EXPECT--
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

View file

@ -1,55 +0,0 @@
--TEST--
Bug #32325 (Cannot retrieve collection using OCI8)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialize
$stmtarray = array(
"create or replace type bug32325_t as table of number"
);
oci8_test_sql_execute($c, $stmtarray);
// Run test
$collection = oci_new_collection($c, "BUG32325_T");
$sql = "begin
select bug32325_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));
// Cleanup
$stmtarray = array(
"drop type bug32325_t"
);
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECT--
int(4)
float(2)
float(3)
Done

View file

@ -1,49 +0,0 @@
--TEST--
Bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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(OCILob)#%d (1) {
["descriptor"]=>
resource(%d) of type (oci8 descriptor)
}
}
string(%d) "%s5"
string(%d) "%sa"
Done

View file

@ -1,32 +0,0 @@
--TEST--
Bug #36010 (Crash when executing SQL statement with lob parameter twice)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/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

View file

@ -1,32 +0,0 @@
--TEST--
Bug #36096 (oci_result() returns garbage after oci_fetch() failed)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__."/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";
?>
--EXPECTF--
bool(false)
bool(false)
string(%r[53]%r) "%r('ABC'|EXP)%r"
string(4) "CHAR"
Done

View file

@ -1,56 +0,0 @@
--TEST--
Bug #36403 (oci_execute no longer supports OCI_DESCRIBE_ONLY)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"drop table bug36403_tab",
"create table bug36403_tab (c1 number, col2 number, column3 number, col4 number)"
);
oci8_test_sql_execute($c, $stmtarray);
// Run Test
echo "Test 1\n";
$s = oci_parse($c, "select * from bug36403_tab");
oci_execute($s, OCI_DESCRIBE_ONLY);
for ($i = oci_num_fields($s); $i > 0; $i--) {
echo oci_field_name($s, $i) . "\n";
}
echo "Test 2\n";
// Should generate an error: ORA-24338: statement handle not executed
// since the statement handle was only described and not executed
$row = oci_fetch_array($s);
// Clean up
$stmtarray = array(
"drop table bug36403_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECTF--
Test 1
COL4
COLUMN3
COL2
C1
Test 2
Warning: oci_fetch_array(): ORA-%r(24338|01002)%r: %sbug36403.php on line %d

View file

@ -1,68 +0,0 @@
--TEST--
Bug #37220 (LOB Type mismatch when using windows & oci8.dll)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"create table bug37220_tab( mycolumn xmltype not null)",
"insert into bug37220_tab values(xmltype('<THETAG myID=\"1234\"></THETAG>'))"
);
oci8_test_sql_execute($c, $stmtarray);
// Now let's update the row where myId = 1234 and change the tag
// 'THETAG' to 'MYTAG' (mycolumn is an XMLTYPE datatype and
// bug37220_tab a normal Oracle table)
$query = "UPDATE bug37220_tab
SET bug37220_tab.mycolumn = updateXML(bug37220_tab.mycolumn,'/THETAG',xmltype.createXML(:data))
WHERE existsNode(bug37220_tab.mycolumn,'/THETAG[@myID=\"1234\"]') = 1";
$stmt = oci_parse ($c, $query);
$clob = oci_new_descriptor($c, OCI_D_LOB);
oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB);
$clob->writeTemporary("<MYTAG/>", OCI_TEMP_CLOB);
$success = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS);
oci_free_statement($stmt);
$clob->close();
// Query back the change
$query = "select * from bug37220_tab";
$stmt = oci_parse ($c, $query);
oci_execute($stmt);
while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
foreach ($row as $item) {
echo trim($item)."\n";
}
echo "\n";
}
// Cleanup
$stmtarray = array(
"drop table bug37220_tab"
);
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECT--
<MYTAG/>
Done

View file

@ -1,75 +0,0 @@
--TEST--
Bug #37581 (oci_bind_array_by_name clobbers input array when using SQLT_AFC, AVC)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__."/connect.inc";
$p1 = "create or replace package BUG37581_PKG 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 BUG37581_PKG;";
$p2 = "create or replace package body BUG37581_PKG 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 BUG37581_PKG;";
$s1 = oci_parse($c, $p1);
$s2 = oci_parse($c, $p2);
oci_execute($s1);
oci_execute($s2);
$stmt = oci_parse($c,'begin bug37581_pkg.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";
?>
--EXPECT--
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

View file

@ -1,34 +0,0 @@
--TEST--
Bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require __DIR__.'/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";
?>
--EXPECT--
NULL
int(0)
Done

View file

@ -1,85 +0,0 @@
--TEST--
Bug #38173 (Freeing nested cursors causes OCI8 to segfault)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__."/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

View file

@ -1,61 +0,0 @@
--TEST--
Bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name())
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
$create_pkg = "
CREATE OR REPLACE PACKAGE BUG40078_PKG AS
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
PROCEDURE nullbind(c1 OUT ARRTYPE);
END BUG40078_PKG;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY BUG40078_PKG AS
PROCEDURE nullbind(c1 OUT ARRTYPE) IS
BEGIN
c1(1) := 'one';
c1(2) := 'two';
c1(3) := '';
c1(4) := 'four';
c1(5) := 'five';
END nullbind;
END BUG40078_PKG;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
$statement = oci_parse($c, "BEGIN bug40078_pkg.nullbind(:c1); END;");
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(3) "one"
[1]=>
string(3) "two"
[2]=>
string(0) ""
[3]=>
string(4) "four"
[4]=>
string(4) "five"
}
Done

View file

@ -1,206 +0,0 @@
--TEST--
Bug #40415 (Using oci_fetchall with nested cursors)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__."/connect.inc";
// Setup
$create_1 = "CREATE TABLE t1 (id1 INTEGER)";
$create_2 = "CREATE TABLE t2 (id2 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=1; $i < 4; $i++) {
$insert = "INSERT INTO t1 VALUES(1".$i.")";
$s = oci_parse($c, $insert);
oci_execute($s);
}
for($i=1; $i < 4; $i++) {
$insert = "INSERT INTO t2 VALUES(2".$i.")";
$s = oci_parse($c, $insert);
oci_execute($s);
}
function do_assoc($c)
{
$query = "SELECT t1.*, CURSOR( SELECT * FROM t2 ) AS CURSOR FROM t1";
$stmt = oci_parse($c, $query);
oci_execute($stmt);
while ($row = oci_fetch_assoc($stmt)) {
print "Got row \"".$row['ID1']."\". Now getting nested cursor:\n";
var_dump(oci_execute($row['CURSOR']));
while ($row_n = oci_fetch_assoc($row['CURSOR']) ) {
var_dump($row_n);
}
}
}
function do_all($c)
{
$query = "SELECT t1.*, CURSOR( SELECT * FROM t2 ) AS CURSOR FROM t1";
$stmt = oci_parse($c, $query);
oci_execute($stmt);
$rc1 = oci_fetch_all($stmt, $res);
echo "Rows returned $rc1\n";
var_dump($res);
foreach ($res['CURSOR'] as $cv) {
echo "Getting nested cursor\n";
var_dump(oci_execute($cv));
$rc2 = oci_fetch_all($cv, $res2);
var_dump($res2);
}
}
echo "Test 1: Associate fetch of nested cursor\n";
do_assoc($c);
echo "\nTest 2: fetchall of nested cursor\n";
do_all($c);
// Cleanup
$s1 = oci_parse($c, $drop_1);
$s2 = oci_parse($c, $drop_2);
@oci_execute($s1);
@oci_execute($s2);
echo "Done\n";
?>
--EXPECTF--
Test 1: Associate fetch of nested cursor
Got row "11". Now getting nested cursor:
bool(true)
array(1) {
["ID2"]=>
string(2) "21"
}
array(1) {
["ID2"]=>
string(2) "22"
}
array(1) {
["ID2"]=>
string(2) "23"
}
Got row "12". Now getting nested cursor:
bool(true)
array(1) {
["ID2"]=>
string(2) "21"
}
array(1) {
["ID2"]=>
string(2) "22"
}
array(1) {
["ID2"]=>
string(2) "23"
}
Got row "13". Now getting nested cursor:
bool(true)
array(1) {
["ID2"]=>
string(2) "21"
}
array(1) {
["ID2"]=>
string(2) "22"
}
array(1) {
["ID2"]=>
string(2) "23"
}
Test 2: fetchall of nested cursor
Rows returned 3
array(2) {
["ID1"]=>
array(3) {
[0]=>
string(2) "11"
[1]=>
string(2) "12"
[2]=>
string(2) "13"
}
["CURSOR"]=>
array(3) {
[0]=>
resource(%d) of type (oci8 statement)
[1]=>
resource(%d) of type (oci8 statement)
[2]=>
resource(%d) of type (oci8 statement)
}
}
Getting nested cursor
bool(true)
array(1) {
["ID2"]=>
array(3) {
[0]=>
string(2) "21"
[1]=>
string(2) "22"
[2]=>
string(2) "23"
}
}
Getting nested cursor
bool(true)
array(1) {
["ID2"]=>
array(3) {
[0]=>
string(2) "21"
[1]=>
string(2) "22"
[2]=>
string(2) "23"
}
}
Getting nested cursor
bool(true)
array(1) {
["ID2"]=>
array(3) {
[0]=>
string(2) "21"
[1]=>
string(2) "22"
[2]=>
string(2) "23"
}
}
Done

View file

@ -1,270 +0,0 @@
--TEST--
Bug #41069 (Oracle crash with certain data over a DB-link when prefetch memory limit used - Oracle bug 6039623)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
if (empty($dbase)) die ("skip requires network connection alias for DB link loopback");
if ($test_drcp) die("skip DRCP does not support shared database links");
?>
--INI--
oci8.default_prefetch=5
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"alter session set nls_date_format = 'MM/DD/YYYY'",
"drop database link bug41069_dblink",
"drop table bug41069_tab",
"create shared database link bug41069_dblink authenticated by $user identified by $password using '$dbase'",
"create table bug41069_tab
(
c1 number(20),
c2 varchar2(60 byte),
c3 varchar2(1000 byte),
c4 varchar2(255 byte),
c5 varchar2(2 byte),
c6 varchar2(1 byte),
c7 varchar2(255 byte),
c8 varchar2(50 byte),
c9 date,
c10 date,
c12 number(20),
c13 varchar2(20 byte),
c15 varchar2(50 byte)
)",
"insert into bug41069_tab (c1, c2, c5, c6, c9, c10, c12, c15) values
(111, 'aaaaaaa', 'b', 'c', '01/17/2008', '01/07/2017', 2222, 'zzzzzzzzzz')",
"insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c13, c15) values
(112, 'aaaaaaa', 'bbbbbbbb', 'ccccccc', 'd', 'e', 'rrrrrrr', '04/16/2007', '04/16/2007', 2223, 'xxxxxxxx', 'zzzzzzzz')",
"insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c15) values
(113, 'aaaaaaa', 'bbbbbbbbbb', 'cccccc', 'e', 'f', 'dddd', '12/04/2006', '12/04/2006', 2224, 'zzzzzzz')"
);
oci8_test_sql_execute($c, $stmtarray);
// Run Tests
echo "Test 1: non-DB link case that always worked\n";
$stid = oci_parse($c, 'select * from bug41069_tab order by c1');
oci_execute($stid, OCI_DEFAULT);
oci_fetch_all($stid, $results, 0, -1, OCI_ASSOC+OCI_FETCHSTATEMENT_BY_ROW);
var_dump($results);
echo "Test 2: Should not crash\n";
$stid = oci_parse($c, 'select * from bug41069_tab@bug41069_dblink order by c1');
oci_execute($stid, OCI_DEFAULT);
oci_fetch_all($stid, $results, 0, -1, OCI_ASSOC+OCI_FETCHSTATEMENT_BY_ROW);
var_dump($results);
// Cleanup
$c = oci_new_connect($user, $password, $dbase);
$stmtarray = array(
"drop database link bug41069_dblink",
"drop table bug41069_tab"
);
oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECT--
Test 1: non-DB link case that always worked
array(3) {
[0]=>
array(13) {
["C1"]=>
string(3) "111"
["C2"]=>
string(7) "aaaaaaa"
["C3"]=>
NULL
["C4"]=>
NULL
["C5"]=>
string(1) "b"
["C6"]=>
string(1) "c"
["C7"]=>
NULL
["C8"]=>
NULL
["C9"]=>
string(10) "01/17/2008"
["C10"]=>
string(10) "01/07/2017"
["C12"]=>
string(4) "2222"
["C13"]=>
NULL
["C15"]=>
string(10) "zzzzzzzzzz"
}
[1]=>
array(13) {
["C1"]=>
string(3) "112"
["C2"]=>
string(7) "aaaaaaa"
["C3"]=>
string(8) "bbbbbbbb"
["C4"]=>
string(7) "ccccccc"
["C5"]=>
string(1) "d"
["C6"]=>
string(1) "e"
["C7"]=>
string(7) "rrrrrrr"
["C8"]=>
NULL
["C9"]=>
string(10) "04/16/2007"
["C10"]=>
string(10) "04/16/2007"
["C12"]=>
string(4) "2223"
["C13"]=>
string(8) "xxxxxxxx"
["C15"]=>
string(8) "zzzzzzzz"
}
[2]=>
array(13) {
["C1"]=>
string(3) "113"
["C2"]=>
string(7) "aaaaaaa"
["C3"]=>
string(10) "bbbbbbbbbb"
["C4"]=>
string(6) "cccccc"
["C5"]=>
string(1) "e"
["C6"]=>
string(1) "f"
["C7"]=>
string(4) "dddd"
["C8"]=>
NULL
["C9"]=>
string(10) "12/04/2006"
["C10"]=>
string(10) "12/04/2006"
["C12"]=>
string(4) "2224"
["C13"]=>
NULL
["C15"]=>
string(7) "zzzzzzz"
}
}
Test 2: Should not crash
array(3) {
[0]=>
array(13) {
["C1"]=>
string(3) "111"
["C2"]=>
string(7) "aaaaaaa"
["C3"]=>
NULL
["C4"]=>
NULL
["C5"]=>
string(1) "b"
["C6"]=>
string(1) "c"
["C7"]=>
NULL
["C8"]=>
NULL
["C9"]=>
string(10) "01/17/2008"
["C10"]=>
string(10) "01/07/2017"
["C12"]=>
string(4) "2222"
["C13"]=>
NULL
["C15"]=>
string(10) "zzzzzzzzzz"
}
[1]=>
array(13) {
["C1"]=>
string(3) "112"
["C2"]=>
string(7) "aaaaaaa"
["C3"]=>
string(8) "bbbbbbbb"
["C4"]=>
string(7) "ccccccc"
["C5"]=>
string(1) "d"
["C6"]=>
string(1) "e"
["C7"]=>
string(7) "rrrrrrr"
["C8"]=>
NULL
["C9"]=>
string(10) "04/16/2007"
["C10"]=>
string(10) "04/16/2007"
["C12"]=>
string(4) "2223"
["C13"]=>
string(8) "xxxxxxxx"
["C15"]=>
string(8) "zzzzzzzz"
}
[2]=>
array(13) {
["C1"]=>
string(3) "113"
["C2"]=>
string(7) "aaaaaaa"
["C3"]=>
string(10) "bbbbbbbbbb"
["C4"]=>
string(6) "cccccc"
["C5"]=>
string(1) "e"
["C6"]=>
string(1) "f"
["C7"]=>
string(4) "dddd"
["C8"]=>
NULL
["C9"]=>
string(10) "12/04/2006"
["C10"]=>
string(10) "12/04/2006"
["C12"]=>
string(4) "2224"
["C13"]=>
NULL
["C15"]=>
string(7) "zzzzzzz"
}
}
Done

View file

@ -1,106 +0,0 @@
--TEST--
Bug #42134 (Collection error for invalid collection name)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/details.inc';
// Test collection creation error for normal connection
if (!empty($dbase)) {
$c = oci_connect($user,$password,$dbase);
}
else {
$c = oci_connect($user,$password);
}
$collection = oci_new_collection($c, "ABC");
if (!$collection) {
echo "Normal connection: New Collection error\n";
$m = oci_error($c);
var_dump($m);
}
// Test collection creation error for new connection
if (!empty($dbase)) {
$c = oci_new_connect($user,$password,$dbase);
}
else {
$c = oci_new_connect($user,$password);
}
$collection = oci_new_collection($c, "DEF");
if (!$collection) {
echo "New connection: New Collection error\n";
$m = oci_error($c);
var_dump($m);
}
// Test collection creation error for persistent connection
if (!empty($dbase)) {
$c = oci_pconnect($user,$password,$dbase);
}
else {
$c = oci_pconnect($user,$password);
}
$collection = oci_new_collection($c, "GHI");
if (!$collection) {
echo "Persistent connection: New Collection error\n";
$m = oci_error($c);
var_dump($m);
}
echo "Done\n";
?>
--EXPECTF--
Warning: oci_new_collection(): OCI-22303: type ""."ABC" not found in %s on line %d
Normal connection: New Collection error
array(4) {
["code"]=>
int(22303)
["message"]=>
string(34) "OCI-22303: type ""."ABC" not found"
["offset"]=>
int(0)
["sqltext"]=>
string(0) ""
}
Warning: oci_new_collection(): OCI-22303: type ""."DEF" not found in %s on line %d
New connection: New Collection error
array(4) {
["code"]=>
int(22303)
["message"]=>
string(34) "OCI-22303: type ""."DEF" not found"
["offset"]=>
int(0)
["sqltext"]=>
string(0) ""
}
Warning: oci_new_collection(): OCI-22303: type ""."GHI" not found in %s on line %d
Persistent connection: New Collection error
array(4) {
["code"]=>
int(22303)
["message"]=>
string(34) "OCI-22303: type ""."GHI" not found"
["offset"]=>
int(0)
["sqltext"]=>
string(0) ""
}
Done

View file

@ -1,174 +0,0 @@
--TEST--
Bug #42173 (TIMESTAMP and INTERVAL query and field functions)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
$stmts = array(
"drop table ts_test",
"create table ts_test (
c1 TIMESTAMP,
c2 TIMESTAMP (5),
c3 TIMESTAMP WITH TIME ZONE,
c4 TIMESTAMP (2) WITH TIME ZONE,
c5 TIMESTAMP WITH LOCAL TIME ZONE,
c6 INTERVAL YEAR TO MONTH,
c7 INTERVAL YEAR(2) TO MONTH,
c8 INTERVAL DAY TO SECOND,
c9 INTERVAL DAY(2) TO SECOND(3)
)",
"insert into ts_test values (
timestamp'1999-01-03 10:00:00.123',
timestamp'1999-01-04 10:00:00.123456',
timestamp'1999-01-05 10:00:00.123456+1:0',
timestamp'1999-01-06 10:00:00.123456-1:0',
timestamp'1999-01-06 10:00:00.123456-1:0',
interval'1-2' year to month,
interval'10-4' year to month,
interval'1 2:20:20.123' day to second,
interval'1 2:20:20.12345' day to second)");
foreach ($stmts as $sql) {
$s = oci_parse($c, $sql);
$r = @oci_execute($s);
}
$s = oci_parse($c, "select * from ts_test");
$r = oci_execute($s);
$row = oci_fetch_array($s, OCI_ASSOC);
var_dump($row);
foreach ($row as $name => $field) {
echo "\nColumn $name\n";
var_dump(oci_field_is_null($s, $name));
var_dump(oci_field_name($s, $name));
var_dump(oci_field_type($s, $name));
var_dump(oci_field_type_raw($s, $name));
var_dump(oci_field_scale($s, $name));
var_dump(oci_field_precision($s, $name));
var_dump(oci_field_size($s, $name));
}
// Cleanup
$s = oci_parse($c, "drop table ts_test");
$r = @oci_execute($s);
echo "Done\n";
?>
--EXPECTF--
array(9) {
["C1"]=>
string(28) "03-JAN-99 10.00.00.123000 AM"
["C2"]=>
string(27) "04-JAN-99 10.00.00.12346 AM"
["C3"]=>
string(35) "05-JAN-99 10.00.00.123456 AM +01:00"
["C4"]=>
string(31) "06-JAN-99 10.00.00.12 AM -01:00"
["C5"]=>
string(28) "%s"
["C6"]=>
string(6) "+01-02"
["C7"]=>
string(6) "+10-04"
["C8"]=>
string(19) "+01 02:20:20.123000"
["C9"]=>
string(16) "+01 02:20:20.123"
}
Column C1
bool(false)
string(2) "C1"
string(9) "TIMESTAMP"
int(187)
int(6)
int(0)
int(11)
Column C2
bool(false)
string(2) "C2"
string(9) "TIMESTAMP"
int(187)
int(5)
int(0)
int(11)
Column C3
bool(false)
string(2) "C3"
string(23) "TIMESTAMP WITH TIMEZONE"
int(188)
int(6)
int(0)
int(13)
Column C4
bool(false)
string(2) "C4"
string(23) "TIMESTAMP WITH TIMEZONE"
int(188)
int(2)
int(0)
int(13)
Column C5
bool(false)
string(2) "C5"
string(29) "TIMESTAMP WITH LOCAL TIMEZONE"
int(232)
int(6)
int(0)
int(11)
Column C6
bool(false)
string(2) "C6"
string(22) "INTERVAL YEAR TO MONTH"
int(189)
int(0)
int(2)
int(5)
Column C7
bool(false)
string(2) "C7"
string(22) "INTERVAL YEAR TO MONTH"
int(189)
int(0)
int(2)
int(5)
Column C8
bool(false)
string(2) "C8"
string(22) "INTERVAL DAY TO SECOND"
int(190)
int(6)
int(2)
int(11)
Column C9
bool(false)
string(2) "C9"
string(22) "INTERVAL DAY TO SECOND"
int(190)
int(3)
int(2)
int(11)
Done

View file

@ -1,60 +0,0 @@
--TEST--
Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
require_once 'skipifconnectfailure.inc';
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require __DIR__.'/skipif.inc';
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
"DROP table bug42496_1_tab",
"CREATE table bug42496_1_tab(c1 CLOB, c2 CLOB)",
"INSERT INTO bug42496_1_tab VALUES('test1', 'test1')",
"INSERT INTO bug42496_1_tab VALUES('test2', 'test2')",
"INSERT INTO bug42496_1_tab VALUES('test3', 'test3')"
);
oci8_test_sql_execute($c, $stmtarray);
// Run Test
echo "Test 1\n";
for ($i = 0; $i < 15000; $i++) {
$s = oci_parse($c, "SELECT * from bug42496_1_tab");
oci_define_by_name($s, "C1", $col1);
oci_define_by_name($s, "C2", $col2);
if (oci_execute($s)) {
$arr = array();
while ($arr = oci_fetch_assoc($s)) {
$arr['C1']->free();
$arr['C2']->free();
}
}
oci_free_statement($s);
}
echo "Done\n";
// Cleanup
$stmtarray = array(
"DROP table bug42496_1_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECT--
Test 1
Done

Some files were not shown because too many files have changed in this diff Show more