mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-12 19:50:50 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce6682ac9c |
No files matched your search
@@ -1,2 +0,0 @@
|
||||
OCI8
|
||||
Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson, Maxim Maletsky, Harald Radi, Antony Dovgal, Andi Gutmans, Wez Furlong
|
||||
-381
@@ -1,381 +0,0 @@
|
||||
Installing OCI8
|
||||
---------------
|
||||
|
||||
1. Common requirements.
|
||||
2. Installing as shared extension.
|
||||
3. Installing as statically compiled extension.
|
||||
4. Installing from PECL.
|
||||
5. Testing OCI8
|
||||
6. DRCP and FAN Support
|
||||
|
||||
1. Common requirements
|
||||
----------------------
|
||||
|
||||
If you use a common Oracle Client installation that comes with the
|
||||
Oracle server installation, you MUST set at least the ORACLE_HOME
|
||||
environment variable and make it visible for your web-server BEFORE it
|
||||
starts.
|
||||
|
||||
If you use Oracle Instant Client, you don't have to set ORACLE_HOME
|
||||
and many of the other environment variables to build PHP with OCI8
|
||||
support. The only variables you may have to set are:
|
||||
|
||||
LD_LIBRARY_PATH - it must include the Instant Client library directory
|
||||
|
||||
NLS_LANG - if you want to change the default encoding used during
|
||||
interaction with Oracle servers
|
||||
|
||||
The most appropriate places to add the environment variables are:
|
||||
|
||||
/etc/profile
|
||||
/etc/profile.local
|
||||
/etc/profile.d
|
||||
|
||||
2. Installing as shared extension
|
||||
---------------------------------
|
||||
|
||||
To install OCI8 as a shared extension (i.e. the one you should put
|
||||
into your php.ini) use the following configure lines to configure PHP:
|
||||
|
||||
a) if you use a common Oracle or Oracle Client installation:
|
||||
|
||||
./configure --with-oci8=shared,$ORACLE_HOME
|
||||
|
||||
b) with Oracle Instant Client:
|
||||
|
||||
./configure --with-oci8=shared,instantclient,/path/to/instant/client/lib
|
||||
|
||||
If you use an RPM-based installation of Oracle Instant Client, your configure
|
||||
line will look like this:
|
||||
|
||||
./configure --with-oci8=shared,instantclient,/usr/lib/oracle/<OIC version>/client/lib
|
||||
|
||||
Follow the usual building procedure after that and you'll get an OCI8
|
||||
shared extension (i.e. oci8.so). Add it into the php.ini file like
|
||||
this:
|
||||
|
||||
extension=oci8.so
|
||||
|
||||
and don't forget to specify the right extension_dir for PHP to be able
|
||||
to find shared extensions correctly.
|
||||
|
||||
3. Installing as statically compiled extension
|
||||
----------------------------------------------
|
||||
|
||||
To install OCI8 as statically compiled module use the following
|
||||
configure lines:
|
||||
|
||||
a) with a common Oracle or Oracle Client installation
|
||||
|
||||
./configure --with-oci8=$ORACLE_HOME
|
||||
|
||||
b) with Oracle Instant Client
|
||||
|
||||
./configure --with-oci8=instantclient,/path/to/instant/client/lib
|
||||
|
||||
After successful compile, you don't have to add oci8.so to the
|
||||
php.ini. The module will be usable without any additional actions.
|
||||
|
||||
4. Installing from PECL
|
||||
-----------------------
|
||||
|
||||
TBD
|
||||
|
||||
5. Testing OCI8
|
||||
---------------
|
||||
|
||||
OCI8 tests are in ext/oci8/tests. When OCI8 tests are run this
|
||||
directory will contain logs of any failures.
|
||||
|
||||
5.1. Running OCI8 tests on Linux
|
||||
|
||||
5.1.1. Edit ext/oci8/tests/details.inc
|
||||
|
||||
Set the username, password and connection string for the database.
|
||||
Most tests have been developed using the SYSTEM account: some tests
|
||||
might fail unless the user has permissions to create necessary
|
||||
tables, views, procedures etc.
|
||||
|
||||
If the database is on the same machine as PHP, set
|
||||
$oracle_on_localhost to TRUE.
|
||||
|
||||
If Oracle 11g Database Resident Connection Pooling is being tested,
|
||||
set $test_drcp to TRUE and ensure the connection string uses an
|
||||
appropriate pooled server (see section 6.2.2).
|
||||
|
||||
An alternative to editing details.inc is the set the environment
|
||||
variables
|
||||
|
||||
PHP_OCI8_TEST_USER
|
||||
PHP_OCI8_TEST_PASS
|
||||
PHP_OCI8_TEST_DB
|
||||
PHP_OCI8_TEST_DB_ON_LOCALHOST
|
||||
PHP_OCI8_TEST_DRCP
|
||||
|
||||
for example:
|
||||
|
||||
$ export PHP_OCI8_TEST_USER=system
|
||||
$ export PHP_OCI8_TEST_PASS=oracle
|
||||
$ export PHP_OCI8_TEST_DB=localhost/XE
|
||||
$ export PHP_OCI8_TEST_DB_ON_LOCALHOST=TRUE
|
||||
$ export PHP_OCI8_TEST_DRCP=FALSE
|
||||
|
||||
5.1.2. Set any necessary environment variables for the Oracle
|
||||
database. With Oracle 10g XE do:
|
||||
|
||||
$ . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
|
||||
|
||||
For other versions of the Oracle database do:
|
||||
|
||||
$ . /usr/local/bin/oraenv
|
||||
|
||||
5.1.3. Check your php.ini has E in the variables_order parameter, for
|
||||
example:
|
||||
|
||||
variables_order = "EGPCS"
|
||||
|
||||
5.1.4. Run the tests:
|
||||
|
||||
$ cd <your php src directory>
|
||||
$ make test TESTS=ext/oci8
|
||||
|
||||
5.2. The tests execute rapidly. On fast machines with a local
|
||||
database configured for light load (e.g. Oracle 10g XE) you might
|
||||
see random tests fail with ORA-12516 or ORA-12520 errors. To
|
||||
prevent this, increase the database PROCESSES parameter using the
|
||||
following steps.
|
||||
|
||||
5.2.1. Connect as the oracle software owner:
|
||||
|
||||
$ su - oracle
|
||||
|
||||
5.2.2. Set the necessary environment variables as in 5.1.2.
|
||||
|
||||
5.2.3. Start the SQL*Plus command line tool and increase PROCESSES
|
||||
|
||||
$ sqlplus / as sysdba
|
||||
SQL> alter system set processes=100 scope=spfile
|
||||
|
||||
5.2.4. Restart the database:
|
||||
|
||||
SQL> startup force
|
||||
|
||||
5.2.5. Rerun the tests
|
||||
|
||||
|
||||
6. DRCP and FAN Support
|
||||
-----------------------
|
||||
|
||||
The PHP 5.3 OCI8 Beta extension has support for the Oracle Database
|
||||
Resident Connection Pool (DRCP) and Fast Application Notification
|
||||
(FAN).
|
||||
|
||||
This release is for Beta testing only. Questions and issues can be
|
||||
raised on the Oracle OTN forum (free registration required)
|
||||
http://www.oracle.com/technology/forums/php.html
|
||||
|
||||
|
||||
6.1. Oracle Version Compatibility
|
||||
|
||||
The OCI8 extension will compile with Oracle libraries from version
|
||||
9iR2 onwards. However, full functionality (e.g. DRCP support) is only
|
||||
available when Oracle 11g is used.
|
||||
|
||||
For other, general database functionality, the version of the Oracle
|
||||
libraries used by PHP does not necessarily have to match the version
|
||||
of the database.
|
||||
|
||||
|
||||
6.2. Database Resident Connection Pooling (DRCP)
|
||||
|
||||
DRCP allows more efficient use of database machine memory and provides
|
||||
high scalability.
|
||||
|
||||
For DRCP to be available in OCI8, Oracle client libraries used by PHP
|
||||
and the version of the Oracle Database must both be 11g.
|
||||
|
||||
Documentation on DRCP is found in several Oracle manuals. For example,
|
||||
see "Configuring Database Resident Connection Pooling" in the Oracle
|
||||
Database Administrator's Guide 11g Release 1 (11.1)
|
||||
http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/manproc004.htm#CHDGIDBA
|
||||
for usage information. A whitepaper
|
||||
http://www.oracle.com/technology/tech/oci/pdf/oracledrcp11g.pdf
|
||||
contains background information on DRCP.
|
||||
|
||||
After building PHP with the OCI8 extension and 11g libraries, follow
|
||||
these steps:
|
||||
|
||||
6.2.1. As a privileged database administrator, use a program like
|
||||
SQL*Plus to start the connection pool in the database:
|
||||
|
||||
SQL> execute dbms_connection_pool.start_pool;
|
||||
|
||||
Optional settings control the size and characteristics of the
|
||||
pool.
|
||||
|
||||
6.2.2. For PHP applications that currently connect using a Network Alias
|
||||
like:
|
||||
|
||||
$c = oci_pconnect("myuser", "mypassword", "MYDB");
|
||||
|
||||
Modify your tnsnames.ora file and add the "(SERVER=POOLED)"
|
||||
clause, for example:
|
||||
|
||||
MYDB = (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=myhost.dom.com)
|
||||
(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=sales)
|
||||
(SERVER=POOLED)))
|
||||
|
||||
Alternatively, modify the Easy Connect syntax in PHP and add
|
||||
":POOLED" after the service name:
|
||||
|
||||
$c = oci_pconnect("myuser", "mypassword",
|
||||
"myhost.dom.com:1521/sales:POOLED");
|
||||
|
||||
6.2.3. Edit php.ini and choose a connection class name. This name
|
||||
indicates a logical division of the connection pool and can be
|
||||
used to isolate pooling for separate applications. Any PHP
|
||||
instance with the same connection class value will share
|
||||
connections in the pool.
|
||||
|
||||
oci8.connection_class = "MY_APPLICATION_NAME"
|
||||
|
||||
6.2.4. Run your application, connecting to the 11g database.
|
||||
|
||||
|
||||
6.3. Fast Application Notification (FAN) Support
|
||||
|
||||
FAN support gives fast connection failover, a high availability
|
||||
feature. This allows PHP OCI8 scripts to be notified when a database
|
||||
machine or database instance becomes unavailable. Without FAN, OCI8
|
||||
can hang until a TCP timeout occurs and an error is returned, which
|
||||
might be several minutes. Enabling FAN in OCI8 can allow your
|
||||
applications to detect errors and re-connect to an available database
|
||||
instance without the web user being aware of an outage.
|
||||
|
||||
FAN support is available when the Oracle client libraries that PHP
|
||||
links with and the Oracle Database are either version 10gR2 or 11g.
|
||||
|
||||
FAN benefits users of Oracle's clustering technology (RAC) because
|
||||
connections to surviving database instances can be immediately made.
|
||||
Users of Oracle's Data Guard with a broker will see the FAN events
|
||||
generated when the standby database goes online. Standalone databases
|
||||
will send FAN events when the database restarts.
|
||||
|
||||
For active connections, when a machine or database instance becomes
|
||||
unavailable, a connection failure error will be returned by the OCI8
|
||||
extension function currently being called. On a subsequent PHP script
|
||||
re-connect, a connection to a surviving database instance will be
|
||||
established. The OCI8 extension also transparently cleans up any idle
|
||||
connections affected by a database machine or instance failure so PHP
|
||||
connect calls will establish a fresh connection without the script
|
||||
being aware of any service disruption.
|
||||
|
||||
When oci8.events is On, it is suggested to set oci8.ping_interval to
|
||||
-1 to disable pinging, since enabling FAN events provide pro-active
|
||||
connection management of idle connections made invalid by a service
|
||||
disruption.
|
||||
|
||||
To enable FAN support in PHP, after building PHP with Oracle 10gR2 or
|
||||
11g libraries follow these steps:
|
||||
|
||||
6.3.1. As a privileged database administrator, use a program like
|
||||
SQL*Plus to enable the database service to post FAN events, for
|
||||
example:
|
||||
|
||||
SQL> execute dbms_service.modify_service(
|
||||
SERVICE_NAME => 'sales',
|
||||
AQ_HA_NOTIFICATIONS => TRUE);
|
||||
|
||||
6.3.2. Edit php.ini and add
|
||||
|
||||
oci8.events = On
|
||||
|
||||
6.3.3. If your application does not already handle OCI8 error
|
||||
conditions, modify it to detect failures and take appropriate
|
||||
action. This may include re-connecting and re-executing
|
||||
statements.
|
||||
|
||||
6.3.4. Run your application, connecting to a 10gR2 or 11g database.
|
||||
|
||||
|
||||
6.4. Changes in this release from PECL OCI8 1.3.0 Beta
|
||||
|
||||
The initial release of OCI8 with DRCP and FAN support was PECL OCI8
|
||||
1.3.0 Beta. This section documents differences from that release.
|
||||
|
||||
6.4.1 Statement caching has been re-enabled.
|
||||
|
||||
Important: if Oracle Database 11.1.0.6 with DRCP connections is used,
|
||||
then the Oracle database patch for bug 6474441 must be applied (see
|
||||
section 6.5) or a workaround below used. Without this patch,
|
||||
"ORA-01000: maximum open cursors exceeded", "ORA-01001 invalid cursor"
|
||||
or "ORA-01002 fetch out of sequence" errors may occur.
|
||||
|
||||
If the Oracle 11.1.0.6 database patch cannot be applied, one of the
|
||||
following three workarounds can be used to disable statement caching
|
||||
instead:
|
||||
|
||||
(i) Connect using Oracle dedicated or shared servers instead of DRCP.
|
||||
|
||||
(ii) Set PHP's oci8.statement_cache_size to 0.
|
||||
|
||||
(iii) Set an event in the database initialization parameter file:
|
||||
event="56699 trace name context forever, level 128".
|
||||
|
||||
6.4.2 Changing Password for non-DRCP connections has been re-enabled.
|
||||
|
||||
When oci_password_change() is successfully performed for non-DRCP
|
||||
connections in a PHP script, subsequent connections with the new
|
||||
password from this PHP instance no longer fail with "ORA-1017 invalid
|
||||
username/password".
|
||||
|
||||
Changing a password over DRCP connections will continue to fail with
|
||||
the error "ORA-56609: Usage not supported with DRCP". This is an
|
||||
documented restriction of Oracle Database 11g.
|
||||
|
||||
6.4.3 Oci8.max_persistent setting is re-enabled.
|
||||
|
||||
The php.ini parameter oci8.max_persistent will limit the number of
|
||||
persistent connections that each PHP process will keep open between
|
||||
HTTP requests. Any further oci_pconnect() calls once this limit is
|
||||
reached will be treated as oci_connect() calls.
|
||||
|
||||
It is still recommended that DRCP users modify the connection pool
|
||||
settings of the database to control resource usage. Non-DRCP users
|
||||
should consider setting oci8.persistent_timeout to close idle
|
||||
connections.
|
||||
|
||||
|
||||
6.4.4 LOGON Triggers can be used to set session properties
|
||||
|
||||
The patch for Oracle Database 11.1.0.6 bug 6474441 (see section 6.5)
|
||||
allows PHP applications with DRCP connection to use a database LOGON
|
||||
trigger to set session properties at the time of session creation.
|
||||
Examples of such settings are the NLS language and the date format.
|
||||
|
||||
If the Oracle 11.1.0.6 database patch cannot be applied, one of the
|
||||
following workarounds can be used:
|
||||
|
||||
(i) After logon, explicitly set the session properties using PHP
|
||||
application code.
|
||||
|
||||
(ii) Connect using Oracle dedicated or shared servers instead of DRCP.
|
||||
|
||||
With DRCP there is an connection management relationship between (i)
|
||||
DRCP's automatic pool expansion and reduction, (ii) PHP's persistent
|
||||
connection caching, (iii) with the way LOGON triggers fire with DRCP
|
||||
authentication. Because of this interplay, LOGON triggers in PHP when
|
||||
DRCP is used are only recommended for setting session attributes and
|
||||
not for per-PHP connection events.
|
||||
|
||||
|
||||
6.5. Patching Oracle Database 11g
|
||||
|
||||
The patch for bug 6474441 is available from Oracle Support's Metalink
|
||||
system.
|
||||
|
||||
The bug is specific to Oracle 11.1.0.6 with DRCP connections. The
|
||||
issues it fixes do not affect connections using Oracle's dedicated
|
||||
(the default connection mode) or shared servers. They do not affect
|
||||
earlier versions of Oracle. The bug is intended to be fixed in Oracle
|
||||
Database 11.1.0.7 (as yet unreleased).
|
||||
@@ -1,394 +0,0 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
if test -z "$SED"; then
|
||||
PHP_OCI8_SED="sed";
|
||||
else
|
||||
PHP_OCI8_SED="$SED";
|
||||
fi
|
||||
|
||||
AC_DEFUN([PHP_OCI_IF_DEFINED],[
|
||||
old_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS=$3
|
||||
AC_EGREP_CPP(yes,[
|
||||
#include <oci.h>
|
||||
#if defined($1)
|
||||
yes
|
||||
#endif
|
||||
],[
|
||||
CPPFLAGS=$old_CPPFLAGS
|
||||
$2
|
||||
],[
|
||||
CPPFLAGS=$old_CPPFLAGS
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[
|
||||
AC_CHECK_SIZEOF(long int, 4)
|
||||
AC_MSG_CHECKING([if we're on a 64-bit platform])
|
||||
if test "$ac_cv_sizeof_long_int" = "4" ; then
|
||||
AC_MSG_RESULT([no])
|
||||
TMP_OCI8_LIB_DIR=lib32
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
TMP_OCI8_LIB_DIR=lib
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([OCI8 libraries dir])
|
||||
if test -d "$OCI8_DIR/lib" && 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=$TMP_OCI8_LIB_DIR
|
||||
else
|
||||
AC_MSG_ERROR([Oracle (OCI8) required libraries not found])
|
||||
fi
|
||||
AC_MSG_RESULT($OCI8_LIB_DIR)
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_OCI8IC_VERSION],[
|
||||
AC_MSG_CHECKING([Oracle Instant Client version])
|
||||
if test -f $PHP_OCI8_INSTANT_CLIENT/libnnz11.$SHLIB_SUFFIX_NAME; then
|
||||
if test -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
|
||||
if test ! -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME; then
|
||||
AC_MSG_ERROR([Link from $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME to libclntsh.$SHLIB_SUFFIX_NAME.11.1 not found])
|
||||
fi
|
||||
OCI8_VERSION=11.1
|
||||
else
|
||||
AC_MSG_ERROR([Oracle Instant Client library version not supported])
|
||||
fi
|
||||
elif test -f $PHP_OCI8_INSTANT_CLIENT/libnnz10.$SHLIB_SUFFIX_NAME; then
|
||||
if test -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
|
||||
if test ! -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME; then
|
||||
AC_MSG_ERROR([Link from $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME to libclntsh.$SHLIB_SUFFIX_NAME.10.1 not found])
|
||||
fi
|
||||
OCI8_VERSION=10.1
|
||||
else
|
||||
AC_MSG_ERROR([Oracle Instant Client library version not supported])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([Oracle Instant Client libraries not found])
|
||||
fi
|
||||
AC_MSG_RESULT([$OCI8_VERSION])
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AC_OCI8_VERSION],[
|
||||
AC_MSG_CHECKING([Oracle version])
|
||||
if test -s "$OCI8_DIR/orainst/unix.rgs"; then
|
||||
OCI8_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | $PHP_OCI8_SED 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
|
||||
test -z "$OCI8_VERSION" && OCI8_VERSION=7.3
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
|
||||
OCI8_VERSION=11.1
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
|
||||
OCI8_VERSION=10.1
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
|
||||
OCI8_VERSION=9.0
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
|
||||
OCI8_VERSION=8.1
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then
|
||||
OCI8_VERSION=8.0
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.a; then
|
||||
if test -f $OCI8_DIR/$OCI8_LIB_DIR/libcore4.a; then
|
||||
OCI8_VERSION=8.0
|
||||
else
|
||||
OCI8_VERSION=8.1
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR(Oracle-OCI8 needed libraries not found)
|
||||
fi
|
||||
AC_MSG_RESULT($OCI8_VERSION)
|
||||
])
|
||||
|
||||
|
||||
dnl --with-oci8=shared,instantclient,/path/to/client/dir/lib
|
||||
dnl or
|
||||
dnl --with-oci8=shared,/path/to/oracle/home
|
||||
PHP_ARG_WITH(oci8, for Oracle (OCI8) support,
|
||||
[ --with-oci8[=DIR] Include Oracle (OCI8) support. DIR defaults to \$ORACLE_HOME.
|
||||
Use --with-oci8=instantclient,/path/to/oic/lib
|
||||
for an Oracle Instant Client installation])
|
||||
|
||||
if test "$PHP_OCI8" != "no"; then
|
||||
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|sed -e 's#\([0-9]\.[0-9]*\.[0-9]*\)\(.*\)#\1#'`
|
||||
else
|
||||
php_version=`echo "$tmp_version"|sed -e 's#\([0-9]\.[0-9]*\.[0-9]*\)\(.*\)#\1#'`
|
||||
fi
|
||||
|
||||
if test -z "$php_version"; then
|
||||
AC_MSG_ERROR([failed to detect PHP version, please report])
|
||||
fi
|
||||
|
||||
ac_IFS=$IFS
|
||||
IFS="."
|
||||
set $php_version
|
||||
IFS=$ac_IFS
|
||||
oci8_php_version=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
|
||||
|
||||
if test "$oci8_php_version" -le "4003010"; then
|
||||
AC_MSG_ERROR([You need at least PHP 4.3.10 to be able to use this version of OCI8. PHP $php_version found])
|
||||
else
|
||||
AC_MSG_RESULT([$php_version, ok])
|
||||
fi
|
||||
fi
|
||||
|
||||
PHP_OCI8_INSTANT_CLIENT="no"
|
||||
|
||||
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" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
|
||||
|
||||
AC_MSG_CHECKING([Oracle Install Directory])
|
||||
if test "$PHP_OCI8" = "yes"; then
|
||||
OCI8_DIR=$ORACLE_HOME
|
||||
else
|
||||
OCI8_DIR=$PHP_OCI8
|
||||
fi
|
||||
AC_MSG_RESULT($OCI8_DIR)
|
||||
|
||||
AC_OCI8_CHECK_LIB_DIR($OCI8_DIR)
|
||||
|
||||
if test -d "$OCI8_DIR/rdbms/public"; then
|
||||
PHP_ADD_INCLUDE($OCI8_DIR/rdbms/public)
|
||||
OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/rdbms/public"
|
||||
fi
|
||||
if test -d "$OCI8_DIR/rdbms/demo"; then
|
||||
PHP_ADD_INCLUDE($OCI8_DIR/rdbms/demo)
|
||||
OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/rdbms/demo"
|
||||
fi
|
||||
if test -d "$OCI8_DIR/network/public"; then
|
||||
PHP_ADD_INCLUDE($OCI8_DIR/network/public)
|
||||
OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/network/public"
|
||||
fi
|
||||
if test -d "$OCI8_DIR/plsql/public"; then
|
||||
PHP_ADD_INCLUDE($OCI8_DIR/plsql/public)
|
||||
OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/plsql/public"
|
||||
fi
|
||||
|
||||
if test -f "$OCI8_DIR/$OCI8_LIB_DIR/sysliblist"; then
|
||||
PHP_EVAL_LIBLINE(`cat $OCI8_DIR/$OCI8_LIB_DIR/sysliblist`, OCI8_SYSLIB)
|
||||
elif test -f "$OCI8_DIR/rdbms/$OCI8_LIB_DIR/sysliblist"; then
|
||||
PHP_EVAL_LIBLINE(`cat $OCI8_DIR/rdbms/$OCI8_LIB_DIR/sysliblist`, OCI8_SYSLIB)
|
||||
fi
|
||||
|
||||
AC_OCI8_VERSION($OCI8_DIR)
|
||||
|
||||
case $OCI8_VERSION in
|
||||
8.0)
|
||||
AC_MSG_ERROR([Oracle client libraries < 9.0 are not supported any more. Please consider upgrading.])
|
||||
;;
|
||||
|
||||
8.1)
|
||||
AC_MSG_ERROR([Oracle client libraries < 9.0 are not supported any more. Please consider upgrading.])
|
||||
;;
|
||||
|
||||
9.0)
|
||||
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
|
||||
PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD)
|
||||
AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])
|
||||
|
||||
dnl These functions are only available in version >= 9.2
|
||||
PHP_CHECK_LIBRARY(clntsh, OCIEnvNlsCreate,
|
||||
[
|
||||
PHP_CHECK_LIBRARY(clntsh, OCINlsCharSetNameToId,
|
||||
[
|
||||
AC_DEFINE(HAVE_OCI_ENV_NLS_CREATE,1,[ ])
|
||||
OCI8_VERSION=9.2
|
||||
], [], [
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
], [], [
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
|
||||
PHP_CHECK_LIBRARY(clntsh, OCIEnvCreate,
|
||||
[
|
||||
AC_DEFINE(HAVE_OCI_ENV_CREATE,1,[ ])
|
||||
], [], [
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
|
||||
PHP_CHECK_LIBRARY(clntsh, OCIStmtPrepare2,
|
||||
[
|
||||
AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ])
|
||||
], [], [
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
|
||||
PHP_CHECK_LIBRARY(clntsh, OCILobRead2,
|
||||
[
|
||||
AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ])
|
||||
], [], [
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
|
||||
;;
|
||||
|
||||
11.1|10.1)
|
||||
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
|
||||
PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD)
|
||||
AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI_ENV_NLS_CREATE,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI_ENV_CREATE,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
|
||||
AC_DEFINE(PHP_OCI8_HAVE_COLLECTIONS,1,[ ])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Oracle version $OCI8_VERSION is not supported])
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl Check if we need to add -locijdbc8
|
||||
dnl
|
||||
PHP_CHECK_LIBRARY(clntsh, OCILobIsTemporary,
|
||||
[
|
||||
AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
|
||||
], [
|
||||
PHP_CHECK_LIBRARY(ocijdbc8, OCILobIsTemporary,
|
||||
[
|
||||
PHP_ADD_LIBRARY(ocijdbc8, 1, OCI8_SHARED_LIBADD)
|
||||
AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
|
||||
], [], [
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
], [
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Check if we have collections
|
||||
dnl
|
||||
PHP_CHECK_LIBRARY(clntsh, OCICollAssign,
|
||||
[
|
||||
AC_DEFINE(PHP_OCI8_HAVE_COLLECTIONS,1,[ ])
|
||||
PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared)
|
||||
],
|
||||
[
|
||||
PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_interface.c, $ext_shared)
|
||||
],
|
||||
[
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
|
||||
AC_DEFINE(HAVE_OCI8,1,[ ])
|
||||
|
||||
PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
|
||||
PHP_SUBST_OLD(OCI8_DIR)
|
||||
PHP_SUBST_OLD(OCI8_VERSION)
|
||||
|
||||
elif test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" != "no"; then
|
||||
|
||||
AC_CHECK_SIZEOF(long int, 4)
|
||||
LIBDIR_SUFFIX=""
|
||||
if test "$ac_cv_sizeof_long_int" = "8" ; then
|
||||
LIBDIR_SUFFIX=64
|
||||
fi
|
||||
|
||||
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 a dir.
|
||||
dnl Generally the Instant Client can be anywhere so the user must pass in the
|
||||
dnl directory to the libraries. But on Linux we default to the most recent
|
||||
dnl version in /usr/lib
|
||||
PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client${LIBDIR_SUFFIX}/lib 2> /dev/null | tail -1`
|
||||
if test -z "$PHP_OCI8_INSTANT_CLIENT"; then
|
||||
AC_MSG_ERROR([Oracle Instant Client directory /usr/lib/oracle/.../client${LIBDIR_SUFFIX}/lib not found. Try --with-oci8=instantclient,DIR])
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT($PHP_OCI8_INSTANT_CLIENT)
|
||||
|
||||
OCI8_DIR=$PHP_OCI8_INSTANT_CLIENT
|
||||
|
||||
AC_MSG_CHECKING([Oracle Instant Client SDK header directory])
|
||||
|
||||
dnl Header directory for Instant Client SDK RPM install
|
||||
OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!^/usr/lib/oracle/\(.*\)/client/lib[/]*$!/usr/include/oracle/\1/client!'`
|
||||
|
||||
dnl Header directory for Instant Client SDK zip file install
|
||||
OCISDKZIPINC=$PHP_OCI8_INSTANT_CLIENT/sdk/include
|
||||
|
||||
dnl Header directory for manual installation
|
||||
OCISDKMANINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!\(.*\)/lib[/]*$!\1/include!'`
|
||||
|
||||
if test -f "$OCISDKRPMINC/oci.h"; then
|
||||
AC_MSG_RESULT($OCISDKRPMINC)
|
||||
PHP_ADD_INCLUDE($OCISDKRPMINC)
|
||||
OCI8INCDIR=$OCISDKRPMINC
|
||||
elif test -f "$OCISDKZIPINC/oci.h"; then
|
||||
AC_MSG_RESULT($OCISDKZIPINC)
|
||||
PHP_ADD_INCLUDE($OCISDKZIPINC)
|
||||
OCI8INCDIR=$OCISDKZIPINC
|
||||
elif test -f "$OCISDKMANINC/oci.h"; then
|
||||
AC_MSG_RESULT($OCISDKMANINC)
|
||||
PHP_ADD_INCLUDE($OCISDKMANINC)
|
||||
OCI8INCDIR=$OCISDKMANINC
|
||||
else
|
||||
AC_MSG_ERROR([Oracle Instant Client SDK header files not found])
|
||||
fi
|
||||
|
||||
OCISYSLIBLIST=`echo "$OCI8INCDIR" | $PHP_OCI8_SED -e 's!\(.*\)/include$!\1/demo/sysliblist!'`
|
||||
if test -f "$OCISYSLIBLIST"; then
|
||||
PHP_EVAL_LIBLINE(`cat $OCISYSLIBLIST`, OCI8_SYSLIB)
|
||||
fi
|
||||
|
||||
AC_OCI8IC_VERSION($PHP_OCI8_INSTANT_CLIENT)
|
||||
case $OCI8_VERSION in
|
||||
11.1|10.1)
|
||||
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
|
||||
PHP_ADD_LIBPATH($PHP_OCI8_INSTANT_CLIENT, OCI8_SHARED_LIBADD)
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_ERROR([Oracle Instant Client version $PHP_OCI8_INSTANT_CLIENT is not supported])
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_DEFINE(HAVE_OCI_INSTANT_CLIENT,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI_ENV_NLS_CREATE,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI_ENV_CREATE,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
|
||||
AC_DEFINE(PHP_OCI8_HAVE_COLLECTIONS,1,[ ])
|
||||
|
||||
PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared)
|
||||
AC_DEFINE(HAVE_OCI8,1,[ ])
|
||||
|
||||
PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
|
||||
PHP_SUBST_OLD(OCI8_DIR)
|
||||
PHP_SUBST_OLD(OCI8_VERSION)
|
||||
|
||||
fi
|
||||
@@ -1,28 +0,0 @@
|
||||
// $Id$
|
||||
// vim:ft=javascript
|
||||
|
||||
ARG_WITH("oci8", "OCI8 support", "no");
|
||||
|
||||
if (PHP_OCI8 != "no") {
|
||||
|
||||
if (CHECK_HEADER_ADD_INCLUDE("oci.h", "CFLAGS_OCI8", PHP_PHP_BUILD + "\\include\\instantclient;" + PHP_OCI8) &&
|
||||
CHECK_LIB("oci.lib", "oci8", PHP_PHP_BUILD + "\\lib\\instantclient;" + PHP_OCI8)
|
||||
|
||||
) {
|
||||
EXTENSION('oci8', 'oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c');
|
||||
|
||||
AC_DEFINE('HAVE_OCI8', 1);
|
||||
AC_DEFINE('HAVE_OCI_INSTANT_CLIENT', 1);
|
||||
AC_DEFINE('HAVE_OCI8_ATTR_STATEMENT', 1);
|
||||
AC_DEFINE('HAVE_OCI_ENV_NLS_CREATE', 1);
|
||||
AC_DEFINE('HAVE_OCI_ENV_CREATE', 1);
|
||||
AC_DEFINE('HAVE_OCI_STMT_PREPARE2', 1);
|
||||
AC_DEFINE('HAVE_OCI_LOB_READ2', 1);
|
||||
AC_DEFINE('HAVE_OCI8_TEMP_LOB', 1);
|
||||
AC_DEFINE('PHP_OCI8_HAVE_COLLECTIONS', 1);
|
||||
|
||||
} else {
|
||||
WARNING("oci8 not enabled; libraries and headers not found");
|
||||
}
|
||||
}
|
||||
|
||||
-2418
File diff suppressed because it is too large.
Load diff
@@ -1,133 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="oci8" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=oci8 - Win32 Release_TS
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "oci8.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "oci8.mak" CFG="oci8 - Win32 Release_TS"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "oci8 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "oci8 - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "oci8 - Win32 Release_TS"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release_TS"
|
||||
# PROP BASE Intermediate_Dir "Release_TS"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release_TS"
|
||||
# PROP Intermediate_Dir "Release_TS"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\include\instantclient" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OCI8=1 /D HAVE_OCI8_TEMP_LOB=1 /D HAVE_OCI8_ATTR_STATEMENT=1 /D COMPILE_DL_OCI8=1 /D PHP_OCI8_HAVE_COLLECTIONS=1 /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x406 /d "NDEBUG"
|
||||
# ADD RSC /l 0x406 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 php4ts.lib oci.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_oci8.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\lib\instantclient" /libpath:"..\..\Release_TS_Inline"
|
||||
|
||||
!ELSEIF "$(CFG)" == "oci8 - Win32 Debug_TS"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Debug_TS"
|
||||
# PROP BASE Intermediate_Dir "Debug_TS"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Debug_TS"
|
||||
# PROP Intermediate_Dir "Debug_TS"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\include\instantclient" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FTP_EXPORTS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OCI8=1 /D HAVE_OCI8_TEMP_LOB=1 /D HAVE_OCI8_ATTR_STATEMENT=1 /D COMPILE_DL_OCI8=1 /D PHP_OCI8_HAVE_COLLECTIONS=1 /FR /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x406 /d "NDEBUG"
|
||||
# ADD RSC /l 0x406 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 php4ts_debug.lib oci.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_oci8.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\lib\instantclient"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "oci8 - Win32 Release_TS"
|
||||
# Name "oci8 - Win32 Debug_TS"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\oci8.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\oci8_collection.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\oci8_interface.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\oci8_lob.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\oci8_statement.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_oci8.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_oci8_int.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,759 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2008 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@php.net> |
|
||||
| Thies C. Arntzen <thies@thieso.net> |
|
||||
| |
|
||||
| Collection support by Andy Sautins <asautins@veripost.net> |
|
||||
| Temporary LOB support by David Benson <dbenson@mancala.com> |
|
||||
| ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> |
|
||||
| |
|
||||
| Redesigned by: Antony Dovgal <antony@zend.com> |
|
||||
| Andi Gutmans <andi@zend.com> |
|
||||
| Wez Furlong <wez@omniti.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_ini.h"
|
||||
|
||||
#if HAVE_OCI8 && PHP_OCI8_HAVE_COLLECTIONS
|
||||
|
||||
#include "php_oci8.h"
|
||||
#include "php_oci8_int.h"
|
||||
|
||||
/* {{{ php_oci_collection_create()
|
||||
Create and return connection handle */
|
||||
php_oci_collection * php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC)
|
||||
{
|
||||
dvoid *dschp1 = NULL;
|
||||
dvoid *parmp1;
|
||||
dvoid *parmp2;
|
||||
php_oci_collection *collection;
|
||||
|
||||
collection = emalloc(sizeof(php_oci_collection));
|
||||
|
||||
collection->connection = connection;
|
||||
collection->collection = NULL;
|
||||
zend_list_addref(collection->connection->rsrc_id);
|
||||
|
||||
/* get type handle by name */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByName,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
connection->svc,
|
||||
(text *) schema,
|
||||
(ub4) schema_len,
|
||||
(text *) tdo,
|
||||
(ub4) tdo_len,
|
||||
(CONST text *) 0,
|
||||
(ub4) 0,
|
||||
OCI_DURATION_SESSION,
|
||||
OCI_TYPEGET_ALL,
|
||||
&(collection->tdo)
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* allocate describe handle */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* describe TDO */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIDescribeAny,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
(dvoid *) collection->tdo,
|
||||
(ub4) 0,
|
||||
OCI_OTYPE_PTR,
|
||||
(ub1) OCI_DEFAULT,
|
||||
(ub1) OCI_PTYPE_TYPE,
|
||||
dschp1
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get first parameter handle */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get the collection type code of the attribute */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
|
||||
(
|
||||
(dvoid*) parmp1,
|
||||
(ub4) OCI_DTYPE_PARAM,
|
||||
(dvoid*) &(collection->coll_typecode),
|
||||
(ub4 *) 0,
|
||||
(ub4) OCI_ATTR_COLLECTION_TYPECODE,
|
||||
connection->err
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
switch(collection->coll_typecode) {
|
||||
case OCI_TYPECODE_TABLE:
|
||||
case OCI_TYPECODE_VARRAY:
|
||||
/* get collection element handle */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
|
||||
(
|
||||
(dvoid*) parmp1,
|
||||
(ub4) OCI_DTYPE_PARAM,
|
||||
(dvoid*) &parmp2,
|
||||
(ub4 *) 0,
|
||||
(ub4) OCI_ATTR_COLLECTION_ELEMENT,
|
||||
connection->err
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get REF of the TDO for the type */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
|
||||
(
|
||||
(dvoid*) parmp2,
|
||||
(ub4) OCI_DTYPE_PARAM,
|
||||
(dvoid*) &(collection->elem_ref),
|
||||
(ub4 *) 0,
|
||||
(ub4) OCI_ATTR_REF_TDO,
|
||||
connection->err
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get the TDO (only header) */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByRef,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
collection->elem_ref,
|
||||
OCI_DURATION_SESSION,
|
||||
OCI_TYPEGET_HEADER,
|
||||
&(collection->element_type)
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get typecode */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
|
||||
(
|
||||
(dvoid*) parmp2,
|
||||
(ub4) OCI_DTYPE_PARAM,
|
||||
(dvoid*) &(collection->element_typecode),
|
||||
(ub4 *) 0,
|
||||
(ub4) OCI_ATTR_TYPECODE,
|
||||
connection->err
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
break;
|
||||
/* we only support VARRAYs and TABLEs */
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unknown collection type %d", collection->coll_typecode);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Create object to hold return table */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectNew,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
connection->svc,
|
||||
OCI_TYPECODE_TABLE,
|
||||
collection->tdo,
|
||||
(dvoid *)0,
|
||||
OCI_DURATION_DEFAULT,
|
||||
TRUE,
|
||||
(dvoid **) &(collection->collection)
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != 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);
|
||||
return collection;
|
||||
|
||||
CLEANUP:
|
||||
|
||||
if (dschp1) {
|
||||
/* free the describe handle (Bug #44113) */
|
||||
PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE));
|
||||
}
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
php_oci_collection_close(collection TSRMLS_CC);
|
||||
return NULL;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_size()
|
||||
Return size of the collection */
|
||||
int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_max()
|
||||
Return max number of elements in the collection */
|
||||
int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
PHP_OCI_CALL_RETURN(*max, OCICollMax, (connection->env, collection->collection));
|
||||
|
||||
/* error handling is not necessary here? */
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_trim()
|
||||
Trim collection to the given number of elements */
|
||||
int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollTrim, (connection->env, connection->err, trim_size, collection->collection));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_append_null()
|
||||
Append NULL element to the end of the collection */
|
||||
int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC)
|
||||
{
|
||||
OCIInd null_index = OCI_IND_NULL;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
/* append NULL element */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_append_date()
|
||||
Append DATE element to the end of the collection (use "DD-MON-YY" format) */
|
||||
int php_oci_collection_append_date(php_oci_collection *collection, char *date, int date_len TSRMLS_DC)
|
||||
{
|
||||
OCIInd new_index = OCI_IND_NOTNULL;
|
||||
OCIDate oci_date;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
/* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
/* failed to convert string to date */
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
(dvoid *) &oci_date,
|
||||
(dvoid *) &new_index,
|
||||
(OCIColl *) collection->collection
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_append_number()
|
||||
Append NUMBER to the end of the collection */
|
||||
int php_oci_collection_append_number(php_oci_collection *collection, char *number, int number_len TSRMLS_DC)
|
||||
{
|
||||
OCIInd new_index = OCI_IND_NOTNULL;
|
||||
double element_double;
|
||||
OCINumber oci_number;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
element_double = zend_strtod(number, NULL);
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
(dvoid *) &oci_number,
|
||||
(dvoid *) &new_index,
|
||||
(OCIColl *) collection->collection
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_append_string()
|
||||
Append STRING to the end of the collection */
|
||||
int php_oci_collection_append_string(php_oci_collection *collection, char *element, int element_len TSRMLS_DC)
|
||||
{
|
||||
OCIInd new_index = OCI_IND_NOTNULL;
|
||||
OCIString *ocistr = (OCIString *)0;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
(dvoid *) ocistr,
|
||||
(dvoid *) &new_index,
|
||||
(OCIColl *) collection->collection
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_append()
|
||||
Append wrapper. Appends any supported element to the end of the collection */
|
||||
int php_oci_collection_append(php_oci_collection *collection, char *element, int element_len TSRMLS_DC)
|
||||
{
|
||||
if (element_len == 0) {
|
||||
return php_oci_collection_append_null(collection TSRMLS_CC);
|
||||
}
|
||||
|
||||
switch(collection->element_typecode) {
|
||||
case OCI_TYPECODE_DATE:
|
||||
return php_oci_collection_append_date(collection, element, element_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_VARCHAR2 :
|
||||
return php_oci_collection_append_string(collection, element, element_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
|
||||
case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
|
||||
case OCI_TYPECODE_REAL : /* REAL */
|
||||
case OCI_TYPECODE_DOUBLE : /* DOUBLE */
|
||||
case OCI_TYPECODE_INTEGER : /* INT */
|
||||
case OCI_TYPECODE_SIGNED16 : /* SHORT */
|
||||
case OCI_TYPECODE_SIGNED32 : /* LONG */
|
||||
case OCI_TYPECODE_DECIMAL : /* DECIMAL */
|
||||
case OCI_TYPECODE_FLOAT : /* FLOAT */
|
||||
case OCI_TYPECODE_NUMBER : /* NUMBER */
|
||||
case OCI_TYPECODE_SMALLINT : /* SMALLINT */
|
||||
return php_oci_collection_append_number(collection, element, element_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown or unsupported type of element: %d", collection->element_typecode);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
/* never reached */
|
||||
return 1;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_element_get()
|
||||
Get the element with the given index */
|
||||
int php_oci_collection_element_get(php_oci_collection *collection, long index, zval **result_element TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
dvoid *element;
|
||||
OCIInd *element_index;
|
||||
boolean exists;
|
||||
oratext buff[1024];
|
||||
ub4 buff_len = 1024;
|
||||
|
||||
MAKE_STD_ZVAL(*result_element);
|
||||
ZVAL_NULL(*result_element);
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollGetElem,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
collection->collection,
|
||||
(ub4)index,
|
||||
&exists,
|
||||
&element,
|
||||
(dvoid **)&element_index
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
FREE_ZVAL(*result_element);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (exists == 0) {
|
||||
/* element doesn't exist */
|
||||
FREE_ZVAL(*result_element);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (*element_index == OCI_IND_NULL) {
|
||||
/* this is not an error, we're returning NULL here */
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (collection->element_typecode) {
|
||||
case OCI_TYPECODE_DATE:
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
FREE_ZVAL(*result_element);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ZVAL_STRINGL(*result_element, (char *)buff, buff_len, 1);
|
||||
Z_STRVAL_P(*result_element)[buff_len] = '\0';
|
||||
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_VARCHAR2:
|
||||
{
|
||||
OCIString *oci_string = *(OCIString **)element;
|
||||
text *str;
|
||||
|
||||
PHP_OCI_CALL_RETURN(str, OCIStringPtr, (connection->env, oci_string));
|
||||
|
||||
if (str) {
|
||||
ZVAL_STRING(*result_element, (char *)str, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_UNSIGNED16: /* UNSIGNED SHORT */
|
||||
case OCI_TYPECODE_UNSIGNED32: /* UNSIGNED LONG */
|
||||
case OCI_TYPECODE_REAL: /* REAL */
|
||||
case OCI_TYPECODE_DOUBLE: /* DOUBLE */
|
||||
case OCI_TYPECODE_INTEGER: /* INT */
|
||||
case OCI_TYPECODE_SIGNED16: /* SHORT */
|
||||
case OCI_TYPECODE_SIGNED32: /* LONG */
|
||||
case OCI_TYPECODE_DECIMAL: /* DECIMAL */
|
||||
case OCI_TYPECODE_FLOAT: /* FLOAT */
|
||||
case OCI_TYPECODE_NUMBER: /* NUMBER */
|
||||
case OCI_TYPECODE_SMALLINT: /* SMALLINT */
|
||||
{
|
||||
double double_number;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
FREE_ZVAL(*result_element);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ZVAL_DOUBLE(*result_element, double_number);
|
||||
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown or unsupported type of element: %d", collection->element_typecode);
|
||||
FREE_ZVAL(*result_element);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
/* never reached */
|
||||
return 1;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_element_set_null()
|
||||
Set the element with the given index to NULL */
|
||||
int php_oci_collection_element_set_null(php_oci_collection *collection, long index TSRMLS_DC)
|
||||
{
|
||||
OCIInd null_index = OCI_IND_NULL;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
/* set NULL element */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_element_set_date()
|
||||
Change element's value to the given DATE */
|
||||
int php_oci_collection_element_set_date(php_oci_collection *collection, long index, char *date, int date_len TSRMLS_DC)
|
||||
{
|
||||
OCIInd new_index = OCI_IND_NOTNULL;
|
||||
OCIDate oci_date;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
/* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
/* failed to convert string to date */
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
(ub4)index,
|
||||
(dvoid *) &oci_date,
|
||||
(dvoid *) &new_index,
|
||||
(OCIColl *) collection->collection
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_element_set_number()
|
||||
Change element's value to the given NUMBER */
|
||||
int php_oci_collection_element_set_number(php_oci_collection *collection, long index, char *number, int number_len TSRMLS_DC)
|
||||
{
|
||||
OCIInd new_index = OCI_IND_NOTNULL;
|
||||
double element_double;
|
||||
OCINumber oci_number;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
element_double = zend_strtod(number, NULL);
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
(ub4) index,
|
||||
(dvoid *) &oci_number,
|
||||
(dvoid *) &new_index,
|
||||
(OCIColl *) collection->collection
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_element_set_string()
|
||||
Change element's value to the given string */
|
||||
int php_oci_collection_element_set_string(php_oci_collection *collection, long index, char *element, int element_len TSRMLS_DC)
|
||||
{
|
||||
OCIInd new_index = OCI_IND_NOTNULL;
|
||||
OCIString *ocistr = (OCIString *)0;
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
(ub4)index,
|
||||
(dvoid *) ocistr,
|
||||
(dvoid *) &new_index,
|
||||
(OCIColl *) collection->collection
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_element_set()
|
||||
Collection element setter */
|
||||
int php_oci_collection_element_set(php_oci_collection *collection, long index, char *value, int value_len TSRMLS_DC)
|
||||
{
|
||||
if (value_len == 0) {
|
||||
return php_oci_collection_element_set_null(collection, index TSRMLS_CC);
|
||||
}
|
||||
|
||||
switch(collection->element_typecode) {
|
||||
case OCI_TYPECODE_DATE:
|
||||
return php_oci_collection_element_set_date(collection, index, value, value_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_VARCHAR2 :
|
||||
return php_oci_collection_element_set_string(collection, index, value, value_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
|
||||
case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
|
||||
case OCI_TYPECODE_REAL : /* REAL */
|
||||
case OCI_TYPECODE_DOUBLE : /* DOUBLE */
|
||||
case OCI_TYPECODE_INTEGER : /* INT */
|
||||
case OCI_TYPECODE_SIGNED16 : /* SHORT */
|
||||
case OCI_TYPECODE_SIGNED32 : /* LONG */
|
||||
case OCI_TYPECODE_DECIMAL : /* DECIMAL */
|
||||
case OCI_TYPECODE_FLOAT : /* FLOAT */
|
||||
case OCI_TYPECODE_NUMBER : /* NUMBER */
|
||||
case OCI_TYPECODE_SMALLINT : /* SMALLINT */
|
||||
return php_oci_collection_element_set_number(collection, index, value, value_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown or unsupported type of element: %d", collection->element_typecode);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
/* never reached */
|
||||
return 1;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_assign()
|
||||
Assigns a value to the collection from another collection */
|
||||
int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_collection *collection_from TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection_dest->connection;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_close()
|
||||
Destroy collection and all associated resources */
|
||||
void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
if (collection->collection) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
zend_list_delete(collection->connection->rsrc_id);
|
||||
|
||||
efree(collection);
|
||||
return;
|
||||
} /* }}} */
|
||||
|
||||
#endif /* HAVE_OCI8 */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,924 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2008 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@php.net> |
|
||||
| Thies C. Arntzen <thies@thieso.net> |
|
||||
| |
|
||||
| Collection support by Andy Sautins <asautins@veripost.net> |
|
||||
| Temporary LOB support by David Benson <dbenson@mancala.com> |
|
||||
| ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> |
|
||||
| |
|
||||
| Redesigned by: Antony Dovgal <antony@zend.com> |
|
||||
| Andi Gutmans <andi@zend.com> |
|
||||
| Wez Furlong <wez@omniti.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_ini.h"
|
||||
|
||||
#if HAVE_OCI8
|
||||
|
||||
#include "php_oci8.h"
|
||||
#include "php_oci8_int.h"
|
||||
|
||||
/* for import/export functions */
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
/* {{{ php_oci_lob_create()
|
||||
Create LOB descriptor and allocate all the resources needed */
|
||||
php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long type TSRMLS_DC)
|
||||
{
|
||||
php_oci_descriptor *descriptor;
|
||||
|
||||
switch (type) {
|
||||
case OCI_DTYPE_FILE:
|
||||
case OCI_DTYPE_LOB:
|
||||
case OCI_DTYPE_ROWID:
|
||||
/* these three are allowed */
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown descriptor type %ld.", type);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
descriptor = ecalloc(1, sizeof(php_oci_descriptor));
|
||||
descriptor->type = type;
|
||||
descriptor->connection = connection;
|
||||
zend_list_addref(descriptor->connection->rsrc_id);
|
||||
|
||||
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0));
|
||||
|
||||
if (OCI_G(errcode) != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
efree(descriptor);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PHP_OCI_REGISTER_RESOURCE(descriptor, le_descriptor);
|
||||
|
||||
descriptor->lob_current_position = 0;
|
||||
descriptor->lob_size = -1; /* we should set it to -1 to know, that it's just not initialized */
|
||||
descriptor->buffering = PHP_OCI_LOB_BUFFER_DISABLED; /* buffering is off by default */
|
||||
descriptor->charset_form = SQLCS_IMPLICIT; /* default value */
|
||||
descriptor->charset_id = connection->charset;
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_LOB || descriptor->type == OCI_DTYPE_FILE) {
|
||||
/* add Lobs & Files to hash. we'll flush them at the end */
|
||||
if (!connection->descriptors) {
|
||||
ALLOC_HASHTABLE(connection->descriptors);
|
||||
zend_hash_init(connection->descriptors, 0, NULL, php_oci_descriptor_flush_hash_dtor, 0);
|
||||
}
|
||||
|
||||
zend_hash_next_index_insert(connection->descriptors,&descriptor,sizeof(php_oci_descriptor *),NULL);
|
||||
}
|
||||
return descriptor;
|
||||
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_get_length()
|
||||
Get length of the LOB. The length is cached so we don't need to ask Oracle every time */
|
||||
int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
|
||||
*length = 0;
|
||||
|
||||
if (descriptor->lob_size >= 0) {
|
||||
*length = descriptor->lob_size;
|
||||
return 0;
|
||||
} else {
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
descriptor->lob_size = *length;
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_callback()
|
||||
Append LOB portion to a memory buffer */
|
||||
#if defined(HAVE_OCI_LOB_READ2)
|
||||
sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp)
|
||||
#else
|
||||
sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece)
|
||||
#endif
|
||||
{
|
||||
ub4 lenp = (ub4) len;
|
||||
php_oci_lob_ctx *ctx = (php_oci_lob_ctx *)ctxp;
|
||||
|
||||
switch (piece)
|
||||
{
|
||||
case OCI_LAST_PIECE:
|
||||
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: {
|
||||
TSRMLS_FETCH();
|
||||
php_error_docref(NULL TSRMLS_CC, 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() */
|
||||
static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, long read_length TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
ub4 chunk_size;
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
return read_length;
|
||||
}
|
||||
|
||||
if (!descriptor->chunk_size) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return read_length; /* we have to return original length here */
|
||||
}
|
||||
descriptor->chunk_size = chunk_size;
|
||||
}
|
||||
|
||||
if ((read_length % descriptor->chunk_size) != 0) {
|
||||
return descriptor->chunk_size * ((read_length / descriptor->chunk_size) + 1);
|
||||
}
|
||||
return read_length;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_read()
|
||||
Read specified portion of the LOB into the buffer */
|
||||
int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long initial_offset, char **data, ub4 *data_len TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
ub4 length = 0;
|
||||
int buffer_size = PHP_OCI_LOB_BUFFER_SIZE;
|
||||
php_oci_lob_ctx ctx;
|
||||
ub1 *bufp;
|
||||
#if defined(HAVE_OCI_LOB_READ2)
|
||||
oraub8 bytes_read, offset = 0;
|
||||
oraub8 requested_len = read_length; /* this is by default */
|
||||
oraub8 chars_read = 0;
|
||||
#else
|
||||
int bytes_read, offset = 0;
|
||||
int requested_len = read_length; /* this is by default */
|
||||
#endif
|
||||
int is_clob = 0;
|
||||
sb4 bytes_per_char = 1;
|
||||
|
||||
*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 TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (length <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (initial_offset > length) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset must be less than size of the LOB");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (read_length == -1) {
|
||||
requested_len = length;
|
||||
}
|
||||
|
||||
if (requested_len > (length - initial_offset)) {
|
||||
requested_len = length - initial_offset;
|
||||
}
|
||||
|
||||
if (requested_len <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
offset = initial_offset;
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
ub2 charset_id = 0;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (charset_id > 0) { /* charset_id is always > 0 for [N]CLOBs */
|
||||
is_clob = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_clob) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
/* BLOBs don't have encoding, so bytes_per_char == 1 */
|
||||
}
|
||||
|
||||
ctx.alloc_len = (requested_len + 1) * bytes_per_char;
|
||||
*data = ecalloc(bytes_per_char, requested_len + 1);
|
||||
|
||||
#ifdef HAVE_OCI_LOB_READ2
|
||||
if (is_clob) {
|
||||
chars_read = requested_len;
|
||||
bytes_read = 0;
|
||||
} else {
|
||||
chars_read = 0;
|
||||
bytes_read = requested_len;
|
||||
}
|
||||
|
||||
buffer_size = (requested_len < buffer_size ) ? requested_len : buffer_size; /* optimize buffer size */
|
||||
buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC); /* use chunk size */
|
||||
|
||||
bufp = (ub1 *) ecalloc(1, buffer_size);
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead2,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
descriptor->descriptor,
|
||||
(oraub8 *)&bytes_read, /* IN/OUT bytes toread/read */
|
||||
(oraub8 *)&chars_read, /* IN/OUT chars toread/read */
|
||||
(oraub8) offset + 1, /* offset (starts with 1) */
|
||||
(dvoid *) bufp,
|
||||
(oraub8) buffer_size, /* size of buffer */
|
||||
OCI_FIRST_PIECE,
|
||||
(dvoid *)&ctx,
|
||||
(OCICallbackLobRead2) php_oci_lob_callback, /* callback... */
|
||||
(ub2) descriptor->charset_id, /* The character set ID of the buffer data. */
|
||||
(ub1) descriptor->charset_form /* The character set form of the buffer data. */
|
||||
)
|
||||
);
|
||||
|
||||
efree(bufp);
|
||||
|
||||
if (is_clob) {
|
||||
offset = descriptor->lob_current_position + chars_read;
|
||||
} else {
|
||||
offset = descriptor->lob_current_position + bytes_read;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
bytes_read = requested_len;
|
||||
buffer_size = (requested_len < buffer_size ) ? requested_len : buffer_size; /* optimize buffer size */
|
||||
buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC); /* use chunk size */
|
||||
|
||||
bufp = (ub1 *) ecalloc(1, buffer_size);
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
descriptor->descriptor,
|
||||
&bytes_read, /* IN/OUT bytes toread/read */
|
||||
offset + 1, /* offset (starts with 1) */
|
||||
(dvoid *) bufp,
|
||||
(ub4) buffer_size, /* size of buffer */
|
||||
(dvoid *)&ctx,
|
||||
(OCICallbackLobRead) php_oci_lob_callback, /* callback... */
|
||||
(ub2) descriptor->charset_id, /* The character set ID of the buffer data. */
|
||||
(ub1) descriptor->charset_form /* The character set form of the buffer data. */
|
||||
)
|
||||
);
|
||||
|
||||
efree(bufp);
|
||||
offset = descriptor->lob_current_position + bytes_read;
|
||||
|
||||
#endif
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
if (*data) {
|
||||
efree(*data);
|
||||
*data = NULL;
|
||||
}
|
||||
*data_len = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
descriptor->lob_current_position = (int)offset;
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
if (*data) {
|
||||
efree(*data);
|
||||
*data = NULL;
|
||||
}
|
||||
*data_len = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_write()
|
||||
Write data to the LOB */
|
||||
int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, int data_len, ub4 *bytes_written TSRMLS_DC)
|
||||
{
|
||||
OCILobLocator *lob = (OCILobLocator *) descriptor->descriptor;
|
||||
php_oci_connection *connection = (php_oci_connection *) descriptor->connection;
|
||||
ub4 lob_length;
|
||||
|
||||
*bytes_written = 0;
|
||||
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!data || data_len <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (offset < 0) {
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
if (offset > descriptor->lob_current_position) {
|
||||
offset = descriptor->lob_current_position;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobWrite,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
lob,
|
||||
(ub4 *)&data_len,
|
||||
(ub4) offset + 1,
|
||||
(dvoid *) data,
|
||||
(ub4) data_len,
|
||||
OCI_ONE_PIECE,
|
||||
(dvoid *)0,
|
||||
(OCICallbackLobWrite) 0,
|
||||
(ub2) descriptor->charset_id,
|
||||
(ub1) descriptor->charset_form
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
*bytes_written = 0;
|
||||
return 1;
|
||||
}
|
||||
*bytes_written = data_len;
|
||||
descriptor->lob_current_position += data_len;
|
||||
|
||||
if (descriptor->lob_current_position > descriptor->lob_size) {
|
||||
descriptor->lob_size = descriptor->lob_current_position;
|
||||
}
|
||||
|
||||
/* marking buffer as used */
|
||||
if (descriptor->buffering == PHP_OCI_LOB_BUFFER_ENABLED) {
|
||||
descriptor->buffering = PHP_OCI_LOB_BUFFER_USED;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_set_buffering()
|
||||
Turn buffering off/onn for this particular LOB */
|
||||
int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
|
||||
if (!on_off && descriptor->buffering == PHP_OCI_LOB_BUFFER_DISABLED) {
|
||||
/* disabling when it's already off */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (on_off && descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) {
|
||||
/* enabling when it's already on */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (on_off) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor));
|
||||
} else {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor));
|
||||
}
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
descriptor->buffering = on_off ? PHP_OCI_LOB_BUFFER_ENABLED : PHP_OCI_LOB_BUFFER_DISABLED;
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_get_buffering()
|
||||
Return current buffering state for the LOB */
|
||||
int php_oci_lob_get_buffering (php_oci_descriptor *descriptor)
|
||||
{
|
||||
if (descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_copy()
|
||||
Copy one LOB (or its part) to another one */
|
||||
int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from, long length TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor_dest->connection;
|
||||
ub4 length_dest, length_from, copy_len;
|
||||
|
||||
if (php_oci_lob_get_length(descriptor_dest, &length_dest TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (php_oci_lob_get_length(descriptor_from, &length_from TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (length == -1) {
|
||||
copy_len = length_from - descriptor_from->lob_current_position;
|
||||
} else {
|
||||
copy_len = length;
|
||||
}
|
||||
|
||||
if ((int)copy_len <= 0) {
|
||||
/* silently fail, there is nothing to copy */
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobCopy,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
descriptor_dest->descriptor,
|
||||
descriptor_from->descriptor,
|
||||
copy_len,
|
||||
descriptor_dest->lob_current_position+1,
|
||||
descriptor_from->lob_current_position+1
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_close()
|
||||
Close LOB */
|
||||
int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (php_oci_temp_lob_close(descriptor TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_temp_lob_close()
|
||||
Close Temporary LOB */
|
||||
int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
int is_temporary;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (is_temporary) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
|
||||
/* {{{ php_oci_lob_flush()
|
||||
Flush buffers for the LOB (only if they have been used) */
|
||||
int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC)
|
||||
{
|
||||
OCILobLocator *lob = descriptor->descriptor;
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
|
||||
if (!lob) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (flush_flag) {
|
||||
case 0:
|
||||
case OCI_LOB_BUFFER_FREE:
|
||||
/* only these two are allowed */
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid flag value: %ld", flush_flag);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* do not really flush buffer, but report success
|
||||
* to suppress OCI error when flushing not used buffer
|
||||
* */
|
||||
if (descriptor->buffering != PHP_OCI_LOB_BUFFER_USED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFlushBuffer, (connection->svc, connection->err, lob, flush_flag));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* marking buffer as enabled and not used */
|
||||
descriptor->buffering = PHP_OCI_LOB_BUFFER_ENABLED;
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_free()
|
||||
Close LOB descriptor and free associated resources */
|
||||
void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC)
|
||||
{
|
||||
if (!descriptor || !descriptor->connection) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (descriptor->connection->descriptors) {
|
||||
/* delete descriptor from the hash */
|
||||
zend_hash_apply_with_argument(descriptor->connection->descriptors, php_oci_descriptor_delete_from_hash, (void *)&descriptor->id TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* flushing Lobs & Files with buffering enabled */
|
||||
if ((descriptor->type == OCI_DTYPE_FILE || descriptor->type == OCI_DTYPE_LOB) && descriptor->buffering == PHP_OCI_LOB_BUFFER_USED) {
|
||||
php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE TSRMLS_CC);
|
||||
}
|
||||
|
||||
#ifdef HAVE_OCI8_TEMP_LOB
|
||||
if (descriptor->type == OCI_DTYPE_LOB) {
|
||||
php_oci_temp_lob_close(descriptor TSRMLS_CC);
|
||||
}
|
||||
#endif
|
||||
|
||||
PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type));
|
||||
|
||||
zend_list_delete(descriptor->connection->rsrc_id);
|
||||
efree(descriptor);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_import()
|
||||
Import LOB contents from the given file */
|
||||
int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC)
|
||||
{
|
||||
int fp;
|
||||
ub4 loblen;
|
||||
OCILobLocator *lob = (OCILobLocator *)descriptor->descriptor;
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
char buf[8192];
|
||||
ub4 offset = 1;
|
||||
|
||||
if ((PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((fp = VCWD_OPEN(filename, O_RDONLY|O_BINARY)) == -1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't open file %s", filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {
|
||||
PHP_OCI_CALL_RETURN(connection->errcode,
|
||||
OCILobWrite,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
lob,
|
||||
&loblen,
|
||||
offset,
|
||||
(dvoid *) &buf,
|
||||
loblen,
|
||||
OCI_ONE_PIECE,
|
||||
(dvoid *)0,
|
||||
(OCICallbackLobWrite) 0,
|
||||
(ub2) descriptor->charset_id,
|
||||
(ub1) descriptor->charset_form
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
close(fp);
|
||||
return 1;
|
||||
}
|
||||
offset += loblen;
|
||||
}
|
||||
close(fp);
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_append()
|
||||
Append data to the end of the LOB */
|
||||
int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor_dest->connection;
|
||||
OCILobLocator *lob_dest = descriptor_dest->descriptor;
|
||||
OCILobLocator *lob_from = descriptor_from->descriptor;
|
||||
ub4 dest_len, from_len;
|
||||
|
||||
if (php_oci_lob_get_length(descriptor_dest, &dest_len TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (php_oci_lob_get_length(descriptor_from, &from_len TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (from_len <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_truncate()
|
||||
Truncate LOB to the given length */
|
||||
int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
OCILobLocator *lob = descriptor->descriptor;
|
||||
ub4 lob_length;
|
||||
|
||||
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (lob_length <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (new_lob_length < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Size must be greater than or equal to 0");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (new_lob_length > lob_length) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Size must be less than or equal to the current LOB size");
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobTrim, (connection->svc, connection->err, lob, new_lob_length));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
descriptor->lob_size = new_lob_length;
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_erase()
|
||||
Erase (or fill with whitespaces, depending on LOB type) the LOB (or its part) */
|
||||
int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
OCILobLocator *lob = descriptor->descriptor;
|
||||
ub4 lob_length;
|
||||
|
||||
*bytes_erased = 0;
|
||||
|
||||
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (offset == -1) {
|
||||
offset = descriptor->lob_current_position;
|
||||
}
|
||||
|
||||
if (length == -1) {
|
||||
length = lob_length;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
*bytes_erased = length;
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_is_equal()
|
||||
Compare two LOB descriptors and figure out if they are pointing to the same LOB */
|
||||
int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descriptor *descriptor_second, boolean *result TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor_first->connection;
|
||||
OCILobLocator *first_lob = descriptor_first->descriptor;
|
||||
OCILobLocator *second_lob = descriptor_second->descriptor;
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsEqual, (connection->env, first_lob, second_lob, result));
|
||||
|
||||
if (connection->errcode) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_write_tmp()
|
||||
Create temporary LOB and write data to it */
|
||||
int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data, int data_len TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
OCILobLocator *lob = descriptor->descriptor;
|
||||
ub4 bytes_written = 0;
|
||||
|
||||
switch (type) {
|
||||
case OCI_TEMP_BLOB:
|
||||
case OCI_TEMP_CLOB:
|
||||
/* only these two are allowed */
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid temporary lob type: %d", type);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (data_len < 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobCreateTemporary,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
lob,
|
||||
OCI_DEFAULT,
|
||||
OCI_DEFAULT,
|
||||
type,
|
||||
OCI_ATTR_NOCACHE,
|
||||
OCI_DURATION_SESSION
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PHP_OCI_CALL_RETURN(connection->errcode, OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE));
|
||||
|
||||
if (connection->errcode) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written TSRMLS_CC);
|
||||
} /* }}} */
|
||||
|
||||
#endif /* HAVE_OCI8 */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,328 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE package SYSTEM "../pear/package.dtd">
|
||||
<package>
|
||||
<name>oci8</name>
|
||||
<summary>OCI8 functions</summary>
|
||||
<maintainers>
|
||||
<maintainer>
|
||||
<user>tony2001</user>
|
||||
<name>Antony Dovgal</name>
|
||||
<email>tony2001@php.net</email>
|
||||
<role>lead</role>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<user>wez</user>
|
||||
<name>Wez Furlong</name>
|
||||
<email>wez@php.net</email>
|
||||
<role>lead</role>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<user>andi</user>
|
||||
<name>Andi Gutmans</name>
|
||||
<email>andi@zend.com</email>
|
||||
<role>lead</role>
|
||||
</maintainer>
|
||||
</maintainers>
|
||||
<description>
|
||||
These functions allow you to access Oracle database servers using
|
||||
the Oracle Call Interface (OCI8).
|
||||
</description>
|
||||
<license>PHP</license>
|
||||
<release>
|
||||
<state>stable</state>
|
||||
<version>1.2.3</version>
|
||||
<date>2007-01-25</date>
|
||||
<notes>
|
||||
Fixed possible segfault in ZTS mode when statements containing sub-statements are destroyed in wrong order.
|
||||
Fixed bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name()).
|
||||
Fixed bug #39988 (type argument of oci_define_by_name() is ignored).
|
||||
Fixed bug #39732 (oci_bind_array_by_name doesn't work on Solaris 64bit).
|
||||
Fixed PECL bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column).
|
||||
Various minor improvements.
|
||||
</notes>
|
||||
<deps>
|
||||
<dep type="php" rel="ge" version="4.3.10"/>
|
||||
<dep type="php" rel="lt" version="6.0.0"/>
|
||||
</deps>
|
||||
</release>
|
||||
<filelist>
|
||||
<file role="doc" name="CREDITS"/>
|
||||
<file role="doc" name="README"/>
|
||||
<file role="src" name="config.m4"/>
|
||||
<file role="src" name="config.w32"/>
|
||||
<file role="src" name="oci8.dsp"/>
|
||||
<file role="src" name="oci8.c"/>
|
||||
<file role="src" name="oci8_interface.c"/>
|
||||
<file role="src" name="oci8_lob.c"/>
|
||||
<file role="src" name="oci8_statement.c"/>
|
||||
<file role="src" name="oci8_collection.c"/>
|
||||
<file role="src" name="php_oci8.h"/>
|
||||
<file role="src" name="php_oci8_int.h"/>
|
||||
<file role="test" name="tests/connect.inc"/>
|
||||
<file role="test" name="tests/create_table.inc"/>
|
||||
<file role="test" name="tests/create_type.inc"/>
|
||||
<file role="test" name="tests/details.inc"/>
|
||||
<file role="test" name="tests/drop_table.inc"/>
|
||||
<file role="test" name="tests/drop_type.inc"/>
|
||||
<file role="test" name="tests/skipif.inc"/>
|
||||
<file role="test" name="tests/array_bind_001.phpt"/>
|
||||
<file role="test" name="tests/array_bind_002.phpt"/>
|
||||
<file role="test" name="tests/array_bind_003.phpt"/>
|
||||
<file role="test" name="tests/array_bind_004.phpt"/>
|
||||
<file role="test" name="tests/array_bind_005.phpt"/>
|
||||
<file role="test" name="tests/array_bind_006.phpt"/>
|
||||
<file role="test" name="tests/array_bind_007.phpt"/>
|
||||
<file role="test" name="tests/array_bind_008.phpt"/>
|
||||
<file role="test" name="tests/array_bind_009.phpt"/>
|
||||
<file role="test" name="tests/array_bind_010.phpt"/>
|
||||
<file role="test" name="tests/array_bind_011.phpt"/>
|
||||
<file role="test" name="tests/array_bind_012.phpt"/>
|
||||
<file role="test" name="tests/array_bind_013.phpt"/>
|
||||
<file role="test" name="tests/array_bind_014.phpt"/>
|
||||
<file role="test" name="tests/array_bind_date1.phpt"/>
|
||||
<file role="test" name="tests/array_bind_date.phpt"/>
|
||||
<file role="test" name="tests/array_bind_float1.phpt"/>
|
||||
<file role="test" name="tests/array_bind_float.phpt"/>
|
||||
<file role="test" name="tests/array_bind_int1.phpt"/>
|
||||
<file role="test" name="tests/array_bind_int.phpt"/>
|
||||
<file role="test" name="tests/array_bind_str1.phpt"/>
|
||||
<file role="test" name="tests/array_bind_str.phpt"/>
|
||||
<file role="test" name="tests/bind_empty.phpt"/>
|
||||
<file role="test" name="tests/bind_long.phpt"/>
|
||||
<file role="test" name="tests/bind_long_raw.phpt"/>
|
||||
<file role="test" name="tests/bind_raw.phpt"/>
|
||||
<file role="test" name="tests/bug26133.phpt"/>
|
||||
<file role="test" name="tests/bug27303_2.phpt"/>
|
||||
<file role="test" name="tests/bug27303_3.phpt"/>
|
||||
<file role="test" name="tests/bug27303_4.phpt"/>
|
||||
<file role="test" name="tests/bug27303.phpt"/>
|
||||
<file role="test" name="tests/bug32325.phpt"/>
|
||||
<file role="test" name="tests/bug35973.phpt"/>
|
||||
<file role="test" name="tests/bug36010.phpt"/>
|
||||
<file role="test" name="tests/bug36096.phpt"/>
|
||||
<file role="test" name="tests/bug37581.phpt"/>
|
||||
<file role="test" name="tests/bug38161.phpt"/>
|
||||
<file role="test" name="tests/bug38173.phpt"/>
|
||||
<file role="test" name="tests/bug40078.phpt"/>
|
||||
<file role="test" name="tests/close.phpt"/>
|
||||
<file role="test" name="tests/coll_001.phpt"/>
|
||||
<file role="test" name="tests/coll_002_func.phpt"/>
|
||||
<file role="test" name="tests/coll_002.phpt"/>
|
||||
<file role="test" name="tests/coll_003_func.phpt"/>
|
||||
<file role="test" name="tests/coll_003.phpt"/>
|
||||
<file role="test" name="tests/coll_004_func.phpt"/>
|
||||
<file role="test" name="tests/coll_004.phpt"/>
|
||||
<file role="test" name="tests/coll_005.phpt"/>
|
||||
<file role="test" name="tests/coll_006_func.phpt"/>
|
||||
<file role="test" name="tests/coll_006.phpt"/>
|
||||
<file role="test" name="tests/coll_007.phpt"/>
|
||||
<file role="test" name="tests/coll_008.phpt"/>
|
||||
<file role="test" name="tests/coll_009_func.phpt"/>
|
||||
<file role="test" name="tests/coll_009.phpt"/>
|
||||
<file role="test" name="tests/coll_010_func.phpt"/>
|
||||
<file role="test" name="tests/coll_010.phpt"/>
|
||||
<file role="test" name="tests/coll_011_func.phpt"/>
|
||||
<file role="test" name="tests/coll_011.phpt"/>
|
||||
<file role="test" name="tests/coll_012_func.phpt"/>
|
||||
<file role="test" name="tests/coll_012.phpt"/>
|
||||
<file role="test" name="tests/coll_013_func.phpt"/>
|
||||
<file role="test" name="tests/coll_013.phpt"/>
|
||||
<file role="test" name="tests/coll_014_func.phpt"/>
|
||||
<file role="test" name="tests/coll_014.phpt"/>
|
||||
<file role="test" name="tests/coll_015_func.phpt"/>
|
||||
<file role="test" name="tests/coll_015.phpt"/>
|
||||
<file role="test" name="tests/coll_016_func.phpt"/>
|
||||
<file role="test" name="tests/coll_016.phpt"/>
|
||||
<file role="test" name="tests/coll_017_func.phpt"/>
|
||||
<file role="test" name="tests/coll_017.phpt"/>
|
||||
<file role="test" name="tests/coll_018.phpt"/>
|
||||
<file role="test" name="tests/coll_019.phpt"/>
|
||||
<file role="test" name="tests/commit_old.phpt"/>
|
||||
<file role="test" name="tests/commit.phpt"/>
|
||||
<file role="test" name="tests/connect_1_old.phpt"/>
|
||||
<file role="test" name="tests/connect_1.phpt"/>
|
||||
<file role="test" name="tests/connect_old.phpt"/>
|
||||
<file role="test" name="tests/connect.phpt"/>
|
||||
<file role="test" name="tests/connect_with_charset_001.phpt"/>
|
||||
<file role="test" name="tests/connect_without_oracle_home_old.phpt"/>
|
||||
<file role="test" name="tests/connect_without_oracle_home.phpt"/>
|
||||
<file role="test" name="tests/cursor_bind_err.phpt"/>
|
||||
<file role="test" name="tests/cursor_bind.phpt"/>
|
||||
<file role="test" name="tests/cursors_old.phpt"/>
|
||||
<file role="test" name="tests/cursors.phpt"/>
|
||||
<file role="test" name="tests/debug.phpt"/>
|
||||
<file role="test" name="tests/default_prefetch1.phpt"/>
|
||||
<file role="test" name="tests/default_prefetch2.phpt"/>
|
||||
<file role="test" name="tests/default_prefetch.phpt"/>
|
||||
<file role="test" name="tests/define1.phpt"/>
|
||||
<file role="test" name="tests/define2.phpt"/>
|
||||
<file role="test" name="tests/define3.phpt"/>
|
||||
<file role="test" name="tests/define4.phpt"/>
|
||||
<file role="test" name="tests/define5.phpt"/>
|
||||
<file role="test" name="tests/define_old.phpt"/>
|
||||
<file role="test" name="tests/define.phpt"/>
|
||||
<file role="test" name="tests/descriptors.phpt"/>
|
||||
<file role="test" name="tests/error1.phpt"/>
|
||||
<file role="test" name="tests/error2.phpt"/>
|
||||
<file role="test" name="tests/error_old.phpt"/>
|
||||
<file role="test" name="tests/error.phpt"/>
|
||||
<file role="test" name="tests/exec_fetch.phpt"/>
|
||||
<file role="test" name="tests/execute_mode.phpt"/>
|
||||
<file role="test" name="tests/fetch_all2.phpt"/>
|
||||
<file role="test" name="tests/fetch_all.phpt"/>
|
||||
<file role="test" name="tests/fetch_array.phpt"/>
|
||||
<file role="test" name="tests/fetch_assoc.phpt"/>
|
||||
<file role="test" name="tests/fetch_into1.phpt"/>
|
||||
<file role="test" name="tests/fetch_into2.phpt"/>
|
||||
<file role="test" name="tests/fetch_into.phpt"/>
|
||||
<file role="test" name="tests/fetch_object.phpt"/>
|
||||
<file role="test" name="tests/fetch.phpt"/>
|
||||
<file role="test" name="tests/fetch_row.phpt"/>
|
||||
<file role="test" name="tests/field_funcs1.phpt"/>
|
||||
<file role="test" name="tests/field_funcs_old.phpt"/>
|
||||
<file role="test" name="tests/field_funcs.phpt"/>
|
||||
<file role="test" name="tests/function_aliases.phpt"/>
|
||||
<file role="test" name="tests/lob_001.phpt"/>
|
||||
<file role="test" name="tests/lob_002.phpt"/>
|
||||
<file role="test" name="tests/lob_003.phpt"/>
|
||||
<file role="test" name="tests/lob_004.phpt"/>
|
||||
<file role="test" name="tests/lob_005.phpt"/>
|
||||
<file role="test" name="tests/lob_006.phpt"/>
|
||||
<file role="test" name="tests/lob_007.phpt"/>
|
||||
<file role="test" name="tests/lob_008.phpt"/>
|
||||
<file role="test" name="tests/lob_009.phpt"/>
|
||||
<file role="test" name="tests/lob_010.phpt"/>
|
||||
<file role="test" name="tests/lob_011.phpt"/>
|
||||
<file role="test" name="tests/lob_012.phpt"/>
|
||||
<file role="test" name="tests/lob_013.phpt"/>
|
||||
<file role="test" name="tests/lob_014.phpt"/>
|
||||
<file role="test" name="tests/lob_015.phpt"/>
|
||||
<file role="test" name="tests/lob_016.phpt"/>
|
||||
<file role="test" name="tests/lob_017.phpt"/>
|
||||
<file role="test" name="tests/lob_018.phpt"/>
|
||||
<file role="test" name="tests/lob_019.phpt"/>
|
||||
<file role="test" name="tests/lob_020.phpt"/>
|
||||
<file role="test" name="tests/lob_021.phpt"/>
|
||||
<file role="test" name="tests/lob_022.phpt"/>
|
||||
<file role="test" name="tests/lob_023.phpt"/>
|
||||
<file role="test" name="tests/lob_024.phpt"/>
|
||||
<file role="test" name="tests/lob_025.phpt"/>
|
||||
<file role="test" name="tests/lob_026.phpt"/>
|
||||
<file role="test" name="tests/lob_027.phpt"/>
|
||||
<file role="test" name="tests/lob_028.phpt"/>
|
||||
<file role="test" name="tests/lob_029.phpt"/>
|
||||
<file role="test" name="tests/lob_030.phpt"/>
|
||||
<file role="test" name="tests/lob_031.phpt"/>
|
||||
<file role="test" name="tests/lob_032.phpt"/>
|
||||
<file role="test" name="tests/lob_033.phpt"/>
|
||||
<file role="test" name="tests/lob_034.phpt"/>
|
||||
<file role="test" name="tests/lob_035.phpt"/>
|
||||
<file role="test" name="tests/lob_036.phpt"/>
|
||||
<file role="test" name="tests/lob_aliases.phpt"/>
|
||||
<file role="test" name="tests/lob_temp1.phpt"/>
|
||||
<file role="test" name="tests/lob_temp.phpt"/>
|
||||
<file role="test" name="tests/num.phpt"/>
|
||||
<file role="test" name="tests/oci_execute_segfault.phpt"/>
|
||||
<file role="test" name="tests/old_oci_close1.phpt"/>
|
||||
<file role="test" name="tests/old_oci_close.phpt"/>
|
||||
<file role="test" name="tests/password_new.phpt"/>
|
||||
<file role="test" name="tests/password_old.phpt"/>
|
||||
<file role="test" name="tests/password.phpt"/>
|
||||
<file role="test" name="tests/pecl_bug8816.phpt"/>
|
||||
<file role="test" name="tests/persistent.phpt"/>
|
||||
<file role="test" name="tests/prefetch_old.phpt"/>
|
||||
<file role="test" name="tests/prefetch.phpt"/>
|
||||
<file role="test" name="tests/privileged_connect1.phpt"/>
|
||||
<file role="test" name="tests/privileged_connect.phpt"/>
|
||||
<file role="test" name="tests/select_null.phpt"/>
|
||||
<file role="test" name="tests/serverversion.phpt"/>
|
||||
<file role="test" name="tests/statement_cache.phpt"/>
|
||||
<file role="test" name="tests/statement_type_old.phpt"/>
|
||||
<file role="test" name="tests/statement_type.phpt"/>
|
||||
<file role="test" name="tests/uncommitted.phpt"/>
|
||||
</filelist>
|
||||
<configureoptions>
|
||||
<configureoption name="with-oci8" default="autodetect" prompt="Please provide the path to ORACLE_HOME dir. Use 'instantclient,/path/to/instant/client/lib' if you're compiling against Oracle Instant Client"/>
|
||||
</configureoptions>
|
||||
<changelog>
|
||||
<release>
|
||||
<state>stable</state>
|
||||
<version>1.2.2</version>
|
||||
<date>2006-08-24</date>
|
||||
<notes>
|
||||
Reimplemented oci_lob_read() utilities using patch from Massimo Squillace (msquillace at sogei dot it), which should fix Unicode LOB problems.
|
||||
Fixed bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable)
|
||||
Fixed bug #38173 (Freeing nested cursors causes OCI8 to segfault)
|
||||
Fixed bug #37886 (oci_connect may crash when charset parameter is given)
|
||||
Fixed bug #37931 (possible crash after database restart when using persistent connections)
|
||||
Fixed bug #37531 (oci8 persistent connection corruption)
|
||||
Fixed bug #37487 (oci_fetch_array() array-type should always default to OCI_BOTH)
|
||||
Fixed bug #37392 (Unnecessary call to OCITransRollback() at the end of request)
|
||||
Fixed bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
|
||||
Fixed bug #34005 (oci_password_change() fails). Patch by pholdaway at technocom-wireless dot com.
|
||||
Fixed PECL bug #8112 (Persistent connections misbehave when Apache process times out)
|
||||
</notes>
|
||||
<deps>
|
||||
<dep type="php" rel="ge" version="4.3.10"/>
|
||||
</deps>
|
||||
</release>
|
||||
<release>
|
||||
<state>stable</state>
|
||||
<version>1.2.1</version>
|
||||
<date>2006-05-02</date>
|
||||
<notes>
|
||||
Added support for BINARY_DOUBLE and BINARY_FLOAT (see #36764)
|
||||
Changed oci_field_type() to return VARCHAR2 instead of VARCHAR (according to feature request #36800)
|
||||
Fixed bug #37059 (oci_bind_by_name() doesn't support RAW and LONG RAW fields)
|
||||
Fixed bug #37055 (incorrect reference counting for persistent OCI8 connections)
|
||||
Fixed bug #36934 (OCILob->read() doesn't move internal pointer when reading 0's)
|
||||
Fixed bug #36851 (Documentation and code discrepancies for NULL data)
|
||||
Fixed bug #36820 (Privileged connection with an Oracle password file fails)
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<state>stable</state>
|
||||
<version>1.2.0</version>
|
||||
<date>2006-03-16</date>
|
||||
<notes>
|
||||
Changed OCI8 code to use OCIServerVersion() instead of OCIPing(), which may crash Oracle server of version < 10.2
|
||||
Fixed bug #36235 (ocicolumnname returns false before a succesfull fetch)
|
||||
Fixed bug #36096 (oci_result() returns garbage after oci_fetch() failed)
|
||||
Fixed bug #36055 (possible OCI8 crash in multithreaded environment)
|
||||
Fixed bug #36010 (Segfault when re-creating and re-executing statements with bound parameters)
|
||||
Fixed PECL bug #5571 (oci_new_connect() not closed by oci_close())
|
||||
Fixed bug #33383 (crash when retrieving empty BLOBs)
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<state>beta</state>
|
||||
<version>1.1.1</version>
|
||||
<date>2005-09-22</date>
|
||||
<notes>
|
||||
Fixed segfault when binding empty values.
|
||||
Fixed problem with oci_error() without arguments.
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<state>beta</state>
|
||||
<version>1.1</version>
|
||||
<date>2005-09-07</date>
|
||||
<notes>
|
||||
This release fixes a huge amount of bugs and adds support of
|
||||
statement caching, external credentials etc.
|
||||
See official announce for details.
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<state>beta</state>
|
||||
<version>1.0</version>
|
||||
<date>2004-03-19</date>
|
||||
<notes>
|
||||
package.xml added to support installation using pear installer
|
||||
</notes>
|
||||
</release>
|
||||
</changelog>
|
||||
</package>
|
||||
<!--
|
||||
vim:et:ts=1:sw=1
|
||||
-->
|
||||
@@ -1,513 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<package packagerversion="1.4.11" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
|
||||
http://pear.php.net/dtd/tasks-1.0.xsd
|
||||
http://pear.php.net/dtd/package-2.0
|
||||
http://pear.php.net/dtd/package-2.0.xsd">
|
||||
<name>oci8</name>
|
||||
<channel>pecl.php.net</channel>
|
||||
<summary>OCI8 functions</summary>
|
||||
<description>These functions allow you to access Oracle database servers using
|
||||
the Oracle Call Interface (OCI8).
|
||||
</description>
|
||||
<lead>
|
||||
<name>Antony Dovgal</name>
|
||||
<user>tony2001</user>
|
||||
<email>tony2001@php.net</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<lead>
|
||||
<name>Wez Furlong</name>
|
||||
<user>wez</user>
|
||||
<email>wez@php.net</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<lead>
|
||||
<name>Andi Gutmans</name>
|
||||
<user>andi</user>
|
||||
<email>andi@zend.com</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<lead>
|
||||
<name>Christopher Jones</name>
|
||||
<user>sixd</user>
|
||||
<email>sixd@php.net</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2007-10-05</date>
|
||||
<time>10:00:00</time>
|
||||
|
||||
<version>
|
||||
<release>1.3.1</release>
|
||||
<api>1.3.1</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Fixed bug #44113 (New collection creation can fail with OCI-22303)
|
||||
Fixed bug #42841 (Crash with REF CURSORS when statement caching enabled)
|
||||
Fixed bug #42496 (Cursor leak selecting LOBs
|
||||
Fixed bug #43497 (Temporary LOB leak)
|
||||
Fixed PECL bug #12431 (ping functionality is broken)
|
||||
Allow compilation with 64bit Instant Client RPMs
|
||||
Allow -with-oci8=instantclient with no directory specified look for RPM install
|
||||
Refine DRCP connection pooling functionality
|
||||
</notes>
|
||||
<contents>
|
||||
<dir name="/">
|
||||
<dir name="tests">
|
||||
<file name="array_bind_001.phpt" role="test" />
|
||||
<file name="array_bind_002.phpt" role="test" />
|
||||
<file name="array_bind_003.phpt" role="test" />
|
||||
<file name="array_bind_004.phpt" role="test" />
|
||||
<file name="array_bind_005.phpt" role="test" />
|
||||
<file name="array_bind_006.phpt" role="test" />
|
||||
<file name="array_bind_007.phpt" role="test" />
|
||||
<file name="array_bind_008.phpt" role="test" />
|
||||
<file name="array_bind_009.phpt" role="test" />
|
||||
<file name="array_bind_010.phpt" role="test" />
|
||||
<file name="array_bind_011.phpt" role="test" />
|
||||
<file name="array_bind_012.phpt" role="test" />
|
||||
<file name="array_bind_013.phpt" role="test" />
|
||||
<file name="array_bind_014.phpt" role="test" />
|
||||
<file name="array_bind_date1.phpt" role="test" />
|
||||
<file name="array_bind_date.phpt" role="test" />
|
||||
<file name="array_bind_float1.phpt" role="test" />
|
||||
<file name="array_bind_float.phpt" role="test" />
|
||||
<file name="array_bind_int1.phpt" role="test" />
|
||||
<file name="array_bind_int.phpt" role="test" />
|
||||
<file name="array_bind_str1.phpt" role="test" />
|
||||
<file name="array_bind_str.phpt" role="test" />
|
||||
<file name="bind_empty.phpt" role="test" />
|
||||
<file name="bind_long.phpt" role="test" />
|
||||
<file name="bind_long_raw.phpt" role="test" />
|
||||
<file name="bind_raw.phpt" role="test" />
|
||||
<file name="bug26133.phpt" role="test" />
|
||||
<file name="bug27303_2.phpt" role="test" />
|
||||
<file name="bug27303_3.phpt" role="test" />
|
||||
<file name="bug27303_4.phpt" role="test" />
|
||||
<file name="bug27303.phpt" role="test" />
|
||||
<file name="bug32325.phpt" role="test" />
|
||||
<file name="bug35973.phpt" role="test" />
|
||||
<file name="bug36010.phpt" role="test" />
|
||||
<file name="bug36096.phpt" role="test" />
|
||||
<file name="bug37220.phpt" role="test" />
|
||||
<file name="bug37581.phpt" role="test" />
|
||||
<file name="bug38161.phpt" role="test" />
|
||||
<file name="bug38173.phpt" role="test" />
|
||||
<file name="bug40078.phpt" role="test" />
|
||||
<file name="bug40415.phpt" role="test" />
|
||||
<file name="bug42134.phpt" role="test" />
|
||||
<file name="bug42173.phpt" role="test" />
|
||||
<file name="bug42496_1.phpt" role="test" />
|
||||
<file name="bug42496_2.phpt" role="test" />
|
||||
<file name="bug42841.phpt" role="test" />
|
||||
<file name="bug43492.phpt" role="test" />
|
||||
<file name="bug43497.phpt" role="test" />
|
||||
<file name="bug44113.phpt" role="test" />
|
||||
<file name="close.phpt" role="test" />
|
||||
<file name="coll_001.phpt" role="test" />
|
||||
<file name="coll_002_func.phpt" role="test" />
|
||||
<file name="coll_002.phpt" role="test" />
|
||||
<file name="coll_003_func.phpt" role="test" />
|
||||
<file name="coll_003.phpt" role="test" />
|
||||
<file name="coll_004_func.phpt" role="test" />
|
||||
<file name="coll_004.phpt" role="test" />
|
||||
<file name="coll_005.phpt" role="test" />
|
||||
<file name="coll_006_func.phpt" role="test" />
|
||||
<file name="coll_006.phpt" role="test" />
|
||||
<file name="coll_007.phpt" role="test" />
|
||||
<file name="coll_008.phpt" role="test" />
|
||||
<file name="coll_009_func.phpt" role="test" />
|
||||
<file name="coll_009.phpt" role="test" />
|
||||
<file name="coll_010_func.phpt" role="test" />
|
||||
<file name="coll_010.phpt" role="test" />
|
||||
<file name="coll_011_func.phpt" role="test" />
|
||||
<file name="coll_011.phpt" role="test" />
|
||||
<file name="coll_012_func.phpt" role="test" />
|
||||
<file name="coll_012.phpt" role="test" />
|
||||
<file name="coll_013_func.phpt" role="test" />
|
||||
<file name="coll_013.phpt" role="test" />
|
||||
<file name="coll_014_func.phpt" role="test" />
|
||||
<file name="coll_014.phpt" role="test" />
|
||||
<file name="coll_015_func.phpt" role="test" />
|
||||
<file name="coll_015.phpt" role="test" />
|
||||
<file name="coll_016_func.phpt" role="test" />
|
||||
<file name="coll_016.phpt" role="test" />
|
||||
<file name="coll_017_func.phpt" role="test" />
|
||||
<file name="coll_017.phpt" role="test" />
|
||||
<file name="coll_018.phpt" role="test" />
|
||||
<file name="coll_019.phpt" role="test" />
|
||||
<file name="commit_old.phpt" role="test" />
|
||||
<file name="commit.phpt" role="test" />
|
||||
<file name="connect_1_old.phpt" role="test" />
|
||||
<file name="connect_1.phpt" role="test" />
|
||||
<file name="connect.inc" role="test" />
|
||||
<file name="connect_old.phpt" role="test" />
|
||||
<file name="connect.phpt" role="test" />
|
||||
<file name="connect_with_charset_001.phpt" role="test" />
|
||||
<file name="connect_without_oracle_home_old.phpt" role="test" />
|
||||
<file name="connect_without_oracle_home.phpt" role="test" />
|
||||
<file name="create_table.inc" role="test" />
|
||||
<file name="create_type.inc" role="test" />
|
||||
<file name="cursor_bind_err.phpt" role="test" />
|
||||
<file name="cursor_bind.phpt" role="test" />
|
||||
<file name="cursors_old.phpt" role="test" />
|
||||
<file name="cursors.phpt" role="test" />
|
||||
<file name="debug.phpt" role="test" />
|
||||
<file name="default_prefetch1.phpt" role="test" />
|
||||
<file name="default_prefetch2.phpt" role="test" />
|
||||
<file name="default_prefetch.phpt" role="test" />
|
||||
<file name="define1.phpt" role="test" />
|
||||
<file name="define2.phpt" role="test" />
|
||||
<file name="define3.phpt" role="test" />
|
||||
<file name="define4.phpt" role="test" />
|
||||
<file name="define5.phpt" role="test" />
|
||||
<file name="define_old.phpt" role="test" />
|
||||
<file name="define.phpt" role="test" />
|
||||
<file name="descriptors.phpt" role="test" />
|
||||
<file name="details.inc" role="test" />
|
||||
<file name="drcp_characterset.phpt" role="test" />
|
||||
<file name="drcp_conn_close1.phpt" role="test" />
|
||||
<file name="drcp_conn_close2.phpt" role="test" />
|
||||
<file name="drcp_connect1.phpt" role="test" />
|
||||
<file name="drcp_connection_class.phpt" role="test" />
|
||||
<file name="drcp_functions.inc" role="test" />
|
||||
<file name="drcp_newconnect.phpt" role="test" />
|
||||
<file name="drcp_pconn_close1.phpt" role="test" />
|
||||
<file name="drcp_pconn_close2.phpt" role="test" />
|
||||
<file name="drcp_privileged.phpt" role="test" />
|
||||
<file name="drcp_scope1.phpt" role="test" />
|
||||
<file name="drcp_scope2.phpt" role="test" />
|
||||
<file name="drop_table.inc" role="test" />
|
||||
<file name="drop_type.inc" role="test" />
|
||||
<file name="error1.phpt" role="test" />
|
||||
<file name="error2.phpt" role="test" />
|
||||
<file name="error_old.phpt" role="test" />
|
||||
<file name="error.phpt" role="test" />
|
||||
<file name="exec_fetch.phpt" role="test" />
|
||||
<file name="execute_mode.phpt" role="test" />
|
||||
<file name="fetch_all2.phpt" role="test" />
|
||||
<file name="fetch_all3.phpt" role="test" />
|
||||
<file name="fetch_all.phpt" role="test" />
|
||||
<file name="fetch_array.phpt" role="test" />
|
||||
<file name="fetch_assoc.phpt" role="test" />
|
||||
<file name="fetch_into1.phpt" role="test" />
|
||||
<file name="fetch_into2.phpt" role="test" />
|
||||
<file name="fetch_into.phpt" role="test" />
|
||||
<file name="fetch_object.phpt" role="test" />
|
||||
<file name="fetch.phpt" role="test" />
|
||||
<file name="fetch_row.phpt" role="test" />
|
||||
<file name="field_funcs1.phpt" role="test" />
|
||||
<file name="field_funcs2.phpt" role="test" />
|
||||
<file name="field_funcs_old.phpt" role="test" />
|
||||
<file name="field_funcs.phpt" role="test" />
|
||||
<file name="function_aliases.phpt" role="test" />
|
||||
<file name="lob_001.phpt" role="test" />
|
||||
<file name="lob_002.phpt" role="test" />
|
||||
<file name="lob_003.phpt" role="test" />
|
||||
<file name="lob_004.phpt" role="test" />
|
||||
<file name="lob_005.phpt" role="test" />
|
||||
<file name="lob_006.phpt" role="test" />
|
||||
<file name="lob_007.phpt" role="test" />
|
||||
<file name="lob_008.phpt" role="test" />
|
||||
<file name="lob_009.phpt" role="test" />
|
||||
<file name="lob_009.txt" role="test" />
|
||||
<file name="lob_010.phpt" role="test" />
|
||||
<file name="lob_011.phpt" role="test" />
|
||||
<file name="lob_012.phpt" role="test" />
|
||||
<file name="lob_013.phpt" role="test" />
|
||||
<file name="lob_014.phpt" role="test" />
|
||||
<file name="lob_015.phpt" role="test" />
|
||||
<file name="lob_016.phpt" role="test" />
|
||||
<file name="lob_017.phpt" role="test" />
|
||||
<file name="lob_018.phpt" role="test" />
|
||||
<file name="lob_019.phpt" role="test" />
|
||||
<file name="lob_020.phpt" role="test" />
|
||||
<file name="lob_021.phpt" role="test" />
|
||||
<file name="lob_022.phpt" role="test" />
|
||||
<file name="lob_023.phpt" role="test" />
|
||||
<file name="lob_024.phpt" role="test" />
|
||||
<file name="lob_025.phpt" role="test" />
|
||||
<file name="lob_026.phpt" role="test" />
|
||||
<file name="lob_027.phpt" role="test" />
|
||||
<file name="lob_028.phpt" role="test" />
|
||||
<file name="lob_029.phpt" role="test" />
|
||||
<file name="lob_030.phpt" role="test" />
|
||||
<file name="lob_031.phpt" role="test" />
|
||||
<file name="lob_032.phpt" role="test" />
|
||||
<file name="lob_033.phpt" role="test" />
|
||||
<file name="lob_034.phpt" role="test" />
|
||||
<file name="lob_035.phpt" role="test" />
|
||||
<file name="lob_036.phpt" role="test" />
|
||||
<file name="lob_037.phpt" role="test" />
|
||||
<file name="lob_038.phpt" role="test" />
|
||||
<file name="lob_039.phpt" role="test" />
|
||||
<file name="lob_040.phpt" role="test" />
|
||||
<file name="lob_041.phpt" role="test" />
|
||||
<file name="lob_042.phpt" role="test" />
|
||||
<file name="lob_aliases.phpt" role="test" />
|
||||
<file name="lob_null.phpt" role="test" />
|
||||
<file name="lob_temp1.phpt" role="test" />
|
||||
<file name="lob_temp.phpt" role="test" />
|
||||
<file name="num.phpt" role="test" />
|
||||
<file name="oci8safemode.phpt" role="test" />
|
||||
<file name="oci_execute_segfault.phpt" role="test" />
|
||||
<file name="old_oci_close1.phpt" role="test" />
|
||||
<file name="old_oci_close.phpt" role="test" />
|
||||
<file name="parse_error.phpt" role="test" />
|
||||
<file name="password_2.phpt" role="test" />
|
||||
<file name="password_new.phpt" role="test" />
|
||||
<file name="password_old.phpt" role="test" />
|
||||
<file name="password.phpt" role="test" />
|
||||
<file name="pecl_bug10194_blob.phpt" role="test" />
|
||||
<file name="pecl_bug10194.phpt" role="test" />
|
||||
<file name="pecl_bug8816.phpt" role="test" />
|
||||
<file name="persistent.phpt" role="test" />
|
||||
<file name="prefetch_old.phpt" role="test" />
|
||||
<file name="prefetch.phpt" role="test" />
|
||||
<file name="privileged_connect1.phpt" role="test" />
|
||||
<file name="privileged_connect.phpt" role="test" />
|
||||
<file name="rowid_bind.phpt" role="test" />
|
||||
<file name="select_null.phpt" role="test" />
|
||||
<file name="serverversion.phpt" role="test" />
|
||||
<file name="skipif.inc" role="test" />
|
||||
<file name="statement_cache.phpt" role="test" />
|
||||
<file name="statement_type_old.phpt" role="test" />
|
||||
<file name="statement_type.phpt" role="test" />
|
||||
<file name="test.gif" role="test" />
|
||||
<file name="test.txt" role="test" />
|
||||
<file name="uncommitted.phpt" role="test" />
|
||||
<file name="xmltype_01.phpt" role="test" />
|
||||
</dir> <!-- //tests -->
|
||||
<file name="config.m4" role="src" />
|
||||
<file name="config.w32" role="src" />
|
||||
<file name="CREDITS" role="doc" />
|
||||
<file name="oci8.c" role="src" />
|
||||
<file name="oci8.dsp" role="src" />
|
||||
<file name="oci8_collection.c" role="src" />
|
||||
<file name="oci8_interface.c" role="src" />
|
||||
<file name="oci8_lob.c" role="src" />
|
||||
<file name="oci8_statement.c" role="src" />
|
||||
<file name="php_oci8.h" role="src" />
|
||||
<file name="php_oci8_int.h" role="src" />
|
||||
<file name="README" role="doc" />
|
||||
</dir> <!-- / -->
|
||||
</contents>
|
||||
<dependencies>
|
||||
<required>
|
||||
<php>
|
||||
<min>4.3.11</min>
|
||||
<max>6.0.0</max>
|
||||
<exclude>6.0.0</exclude>
|
||||
</php>
|
||||
<pearinstaller>
|
||||
<min>1.4.0b1</min>
|
||||
</pearinstaller>
|
||||
</required>
|
||||
</dependencies>
|
||||
<providesextension>oci8</providesextension>
|
||||
<extsrcrelease>
|
||||
<configureoption default="autodetect" name="with-oci8" prompt="Please provide the path to ORACLE_HOME dir. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client" />
|
||||
</extsrcrelease>
|
||||
<changelog>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.3.1</release>
|
||||
<api>1.3.1</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Fixed bug #44113 (New collection creation can fail with OCI-22303)
|
||||
Fixed bug #42841 (Crash with REF CURSORS when statement caching enabled)
|
||||
Fixed bug #42496 (Cursor leak selecting LOBs
|
||||
Fixed bug #43497 (Temporary LOB leak)
|
||||
Fixed PECL bug #12431 (ping functionality is broken)
|
||||
Allow compilation with 64bit Instant Client RPMs
|
||||
Allow -with-oci8=instantclient with no directory specified look for RPM install
|
||||
Refine DRCP functionality
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.3.0</release>
|
||||
<api>1.3.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Added DRCP and FAN support.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.2.4</release>
|
||||
<api>1.2.4</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Fixed PECL bug #10194 (crash in Oracle client when memory limit reached in the callback)
|
||||
Fixed bug #42173 (oci_field_type fixes for INTERVAL and TIMESTAMP types)
|
||||
Fixed bug #42134 (oci_error() returns false after oci_new_collection() fails)
|
||||
Fixed bug #41917 (oci_field_precision and oci_field_scale datatypes fixed)
|
||||
Fixed bug #41711 (Null temporary lobs not supported)
|
||||
Fixed bug #41594 (Statement cache is flushed too frequently)
|
||||
Fixed bug #40415 (oci_fetch_all and nested cursors, allocate descriptors dynamically)
|
||||
Fixed segfault on rebinding and re-executing a statement with LOBs.
|
||||
Fixed compile failure in ZTS mode when collections support is missing.
|
||||
Allowed statement cache size to be set for non-persistent connections.
|
||||
Improved oci_password_change() to close persistent connections on shutdown (to update hashed connection details)
|
||||
Changed oci_pconnect() to behave like oci_connect() when SYSDBA and SYSOPER privileges are used.
|
||||
Various minor improvements.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.2.3</release>
|
||||
<api>1.2.3</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<date>2007-01-25</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Fixed possible segfault in ZTS mode when statements containing sub-statements are destroyed in wrong order.
|
||||
Fixed bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name()).
|
||||
Fixed bug #39988 (type argument of oci_define_by_name() is ignored).
|
||||
Fixed bug #39732 (oci_bind_array_by_name doesn't work on Solaris 64bit).
|
||||
Fixed PECL bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column).
|
||||
Various minor improvements.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.2.2</release>
|
||||
<api>1.2.2</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<date>2006-08-24</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Reimplemented oci_lob_read() utilities using patch from Massimo Squillace (msquillace at sogei dot it), which should fix Unicode LOB problems.
|
||||
Fixed bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable)
|
||||
Fixed bug #38173 (Freeing nested cursors causes OCI8 to segfault)
|
||||
Fixed bug #37886 (oci_connect may crash when charset parameter is given)
|
||||
Fixed bug #37931 (possible crash after database restart when using persistent connections)
|
||||
Fixed bug #37531 (oci8 persistent connection corruption)
|
||||
Fixed bug #37487 (oci_fetch_array() array-type should always default to OCI_BOTH)
|
||||
Fixed bug #37392 (Unnecessary call to OCITransRollback() at the end of request)
|
||||
Fixed bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
|
||||
Fixed bug #34005 (oci_password_change() fails). Patch by pholdaway at technocom-wireless dot com.
|
||||
Fixed PECL bug #8112 (Persistent connections misbehave when Apache process times out)
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.2.1</release>
|
||||
<api>1.2.1</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<date>2006-05-02</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Added support for BINARY_DOUBLE and BINARY_FLOAT (see #36764)
|
||||
Changed oci_field_type() to return VARCHAR2 instead of VARCHAR (according to feature request #36800)
|
||||
Fixed bug #37059 (oci_bind_by_name() doesn't support RAW and LONG RAW fields)
|
||||
Fixed bug #37055 (incorrect reference counting for persistent OCI8 connections)
|
||||
Fixed bug #36934 (OCILob->read() doesn't move internal pointer when reading 0's)
|
||||
Fixed bug #36851 (Documentation and code discrepancies for NULL data)
|
||||
Fixed bug #36820 (Privileged connection with an Oracle password file fails)
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.2.0</release>
|
||||
<api>1.2.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<date>2006-03-16</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Changed OCI8 code to use OCIServerVersion() instead of OCIPing(), which may crash Oracle server of version < 10.2
|
||||
Fixed bug #36235 (ocicolumnname returns false before a succesfull fetch)
|
||||
Fixed bug #36096 (oci_result() returns garbage after oci_fetch() failed)
|
||||
Fixed bug #36055 (possible OCI8 crash in multithreaded environment)
|
||||
Fixed bug #36010 (Segfault when re-creating and re-executing statements with bound parameters)
|
||||
Fixed PECL bug #5571 (oci_new_connect() not closed by oci_close())
|
||||
Fixed bug #33383 (crash when retrieving empty BLOBs)
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.1.1</release>
|
||||
<api>1.1.1</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<date>2005-09-22</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>Fixed segfault when binding empty values.
|
||||
Fixed problem with oci_error() without arguments.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.1</release>
|
||||
<api>1.1</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<date>2005-09-07</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>This release fixes a huge amount of bugs and adds support of
|
||||
statement caching, external credentials etc.
|
||||
See official announce for details.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<version>
|
||||
<release>1.0</release>
|
||||
<api>1.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<date>2004-03-19</date>
|
||||
<license uri="http://www.php.net/license">PHP</license>
|
||||
<notes>package.xml added to support installation using pear installer
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
</changelog>
|
||||
</package>
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2008 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@php.net> |
|
||||
| Thies C. Arntzen <thies@thieso.net> |
|
||||
| |
|
||||
| Collection support by Andy Sautins <asautins@veripost.net> |
|
||||
| Temporary LOB support by David Benson <dbenson@mancala.com> |
|
||||
| ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> |
|
||||
| |
|
||||
| Redesigned by: Antony Dovgal <antony@zend.com> |
|
||||
| Andi Gutmans <andi@zend.com> |
|
||||
| Wez Furlong <wez@omniti.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#if HAVE_OCI8
|
||||
# ifndef PHP_OCI8_H
|
||||
# define PHP_OCI8_H
|
||||
|
||||
#ifdef ZTS
|
||||
# include "TSRM.h"
|
||||
#endif
|
||||
|
||||
extern zend_module_entry oci8_module_entry;
|
||||
#define phpext_oci8_ptr &oci8_module_entry
|
||||
|
||||
|
||||
PHP_MINIT_FUNCTION(oci);
|
||||
PHP_RINIT_FUNCTION(oci);
|
||||
PHP_MSHUTDOWN_FUNCTION(oci);
|
||||
PHP_RSHUTDOWN_FUNCTION(oci);
|
||||
PHP_MINFO_FUNCTION(oci);
|
||||
|
||||
# endif /* !PHP_OCI8_H */
|
||||
#else /* !HAVE_OCI8 */
|
||||
|
||||
# define oci8_module_ptr NULL
|
||||
|
||||
#endif /* HAVE_OCI8 */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,479 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2008 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@php.net> |
|
||||
| Thies C. Arntzen <thies@thieso.net> |
|
||||
| |
|
||||
| Collection support by Andy Sautins <asautins@veripost.net> |
|
||||
| Temporary LOB support by David Benson <dbenson@mancala.com> |
|
||||
| ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> |
|
||||
| |
|
||||
| Redesigned by: Antony Dovgal <antony@zend.com> |
|
||||
| Andi Gutmans <andi@zend.com> |
|
||||
| Wez Furlong <wez@omniti.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#if HAVE_OCI8
|
||||
# ifndef PHP_OCI8_INT_H
|
||||
# define PHP_OCI8_INT_H
|
||||
|
||||
/* misc defines {{{ */
|
||||
# if (defined(__osf__) && defined(__alpha))
|
||||
# ifndef A_OSF
|
||||
# define A_OSF
|
||||
# endif
|
||||
# ifndef OSF1
|
||||
# define OSF1
|
||||
# endif
|
||||
# ifndef _INTRINSICS
|
||||
# define _INTRINSICS
|
||||
# endif
|
||||
# endif /* osf alpha */
|
||||
|
||||
#if defined(min)
|
||||
#undef min
|
||||
#endif
|
||||
#if defined(max)
|
||||
#undef max
|
||||
#endif
|
||||
/* }}} */
|
||||
|
||||
#include "ext/standard/php_string.h"
|
||||
#include <oci.h>
|
||||
|
||||
extern int le_connection;
|
||||
extern int le_pconnection;
|
||||
extern int le_statement;
|
||||
extern int le_descriptor;
|
||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
||||
extern int le_collection;
|
||||
#endif
|
||||
extern int le_server;
|
||||
extern int le_session;
|
||||
|
||||
extern zend_class_entry *oci_lob_class_entry_ptr;
|
||||
#ifdef PHP_OCI8_HAVE_COLLECTIONS
|
||||
extern zend_class_entry *oci_coll_class_entry_ptr;
|
||||
#endif
|
||||
|
||||
/* constants {{{ */
|
||||
#define PHP_OCI_SEEK_SET 0
|
||||
#define PHP_OCI_SEEK_CUR 1
|
||||
#define PHP_OCI_SEEK_END 2
|
||||
|
||||
#define PHP_OCI_MAX_NAME_LEN 64
|
||||
#define PHP_OCI_MAX_DATA_SIZE INT_MAX
|
||||
#define PHP_OCI_PIECE_SIZE (64*1024)-1
|
||||
#define PHP_OCI_LOB_BUFFER_SIZE 1048576l /* 1Mb seems to be the most reasonable buffer size for LOB reading */
|
||||
|
||||
#define PHP_OCI_ASSOC 1<<0
|
||||
#define PHP_OCI_NUM 1<<1
|
||||
#define PHP_OCI_BOTH (PHP_OCI_ASSOC|PHP_OCI_NUM)
|
||||
|
||||
#define PHP_OCI_RETURN_NULLS 1<<2
|
||||
#define PHP_OCI_RETURN_LOBS 1<<3
|
||||
|
||||
#define PHP_OCI_FETCHSTATEMENT_BY_COLUMN 1<<4
|
||||
#define PHP_OCI_FETCHSTATEMENT_BY_ROW 1<<5
|
||||
#define PHP_OCI_FETCHSTATEMENT_BY (PHP_OCI_FETCHSTATEMENT_BY_COLUMN | PHP_OCI_FETCHSTATEMENT_BY_ROW)
|
||||
|
||||
#define PHP_OCI_LOB_BUFFER_DISABLED 0
|
||||
#define PHP_OCI_LOB_BUFFER_ENABLED 1
|
||||
#define PHP_OCI_LOB_BUFFER_USED 2
|
||||
|
||||
/* }}} */
|
||||
|
||||
typedef struct { /* php_oci_spool {{{ */
|
||||
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 */
|
||||
char *spool_hash_key; /* Hash key for session pool in plist */
|
||||
} php_oci_spool; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_connection {{{ */
|
||||
OCIEnv *env; /* private env handle */
|
||||
ub2 charset; /* charset ID */
|
||||
OCIServer *server; /* private server handle */
|
||||
OCISvcCtx *svc; /* private service context handle */
|
||||
OCISession *session; /* private session handle */
|
||||
OCIAuthInfo *authinfo; /* Cached authinfo handle for OCISessionGet */
|
||||
OCIError *err; /* private error handle */
|
||||
php_oci_spool *private_spool; /* private session pool (for persistent) */
|
||||
sword errcode; /* last errcode */
|
||||
|
||||
HashTable *descriptors; /* descriptors hash, used to flush all the LOBs using this connection on commit */
|
||||
unsigned is_open:1; /* hels to determine if the connection is dead or not */
|
||||
unsigned is_attached:1; /* hels to determine if we should detach from the server when closing/freeing the connection */
|
||||
unsigned is_persistent:1; /* self-descriptive */
|
||||
unsigned used_this_request:1; /* helps to determine if we should reset connection's next ping time and check its timeout */
|
||||
unsigned needs_commit:1; /* helps to determine if we should rollback this connection on close/shutdown */
|
||||
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? */
|
||||
int rsrc_id; /* resource ID */
|
||||
time_t idle_expiry; /* time when the connection will be considered as expired */
|
||||
time_t next_ping; /* time of the next ping */
|
||||
char *hash_key; /* hashed details of the connection */
|
||||
} php_oci_connection; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_descriptor {{{ */
|
||||
int id;
|
||||
php_oci_connection *connection; /* parent connection handle */
|
||||
dvoid *descriptor; /* OCI descriptor handle */
|
||||
ub4 type; /* descriptor type */
|
||||
int lob_current_position; /* LOB internal pointer */
|
||||
int lob_size; /* cached LOB size. -1 = Lob wasn't initialized yet */
|
||||
int buffering; /* cached buffering flag. 0 - off, 1 - on, 2 - on and buffer was used */
|
||||
ub4 chunk_size; /* chunk size of the LOB. 0 - unknown */
|
||||
ub1 charset_form; /* charset form, required for NCLOBs */
|
||||
ub2 charset_id; /* charset ID */
|
||||
} php_oci_descriptor; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_lob_ctx {{{ */
|
||||
char **lob_data; /* address of pointer to LOB data */
|
||||
ub4 *lob_len; /* address of LOB length variable (bytes) */
|
||||
ub4 alloc_len;
|
||||
} php_oci_lob_ctx; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_collection {{{ */
|
||||
int id;
|
||||
php_oci_connection *connection; /* parent connection handle */
|
||||
OCIType *tdo; /* collection's type handle */
|
||||
OCITypeCode coll_typecode; /* collection's typecode handle */
|
||||
OCIRef *elem_ref; /* element's reference handle */
|
||||
OCIType *element_type; /* element's type handle */
|
||||
OCITypeCode element_typecode; /* element's typecode handle */
|
||||
OCIColl *collection; /* collection handle */
|
||||
} php_oci_collection; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_define {{{ */
|
||||
zval *zval; /* zval used in define */
|
||||
text *name; /* placeholder's name */
|
||||
ub4 name_len; /* placeholder's name length */
|
||||
ub4 type; /* define type */
|
||||
} php_oci_define; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_statement {{{ */
|
||||
int id;
|
||||
php_oci_connection *connection; /* parent connection handle */
|
||||
sword errcode; /* last errcode*/
|
||||
OCIError *err; /* private error handle */
|
||||
OCIStmt *stmt; /* statement handle */
|
||||
char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor recieved from Oracle */
|
||||
long last_query_len; /* last query length */
|
||||
HashTable *columns; /* hash containing all the result columns */
|
||||
HashTable *binds; /* binds hash */
|
||||
HashTable *defines; /* defines hash */
|
||||
int ncolumns; /* number of columns in the result */
|
||||
unsigned executed:1; /* statement executed flag */
|
||||
unsigned has_data:1; /* statement has more data flag */
|
||||
unsigned nested:1; /* statement handle is valid */
|
||||
ub2 stmttype; /* statement type */
|
||||
} php_oci_statement; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_bind {{{ */
|
||||
OCIBind *bind; /* bind handle */
|
||||
zval *zval; /* value */
|
||||
dvoid *descriptor; /* used for binding of LOBS etc */
|
||||
OCIStmt *statement; /* used for binding REFCURSORs */
|
||||
php_oci_statement *parent_statement; /* pointer to the parent statement */
|
||||
struct {
|
||||
void *elements;
|
||||
sb2 *indicators;
|
||||
ub2 *element_lengths;
|
||||
/* ub2 *retcodes; */
|
||||
ub4 current_length;
|
||||
ub4 old_length;
|
||||
ub4 max_length;
|
||||
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; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_out_column {{{ */
|
||||
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 */
|
||||
int stmtid; /* statement id for cursors */
|
||||
int descid; /* descriptor id for descriptors */
|
||||
void *data; /* */
|
||||
php_oci_define *define; /* define handle */
|
||||
int piecewise; /* column is fetched piece-by-piece */
|
||||
ub4 cb_retlen; /* */
|
||||
sb1 scale; /* column scale */
|
||||
sb2 precision; /* column precision */
|
||||
ub1 charset_form; /* charset form, required for NCLOBs */
|
||||
ub2 charset_id; /* charset ID */
|
||||
} php_oci_out_column; /* }}} */
|
||||
|
||||
/* {{{ macros */
|
||||
|
||||
#define PHP_OCI_CALL(func, params) \
|
||||
do { \
|
||||
if (OCI_G(debug_mode)) { \
|
||||
php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
|
||||
} \
|
||||
OCI_G(in_call) = 1; \
|
||||
func params; \
|
||||
OCI_G(in_call) = 0; \
|
||||
} while (0)
|
||||
|
||||
#define PHP_OCI_CALL_RETURN(__retval, func, params) \
|
||||
do { \
|
||||
if (OCI_G(debug_mode)) { \
|
||||
php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
|
||||
} \
|
||||
OCI_G(in_call) = 1; \
|
||||
__retval = func params; \
|
||||
OCI_G(in_call) = 0; \
|
||||
} while (0)
|
||||
|
||||
#define PHP_OCI_HANDLE_ERROR(connection, errcode) \
|
||||
do { \
|
||||
switch (errcode) { \
|
||||
case 1013: \
|
||||
zend_bailout(); \
|
||||
break; \
|
||||
case 22: \
|
||||
case 1012: \
|
||||
case 3113: \
|
||||
case 604: \
|
||||
case 1041: \
|
||||
case 3114: \
|
||||
connection->is_open = 0; \
|
||||
break; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \
|
||||
do { \
|
||||
resource->id = ZEND_REGISTER_RESOURCE(NULL, resource, le_resource); \
|
||||
} while (0)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_CONNECTION(zval, connection) \
|
||||
ZEND_FETCH_RESOURCE2(connection, php_oci_connection *, &zval, -1, "oci8 connection", le_connection, le_pconnection);
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_STATEMENT(zval, statement) \
|
||||
ZEND_FETCH_RESOURCE(statement, php_oci_statement *, &zval, -1, "oci8 statement", le_statement)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_DESCRIPTOR(zval, descriptor) \
|
||||
ZEND_FETCH_RESOURCE(descriptor, php_oci_descriptor *, &zval, -1, "oci8 descriptor", le_descriptor)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_COLLECTION(zval, collection) \
|
||||
ZEND_FETCH_RESOURCE(collection, php_oci_collection *, &zval, -1, "oci8 collection", le_collection)
|
||||
|
||||
#define PHP_OCI_FETCH_RESOURCE_EX(zval, var, type, name, resource_type) \
|
||||
do { \
|
||||
var = (type) zend_fetch_resource(&zval TSRMLS_CC, -1, name, NULL, 1, 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 (void *data);
|
||||
void php_oci_define_hash_dtor (void *data);
|
||||
void php_oci_bind_hash_dtor (void *data);
|
||||
void php_oci_descriptor_flush_hash_dtor (void *data);
|
||||
int php_oci_descriptor_delete_from_hash(void *data, void *id TSRMLS_DC);
|
||||
|
||||
sb4 php_oci_error (OCIError *, sword TSRMLS_DC);
|
||||
sb4 php_oci_fetch_errmsg(OCIError *, text ** TSRMLS_DC);
|
||||
#ifdef HAVE_OCI8_ATTR_STATEMENT
|
||||
int php_oci_fetch_sqltext_offset(php_oci_statement *, text **, ub2 * TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
void php_oci_do_connect (INTERNAL_FUNCTION_PARAMETERS, int , int);
|
||||
php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC);
|
||||
|
||||
int php_oci_connection_rollback(php_oci_connection * TSRMLS_DC);
|
||||
int php_oci_connection_commit(php_oci_connection * TSRMLS_DC);
|
||||
int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC);
|
||||
|
||||
int php_oci_password_change(php_oci_connection *, char *, int, char *, int, char *, int TSRMLS_DC);
|
||||
int php_oci_server_get_version(php_oci_connection *, char ** TSRMLS_DC);
|
||||
|
||||
void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int, int);
|
||||
int php_oci_column_to_zval(php_oci_out_column *, zval *, int TSRMLS_DC);
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* lob related prototypes {{{ */
|
||||
|
||||
php_oci_descriptor * php_oci_lob_create (php_oci_connection *, long TSRMLS_DC);
|
||||
int php_oci_lob_get_length (php_oci_descriptor *, ub4 * TSRMLS_DC);
|
||||
int php_oci_lob_read (php_oci_descriptor *, long, long, char **, ub4 * TSRMLS_DC);
|
||||
int php_oci_lob_write (php_oci_descriptor *, ub4, char *, int, ub4 * TSRMLS_DC);
|
||||
int php_oci_lob_flush (php_oci_descriptor *, long TSRMLS_DC);
|
||||
int php_oci_lob_set_buffering (php_oci_descriptor *, int TSRMLS_DC);
|
||||
int php_oci_lob_get_buffering (php_oci_descriptor *);
|
||||
int php_oci_lob_copy (php_oci_descriptor *, php_oci_descriptor *, long TSRMLS_DC);
|
||||
#ifdef HAVE_OCI8_TEMP_LOB
|
||||
int php_oci_lob_close (php_oci_descriptor * TSRMLS_DC);
|
||||
int php_oci_temp_lob_close (php_oci_descriptor * TSRMLS_DC);
|
||||
int php_oci_lob_write_tmp (php_oci_descriptor *, ub1, char *, int TSRMLS_DC);
|
||||
#endif
|
||||
void php_oci_lob_free(php_oci_descriptor * TSRMLS_DC);
|
||||
int php_oci_lob_import(php_oci_descriptor *descriptor, char * TSRMLS_DC);
|
||||
int php_oci_lob_append (php_oci_descriptor *, php_oci_descriptor * TSRMLS_DC);
|
||||
int php_oci_lob_truncate (php_oci_descriptor *, long TSRMLS_DC);
|
||||
int php_oci_lob_erase (php_oci_descriptor *, long, ub4, ub4 * TSRMLS_DC);
|
||||
int php_oci_lob_is_equal (php_oci_descriptor *, php_oci_descriptor *, boolean * TSRMLS_DC);
|
||||
#if defined(HAVE_OCI_LOB_READ2)
|
||||
sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp);
|
||||
#else
|
||||
sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece);
|
||||
#endif
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* collection related prototypes {{{ */
|
||||
|
||||
php_oci_collection * php_oci_collection_create(php_oci_connection *, char *, int, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_size(php_oci_collection *, sb4 * TSRMLS_DC);
|
||||
int php_oci_collection_max(php_oci_collection *, long * TSRMLS_DC);
|
||||
int php_oci_collection_trim(php_oci_collection *, long TSRMLS_DC);
|
||||
int php_oci_collection_append(php_oci_collection *, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_element_get(php_oci_collection *, long, zval** TSRMLS_DC);
|
||||
int php_oci_collection_element_set(php_oci_collection *, long, char*, int TSRMLS_DC);
|
||||
int php_oci_collection_element_set_null(php_oci_collection *, long TSRMLS_DC);
|
||||
int php_oci_collection_element_set_date(php_oci_collection *, long, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_element_set_number(php_oci_collection *, long, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_element_set_string(php_oci_collection *, long, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_assign(php_oci_collection *, php_oci_collection * TSRMLS_DC);
|
||||
void php_oci_collection_close(php_oci_collection * TSRMLS_DC);
|
||||
int php_oci_collection_append_null(php_oci_collection * TSRMLS_DC);
|
||||
int php_oci_collection_append_date(php_oci_collection *, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_append_number(php_oci_collection *, char *, int TSRMLS_DC);
|
||||
int php_oci_collection_append_string(php_oci_collection *, char *, int TSRMLS_DC);
|
||||
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* statement related prototypes {{{ */
|
||||
|
||||
php_oci_statement * php_oci_statement_create (php_oci_connection *, char *, int TSRMLS_DC);
|
||||
int php_oci_statement_set_prefetch (php_oci_statement *, long TSRMLS_DC);
|
||||
int php_oci_statement_fetch (php_oci_statement *, ub4 TSRMLS_DC);
|
||||
php_oci_out_column * php_oci_statement_get_column (php_oci_statement *, long, char*, int TSRMLS_DC);
|
||||
int php_oci_statement_execute (php_oci_statement *, ub4 TSRMLS_DC);
|
||||
int php_oci_statement_cancel (php_oci_statement * TSRMLS_DC);
|
||||
void php_oci_statement_free (php_oci_statement * TSRMLS_DC);
|
||||
int php_oci_bind_pre_exec(void *data TSRMLS_DC);
|
||||
int php_oci_bind_post_exec(void *data TSRMLS_DC);
|
||||
int php_oci_bind_by_name(php_oci_statement *, char *, int, zval*, long, long TSRMLS_DC);
|
||||
sb4 php_oci_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **);
|
||||
sb4 php_oci_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **);
|
||||
php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data);
|
||||
|
||||
int php_oci_statement_get_type(php_oci_statement *, ub2 * TSRMLS_DC);
|
||||
int php_oci_statement_get_numrows(php_oci_statement *, ub4 * TSRMLS_DC);
|
||||
int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long max_table_length, long maxlength, long type TSRMLS_DC);
|
||||
php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length TSRMLS_DC);
|
||||
php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length TSRMLS_DC);
|
||||
php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, long maxlength TSRMLS_DC);
|
||||
php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, php_oci_connection *connection TSRMLS_DC);
|
||||
|
||||
/* }}} */
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ */
|
||||
sword errcode; /* global last error code (used when connect fails, for example) */
|
||||
OCIError *err; /* global error handle */
|
||||
|
||||
/*
|
||||
char *default_username;
|
||||
char *default_password;
|
||||
char *default_dbname;
|
||||
*/
|
||||
|
||||
zend_bool debug_mode; /* debug mode flag */
|
||||
|
||||
long max_persistent; /* maximum number of persistent connections per process */
|
||||
long num_persistent; /* number of existing persistent connections */
|
||||
long num_links; /* non-persistent + persistent connections */
|
||||
long num_statements; /* number of statements open */
|
||||
long ping_interval; /* time interval between pings */
|
||||
long persistent_timeout; /* time period after which idle persistent connection is considered expired */
|
||||
long statement_cache_size; /* statement cache size. used with 9i+ clients only*/
|
||||
long default_prefetch; /* default prefetch setting */
|
||||
zend_bool privileged_connect; /* privileged connect flag (On/Off) */
|
||||
zend_bool old_oci_close_semantics; /* old_oci_close_semantics flag (to determine the way oci_close() should behave) */
|
||||
|
||||
int shutdown; /* in shutdown flag */
|
||||
|
||||
OCIEnv *env; /* global environment handle */
|
||||
|
||||
zend_bool in_call;
|
||||
char *connection_class;
|
||||
zend_bool events;
|
||||
ZEND_END_MODULE_GLOBALS(oci) /* }}} */
|
||||
|
||||
#ifdef ZTS
|
||||
#define OCI_G(v) TSRMG(oci_globals_id, zend_oci_globals *, v)
|
||||
#else
|
||||
#define OCI_G(v) (oci_globals.v)
|
||||
#endif
|
||||
|
||||
ZEND_EXTERN_MODULE_GLOBALS(oci)
|
||||
|
||||
# endif /* !PHP_OCI8_INT_H */
|
||||
#else /* !HAVE_OCI8 */
|
||||
|
||||
# define oci8_module_ptr NULL
|
||||
|
||||
#endif /* HAVE_OCI8 */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 1
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name DATE)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = "";
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_ODT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): OCI-21560: argument 3 is null, invalid, or out of range in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
}
|
||||
Done
|
||||
@@ -1,77 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 2
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name DATE)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17","05-NOV-05");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 0, 0, SQLT_ODT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): Maximum array length must be greater than zero in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(9) "06-DEC-05"
|
||||
[1]=>
|
||||
string(9) "10-DEC-80"
|
||||
[2]=>
|
||||
string(9) "21-AUG-91"
|
||||
[3]=>
|
||||
string(9) "26-OCT-17"
|
||||
[4]=>
|
||||
string(9) "05-NOV-05"
|
||||
}
|
||||
Done
|
||||
@@ -1,73 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 3
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name DATE)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_ODT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): OCI_NO_DATA in %s on line %d
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(9) "06-DEC-05"
|
||||
[1]=>
|
||||
string(9) "10-DEC-80"
|
||||
[2]=>
|
||||
string(9) "21-AUG-91"
|
||||
[3]=>
|
||||
string(9) "26-OCT-17"
|
||||
}
|
||||
Done
|
||||
@@ -1,65 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 4
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name DATE)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array();
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_ODT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): OCI_NO_DATA in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 5
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name VARCHAR(20))";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("", "", "", "", "");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
[1]=>
|
||||
string(0) ""
|
||||
[2]=>
|
||||
string(0) ""
|
||||
[3]=>
|
||||
string(0) ""
|
||||
[4]=>
|
||||
string(0) ""
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name(), SQLT_CHR and default max_length
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name VARCHAR(20))";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = array("one", "two", "three", "four", "five");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, -1, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(4) "five"
|
||||
[1]=>
|
||||
string(4) "four"
|
||||
[2]=>
|
||||
string(5) "three"
|
||||
[3]=>
|
||||
string(3) "two"
|
||||
[4]=>
|
||||
string(3) "one"
|
||||
}
|
||||
Done
|
||||
@@ -1,77 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 7
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name NUMBER)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array(1,2,3,4,5);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, -1);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: -1 in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(4)
|
||||
[4]=>
|
||||
int(5)
|
||||
}
|
||||
Done
|
||||
@@ -1,78 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 8
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name NUMBER)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array(1,2,3,4,5);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): ORA-06550: line %d, column %d:
|
||||
PLS-00418: array bind type must match PL/SQL table row type
|
||||
ORA-06550: line %d, column %d:
|
||||
PL/SQL: Statement ignored in %s on line %d
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "2"
|
||||
[2]=>
|
||||
string(1) "3"
|
||||
[3]=>
|
||||
string(1) "4"
|
||||
[4]=>
|
||||
string(1) "5"
|
||||
}
|
||||
Done
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 9
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
var_dump(oci_bind_array_by_name($c, ":c1", $array, 5, 5, SQLT_CHR));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): supplied resource is not a valid oci8 statement resource in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and invalid values 8
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$statement = oci_parse($c, 'SELECT user FROM v$session');
|
||||
|
||||
$array = Array(1,2,3,4,5);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): ORA-01036: illegal variable name/number in %s on line %d
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "2"
|
||||
[2]=>
|
||||
string(1) "3"
|
||||
[3]=>
|
||||
string(1) "4"
|
||||
[4]=>
|
||||
string(1) "5"
|
||||
}
|
||||
Done
|
||||
@@ -1,67 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name VARCHAR(20))";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = array();
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, -1, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
Done
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$statement = oci_parse($c, 'SELECT user FROM v$session');
|
||||
|
||||
$array = array();
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, -10, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): Invalid max length value (-10) in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
Done
|
||||
@@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$statement = oci_parse($c, 'SELECT user FROM v$session');
|
||||
|
||||
$array = array();
|
||||
|
||||
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -10, SQLT_CHR, -10));
|
||||
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -10));
|
||||
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -1));
|
||||
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, 0));
|
||||
|
||||
@oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name() expects at most 6 parameters, 7 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
Done
|
||||
@@ -1,73 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and NUMBERs
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name NUMBER)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
for ($i = 1; $i < 6; $i++) {
|
||||
$statement = oci_parse($c, "INSERT INTO bind_test VALUES (".$i.")");
|
||||
oci_execute($statement);
|
||||
}
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
$array = Array();
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, -1, SQLT_INT);
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(5)
|
||||
[1]=>
|
||||
int(4)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(2)
|
||||
[4]=>
|
||||
int(1)
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_ODT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name DATE)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17","05-NOV-05");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_ODT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(9) "05-NOV-05"
|
||||
[1]=>
|
||||
string(9) "26-OCT-17"
|
||||
[2]=>
|
||||
string(9) "21-AUG-91"
|
||||
[3]=>
|
||||
string(9) "10-DEC-80"
|
||||
[4]=>
|
||||
string(9) "06-DEC-05"
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_ODT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name DATE)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF DATE INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("06-DEC-05","10-DEC-80","21-AUG-91","26-OCT-17","05-NOV-05");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_ODT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(9) "05-NOV-05"
|
||||
[1]=>
|
||||
string(9) "26-OCT-17"
|
||||
[2]=>
|
||||
string(9) "21-AUG-91"
|
||||
[3]=>
|
||||
string(9) "10-DEC-80"
|
||||
[4]=>
|
||||
string(9) "06-DEC-05"
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_FLT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name FLOAT)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array(1.243,2.5658,3.4234,4.2123,5.9999);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_FLT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
float(5.9999)
|
||||
[1]=>
|
||||
float(4.2123)
|
||||
[2]=>
|
||||
float(3.4234)
|
||||
[3]=>
|
||||
float(2.5658)
|
||||
[4]=>
|
||||
float(1.243)
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_FLT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name FLOAT)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF FLOAT INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array(1.243,2.5658,3.4234,4.2123,5.9999);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_FLT);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
float(5.9999)
|
||||
[1]=>
|
||||
float(4.2123)
|
||||
[2]=>
|
||||
float(3.4234)
|
||||
[3]=>
|
||||
float(2.5658)
|
||||
[4]=>
|
||||
float(1.243)
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_INT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name NUMBER)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array(1,2,3,4,5);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 5, SQLT_NUM);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(5)
|
||||
[1]=>
|
||||
int(4)
|
||||
[2]=>
|
||||
int(3)
|
||||
[3]=>
|
||||
int(2)
|
||||
[4]=>
|
||||
int(1)
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_INT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name NUMBER)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array(1,2,3,4,5);
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_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
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_AVC
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name VARCHAR(20))";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("one", "two", "three", "four", "five");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(4) "five"
|
||||
[1]=>
|
||||
string(4) "four"
|
||||
[2]=>
|
||||
string(5) "three"
|
||||
[3]=>
|
||||
string(3) "two"
|
||||
[4]=>
|
||||
string(3) "one"
|
||||
}
|
||||
Done
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name() and SQLT_AVC
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name VARCHAR(20))";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
|
||||
CURSOR CUR IS SELECT name FROM bind_test;
|
||||
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
|
||||
BEGIN
|
||||
FOR i IN 1..5 LOOP
|
||||
INSERT INTO bind_test VALUES (c1(i));
|
||||
END LOOP;
|
||||
IF NOT CUR%ISOPEN THEN
|
||||
OPEN CUR;
|
||||
END IF;
|
||||
FOR i IN REVERSE 1..5 LOOP
|
||||
FETCH CUR INTO c1(i);
|
||||
IF CUR%NOTFOUND THEN
|
||||
CLOSE CUR;
|
||||
EXIT;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END iobind;
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
|
||||
|
||||
$array = Array("one", "two", "three", "four", "five");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 10, 20, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(4) "five"
|
||||
[1]=>
|
||||
string(4) "four"
|
||||
[2]=>
|
||||
string(5) "three"
|
||||
[3]=>
|
||||
string(3) "two"
|
||||
[4]=>
|
||||
string(3) "one"
|
||||
}
|
||||
Done
|
||||
@@ -1,104 +0,0 @@
|
||||
--TEST--
|
||||
binding empty values
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name VARCHAR(10))";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
|
||||
echo "Test 1\n";
|
||||
|
||||
$name = null;
|
||||
$stmt = oci_parse($c, "UPDATE bind_test 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_test 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_test (NAME) VALUES ('abc')");
|
||||
$res = oci_execute($stmt);
|
||||
|
||||
$stmt = oci_parse($c, "INSERT INTO bind_test (NAME) VALUES ('def')");
|
||||
$res = oci_execute($stmt);
|
||||
|
||||
$name = null;
|
||||
$stmt = oci_parse($c, "UPDATE bind_test 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_test 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_test 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_test order by 1");
|
||||
oci_execute($stid);
|
||||
oci_fetch_all($stid, $res);
|
||||
var_dump($res);
|
||||
|
||||
|
||||
// Clean up
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
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
|
||||
}
|
||||
}
|
||||
Done
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
bind LONG field
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$stmt = oci_parse($c, "create table phptestlng( id number(10), filetxt long)");
|
||||
oci_execute($stmt);
|
||||
|
||||
$stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)");
|
||||
$i=1;
|
||||
$filetxt = file_get_contents( dirname(__FILE__)."/test.txt");
|
||||
|
||||
oci_bind_by_name( $stmt, ":id", $i, -1);
|
||||
oci_bind_by_name( $stmt, ":filetxt", $filetxt, -1, SQLT_LNG);
|
||||
oci_execute($stmt, OCI_DEFAULT);
|
||||
oci_commit($c);
|
||||
|
||||
$stmt = oci_parse($c, "SELECT filetxt FROM phptestlng");
|
||||
oci_execute($stmt);
|
||||
|
||||
$row = oci_fetch_row($stmt);
|
||||
var_dump(md5($row[0]));
|
||||
var_dump(strlen($row[0]));
|
||||
|
||||
$stmt = oci_parse($c, "drop table phptestlng");
|
||||
oci_execute($stmt);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(32) "da852396d08c9ef9fbdf914db1d6d5bb"
|
||||
int(276)
|
||||
Done
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
bind LONG RAW field
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$stmt = oci_parse($c, "create table phptestlngraw( id number(10), fileimage long raw)");
|
||||
oci_execute($stmt);
|
||||
|
||||
$stmt = oci_parse ($c, "insert into phptestlngraw (id, fileimage) values (:id, :fileimage)");
|
||||
$i=1;
|
||||
$fileimage = file_get_contents( dirname(__FILE__)."/test.gif");
|
||||
|
||||
oci_bind_by_name( $stmt, ":id", $i, -1);
|
||||
oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_LBI);
|
||||
oci_execute($stmt, OCI_DEFAULT);
|
||||
oci_commit($c);
|
||||
|
||||
$stmt = oci_parse($c, "SELECT fileimage FROM phptestlngraw");
|
||||
oci_execute($stmt);
|
||||
|
||||
$row = oci_fetch_row($stmt);
|
||||
var_dump(md5($row[0]));
|
||||
var_dump(strlen($row[0]));
|
||||
|
||||
$stmt = oci_parse($c, "drop table phptestlngraw");
|
||||
oci_execute($stmt);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(32) "614fcbba1effb7caa27ef0ef25c27fcf"
|
||||
int(2523)
|
||||
Done
|
||||
@@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
bind RAW field
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$stmt = oci_parse($c, "create table phptestrawtable( id number(10), fileimage raw(1000))");
|
||||
oci_execute($stmt);
|
||||
|
||||
$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)");
|
||||
$i=1;
|
||||
$fileimage = file_get_contents( dirname(__FILE__)."/test.gif");
|
||||
$fileimage = substr($fileimage, 0, 300);
|
||||
|
||||
oci_bind_by_name( $stmt, ":id", $i, -1);
|
||||
oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_BIN);
|
||||
oci_execute($stmt, OCI_DEFAULT);
|
||||
oci_commit($c);
|
||||
|
||||
$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
|
||||
oci_execute($stmt);
|
||||
|
||||
$row = oci_fetch_row($stmt);
|
||||
var_dump(md5($row[0]));
|
||||
var_dump(strlen($row[0]));
|
||||
|
||||
$stmt = oci_parse($c, "drop table phptestrawtable");
|
||||
oci_execute($stmt);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(32) "88b274d7a257ac6f70435b83abd4e26e"
|
||||
int(300)
|
||||
Done
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
Bug #26133 (ocifreedesc() segfault)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
if ($c) {
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (id, value)
|
||||
VALUES ('1','1')
|
||||
RETURNING
|
||||
ROWID
|
||||
INTO :v_rowid ";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
$rowid = OCINewDescriptor($c,OCI_D_ROWID);
|
||||
OCIBindByName($statement,":v_rowid", $rowid,-1,OCI_B_ROWID);
|
||||
if (OCIExecute($statement)) {
|
||||
OCICommit($c);
|
||||
}
|
||||
OCIFreeStatement($statement);
|
||||
$rowid->free();
|
||||
}
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Done
|
||||
@@ -1,252 +0,0 @@
|
||||
--TEST--
|
||||
Bug #27303 (OCIBindByName binds numeric PHP values as characters)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$create_st = array();
|
||||
$create_st[] = "drop sequence myseq";
|
||||
$create_st[] = "drop table mytab";
|
||||
$create_st[] = "create sequence myseq";
|
||||
$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
@oci_execute($stmt);
|
||||
}
|
||||
|
||||
define('MYLIMIT', 200);
|
||||
define('INITMYBV', 11);
|
||||
|
||||
$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
|
||||
|
||||
$stid = OCIParse($c, $stmt);
|
||||
if (!$stid) { echo "Parse error"; die; }
|
||||
|
||||
//$mybv = INITMYBV; // Uncomment this for the 2nd test only
|
||||
$r = OCIBindByName($stid, ':MYBV', $mybv /*, 5 */); // Uncomment this for the 3rd test only
|
||||
if (!$r) { echo "Bind error"; die; }
|
||||
|
||||
for ($i = 1; $i < MYLIMIT; $i++) {
|
||||
$r = OCIExecute($stid, OCI_DEFAULT);
|
||||
if (!$r) { echo "Execute error"; die; }
|
||||
var_dump($mybv);
|
||||
}
|
||||
|
||||
OCICommit($c);
|
||||
|
||||
$drop_st = array();
|
||||
$drop_st[] = "drop sequence myseq";
|
||||
$drop_st[] = "drop table mytab";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
string(1) "4"
|
||||
string(1) "5"
|
||||
string(1) "6"
|
||||
string(1) "7"
|
||||
string(1) "8"
|
||||
string(1) "9"
|
||||
string(2) "10"
|
||||
string(2) "11"
|
||||
string(2) "12"
|
||||
string(2) "13"
|
||||
string(2) "14"
|
||||
string(2) "15"
|
||||
string(2) "16"
|
||||
string(2) "17"
|
||||
string(2) "18"
|
||||
string(2) "19"
|
||||
string(2) "20"
|
||||
string(2) "21"
|
||||
string(2) "22"
|
||||
string(2) "23"
|
||||
string(2) "24"
|
||||
string(2) "25"
|
||||
string(2) "26"
|
||||
string(2) "27"
|
||||
string(2) "28"
|
||||
string(2) "29"
|
||||
string(2) "30"
|
||||
string(2) "31"
|
||||
string(2) "32"
|
||||
string(2) "33"
|
||||
string(2) "34"
|
||||
string(2) "35"
|
||||
string(2) "36"
|
||||
string(2) "37"
|
||||
string(2) "38"
|
||||
string(2) "39"
|
||||
string(2) "40"
|
||||
string(2) "41"
|
||||
string(2) "42"
|
||||
string(2) "43"
|
||||
string(2) "44"
|
||||
string(2) "45"
|
||||
string(2) "46"
|
||||
string(2) "47"
|
||||
string(2) "48"
|
||||
string(2) "49"
|
||||
string(2) "50"
|
||||
string(2) "51"
|
||||
string(2) "52"
|
||||
string(2) "53"
|
||||
string(2) "54"
|
||||
string(2) "55"
|
||||
string(2) "56"
|
||||
string(2) "57"
|
||||
string(2) "58"
|
||||
string(2) "59"
|
||||
string(2) "60"
|
||||
string(2) "61"
|
||||
string(2) "62"
|
||||
string(2) "63"
|
||||
string(2) "64"
|
||||
string(2) "65"
|
||||
string(2) "66"
|
||||
string(2) "67"
|
||||
string(2) "68"
|
||||
string(2) "69"
|
||||
string(2) "70"
|
||||
string(2) "71"
|
||||
string(2) "72"
|
||||
string(2) "73"
|
||||
string(2) "74"
|
||||
string(2) "75"
|
||||
string(2) "76"
|
||||
string(2) "77"
|
||||
string(2) "78"
|
||||
string(2) "79"
|
||||
string(2) "80"
|
||||
string(2) "81"
|
||||
string(2) "82"
|
||||
string(2) "83"
|
||||
string(2) "84"
|
||||
string(2) "85"
|
||||
string(2) "86"
|
||||
string(2) "87"
|
||||
string(2) "88"
|
||||
string(2) "89"
|
||||
string(2) "90"
|
||||
string(2) "91"
|
||||
string(2) "92"
|
||||
string(2) "93"
|
||||
string(2) "94"
|
||||
string(2) "95"
|
||||
string(2) "96"
|
||||
string(2) "97"
|
||||
string(2) "98"
|
||||
string(2) "99"
|
||||
string(3) "100"
|
||||
string(3) "101"
|
||||
string(3) "102"
|
||||
string(3) "103"
|
||||
string(3) "104"
|
||||
string(3) "105"
|
||||
string(3) "106"
|
||||
string(3) "107"
|
||||
string(3) "108"
|
||||
string(3) "109"
|
||||
string(3) "110"
|
||||
string(3) "111"
|
||||
string(3) "112"
|
||||
string(3) "113"
|
||||
string(3) "114"
|
||||
string(3) "115"
|
||||
string(3) "116"
|
||||
string(3) "117"
|
||||
string(3) "118"
|
||||
string(3) "119"
|
||||
string(3) "120"
|
||||
string(3) "121"
|
||||
string(3) "122"
|
||||
string(3) "123"
|
||||
string(3) "124"
|
||||
string(3) "125"
|
||||
string(3) "126"
|
||||
string(3) "127"
|
||||
string(3) "128"
|
||||
string(3) "129"
|
||||
string(3) "130"
|
||||
string(3) "131"
|
||||
string(3) "132"
|
||||
string(3) "133"
|
||||
string(3) "134"
|
||||
string(3) "135"
|
||||
string(3) "136"
|
||||
string(3) "137"
|
||||
string(3) "138"
|
||||
string(3) "139"
|
||||
string(3) "140"
|
||||
string(3) "141"
|
||||
string(3) "142"
|
||||
string(3) "143"
|
||||
string(3) "144"
|
||||
string(3) "145"
|
||||
string(3) "146"
|
||||
string(3) "147"
|
||||
string(3) "148"
|
||||
string(3) "149"
|
||||
string(3) "150"
|
||||
string(3) "151"
|
||||
string(3) "152"
|
||||
string(3) "153"
|
||||
string(3) "154"
|
||||
string(3) "155"
|
||||
string(3) "156"
|
||||
string(3) "157"
|
||||
string(3) "158"
|
||||
string(3) "159"
|
||||
string(3) "160"
|
||||
string(3) "161"
|
||||
string(3) "162"
|
||||
string(3) "163"
|
||||
string(3) "164"
|
||||
string(3) "165"
|
||||
string(3) "166"
|
||||
string(3) "167"
|
||||
string(3) "168"
|
||||
string(3) "169"
|
||||
string(3) "170"
|
||||
string(3) "171"
|
||||
string(3) "172"
|
||||
string(3) "173"
|
||||
string(3) "174"
|
||||
string(3) "175"
|
||||
string(3) "176"
|
||||
string(3) "177"
|
||||
string(3) "178"
|
||||
string(3) "179"
|
||||
string(3) "180"
|
||||
string(3) "181"
|
||||
string(3) "182"
|
||||
string(3) "183"
|
||||
string(3) "184"
|
||||
string(3) "185"
|
||||
string(3) "186"
|
||||
string(3) "187"
|
||||
string(3) "188"
|
||||
string(3) "189"
|
||||
string(3) "190"
|
||||
string(3) "191"
|
||||
string(3) "192"
|
||||
string(3) "193"
|
||||
string(3) "194"
|
||||
string(3) "195"
|
||||
string(3) "196"
|
||||
string(3) "197"
|
||||
string(3) "198"
|
||||
string(3) "199"
|
||||
Done
|
||||
@@ -1,252 +0,0 @@
|
||||
--TEST--
|
||||
Bug #27303 (OCIBindByName binds numeric PHP values as characters)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$create_st = array();
|
||||
$create_st[] = "drop sequence myseq";
|
||||
$create_st[] = "drop table mytab";
|
||||
$create_st[] = "create sequence myseq";
|
||||
$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
define('MYLIMIT', 200);
|
||||
define('INITMYBV', 11);
|
||||
|
||||
$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
|
||||
|
||||
$stid = OCIParse($c, $stmt);
|
||||
if (!$stid) { echo "Parse error"; die; }
|
||||
|
||||
$mybv = INITMYBV; // Uncomment this for the 2nd test only
|
||||
$r = OCIBindByName($stid, ':MYBV', $mybv /*, 5 */); // Uncomment this for the 3rd test only
|
||||
if (!$r) { echo "Bind error"; die; }
|
||||
|
||||
for ($i = 1; $i < MYLIMIT; $i++) {
|
||||
$r = OCIExecute($stid, OCI_DEFAULT);
|
||||
if (!$r) { echo "Execute error"; die; }
|
||||
var_dump($mybv);
|
||||
}
|
||||
|
||||
OCICommit($c);
|
||||
|
||||
$drop_st = array();
|
||||
$drop_st[] = "drop sequence myseq";
|
||||
$drop_st[] = "drop table mytab";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
string(1) "4"
|
||||
string(1) "5"
|
||||
string(1) "6"
|
||||
string(1) "7"
|
||||
string(1) "8"
|
||||
string(1) "9"
|
||||
string(2) "10"
|
||||
string(2) "11"
|
||||
string(2) "12"
|
||||
string(2) "13"
|
||||
string(2) "14"
|
||||
string(2) "15"
|
||||
string(2) "16"
|
||||
string(2) "17"
|
||||
string(2) "18"
|
||||
string(2) "19"
|
||||
string(2) "20"
|
||||
string(2) "21"
|
||||
string(2) "22"
|
||||
string(2) "23"
|
||||
string(2) "24"
|
||||
string(2) "25"
|
||||
string(2) "26"
|
||||
string(2) "27"
|
||||
string(2) "28"
|
||||
string(2) "29"
|
||||
string(2) "30"
|
||||
string(2) "31"
|
||||
string(2) "32"
|
||||
string(2) "33"
|
||||
string(2) "34"
|
||||
string(2) "35"
|
||||
string(2) "36"
|
||||
string(2) "37"
|
||||
string(2) "38"
|
||||
string(2) "39"
|
||||
string(2) "40"
|
||||
string(2) "41"
|
||||
string(2) "42"
|
||||
string(2) "43"
|
||||
string(2) "44"
|
||||
string(2) "45"
|
||||
string(2) "46"
|
||||
string(2) "47"
|
||||
string(2) "48"
|
||||
string(2) "49"
|
||||
string(2) "50"
|
||||
string(2) "51"
|
||||
string(2) "52"
|
||||
string(2) "53"
|
||||
string(2) "54"
|
||||
string(2) "55"
|
||||
string(2) "56"
|
||||
string(2) "57"
|
||||
string(2) "58"
|
||||
string(2) "59"
|
||||
string(2) "60"
|
||||
string(2) "61"
|
||||
string(2) "62"
|
||||
string(2) "63"
|
||||
string(2) "64"
|
||||
string(2) "65"
|
||||
string(2) "66"
|
||||
string(2) "67"
|
||||
string(2) "68"
|
||||
string(2) "69"
|
||||
string(2) "70"
|
||||
string(2) "71"
|
||||
string(2) "72"
|
||||
string(2) "73"
|
||||
string(2) "74"
|
||||
string(2) "75"
|
||||
string(2) "76"
|
||||
string(2) "77"
|
||||
string(2) "78"
|
||||
string(2) "79"
|
||||
string(2) "80"
|
||||
string(2) "81"
|
||||
string(2) "82"
|
||||
string(2) "83"
|
||||
string(2) "84"
|
||||
string(2) "85"
|
||||
string(2) "86"
|
||||
string(2) "87"
|
||||
string(2) "88"
|
||||
string(2) "89"
|
||||
string(2) "90"
|
||||
string(2) "91"
|
||||
string(2) "92"
|
||||
string(2) "93"
|
||||
string(2) "94"
|
||||
string(2) "95"
|
||||
string(2) "96"
|
||||
string(2) "97"
|
||||
string(2) "98"
|
||||
string(2) "99"
|
||||
string(3) "100"
|
||||
string(3) "101"
|
||||
string(3) "102"
|
||||
string(3) "103"
|
||||
string(3) "104"
|
||||
string(3) "105"
|
||||
string(3) "106"
|
||||
string(3) "107"
|
||||
string(3) "108"
|
||||
string(3) "109"
|
||||
string(3) "110"
|
||||
string(3) "111"
|
||||
string(3) "112"
|
||||
string(3) "113"
|
||||
string(3) "114"
|
||||
string(3) "115"
|
||||
string(3) "116"
|
||||
string(3) "117"
|
||||
string(3) "118"
|
||||
string(3) "119"
|
||||
string(3) "120"
|
||||
string(3) "121"
|
||||
string(3) "122"
|
||||
string(3) "123"
|
||||
string(3) "124"
|
||||
string(3) "125"
|
||||
string(3) "126"
|
||||
string(3) "127"
|
||||
string(3) "128"
|
||||
string(3) "129"
|
||||
string(3) "130"
|
||||
string(3) "131"
|
||||
string(3) "132"
|
||||
string(3) "133"
|
||||
string(3) "134"
|
||||
string(3) "135"
|
||||
string(3) "136"
|
||||
string(3) "137"
|
||||
string(3) "138"
|
||||
string(3) "139"
|
||||
string(3) "140"
|
||||
string(3) "141"
|
||||
string(3) "142"
|
||||
string(3) "143"
|
||||
string(3) "144"
|
||||
string(3) "145"
|
||||
string(3) "146"
|
||||
string(3) "147"
|
||||
string(3) "148"
|
||||
string(3) "149"
|
||||
string(3) "150"
|
||||
string(3) "151"
|
||||
string(3) "152"
|
||||
string(3) "153"
|
||||
string(3) "154"
|
||||
string(3) "155"
|
||||
string(3) "156"
|
||||
string(3) "157"
|
||||
string(3) "158"
|
||||
string(3) "159"
|
||||
string(3) "160"
|
||||
string(3) "161"
|
||||
string(3) "162"
|
||||
string(3) "163"
|
||||
string(3) "164"
|
||||
string(3) "165"
|
||||
string(3) "166"
|
||||
string(3) "167"
|
||||
string(3) "168"
|
||||
string(3) "169"
|
||||
string(3) "170"
|
||||
string(3) "171"
|
||||
string(3) "172"
|
||||
string(3) "173"
|
||||
string(3) "174"
|
||||
string(3) "175"
|
||||
string(3) "176"
|
||||
string(3) "177"
|
||||
string(3) "178"
|
||||
string(3) "179"
|
||||
string(3) "180"
|
||||
string(3) "181"
|
||||
string(3) "182"
|
||||
string(3) "183"
|
||||
string(3) "184"
|
||||
string(3) "185"
|
||||
string(3) "186"
|
||||
string(3) "187"
|
||||
string(3) "188"
|
||||
string(3) "189"
|
||||
string(3) "190"
|
||||
string(3) "191"
|
||||
string(3) "192"
|
||||
string(3) "193"
|
||||
string(3) "194"
|
||||
string(3) "195"
|
||||
string(3) "196"
|
||||
string(3) "197"
|
||||
string(3) "198"
|
||||
string(3) "199"
|
||||
Done
|
||||
@@ -1,252 +0,0 @@
|
||||
--TEST--
|
||||
Bug #27303 (OCIBindByName binds numeric PHP values as characters)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$create_st = array();
|
||||
$create_st[] = "drop sequence myseq";
|
||||
$create_st[] = "drop table mytab";
|
||||
$create_st[] = "create sequence myseq";
|
||||
$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
define('MYLIMIT', 200);
|
||||
define('INITMYBV', 11);
|
||||
|
||||
$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
|
||||
|
||||
$stid = OCIParse($c, $stmt);
|
||||
if (!$stid) { echo "Parse error"; die; }
|
||||
|
||||
$mybv = INITMYBV; // Uncomment this for the 2nd test only
|
||||
$r = OCIBindByName($stid, ':MYBV', $mybv, 5, SQLT_INT); // Uncomment this for the 3rd test only
|
||||
if (!$r) { echo "Bind error"; die; }
|
||||
|
||||
for ($i = 1; $i < MYLIMIT; $i++) {
|
||||
$r = OCIExecute($stid, OCI_DEFAULT);
|
||||
if (!$r) { echo "Execute error"; die; }
|
||||
var_dump($mybv);
|
||||
}
|
||||
|
||||
OCICommit($c);
|
||||
|
||||
$drop_st = array();
|
||||
$drop_st[] = "drop sequence myseq";
|
||||
$drop_st[] = "drop table mytab";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(1)
|
||||
int(2)
|
||||
int(3)
|
||||
int(4)
|
||||
int(5)
|
||||
int(6)
|
||||
int(7)
|
||||
int(8)
|
||||
int(9)
|
||||
int(10)
|
||||
int(11)
|
||||
int(12)
|
||||
int(13)
|
||||
int(14)
|
||||
int(15)
|
||||
int(16)
|
||||
int(17)
|
||||
int(18)
|
||||
int(19)
|
||||
int(20)
|
||||
int(21)
|
||||
int(22)
|
||||
int(23)
|
||||
int(24)
|
||||
int(25)
|
||||
int(26)
|
||||
int(27)
|
||||
int(28)
|
||||
int(29)
|
||||
int(30)
|
||||
int(31)
|
||||
int(32)
|
||||
int(33)
|
||||
int(34)
|
||||
int(35)
|
||||
int(36)
|
||||
int(37)
|
||||
int(38)
|
||||
int(39)
|
||||
int(40)
|
||||
int(41)
|
||||
int(42)
|
||||
int(43)
|
||||
int(44)
|
||||
int(45)
|
||||
int(46)
|
||||
int(47)
|
||||
int(48)
|
||||
int(49)
|
||||
int(50)
|
||||
int(51)
|
||||
int(52)
|
||||
int(53)
|
||||
int(54)
|
||||
int(55)
|
||||
int(56)
|
||||
int(57)
|
||||
int(58)
|
||||
int(59)
|
||||
int(60)
|
||||
int(61)
|
||||
int(62)
|
||||
int(63)
|
||||
int(64)
|
||||
int(65)
|
||||
int(66)
|
||||
int(67)
|
||||
int(68)
|
||||
int(69)
|
||||
int(70)
|
||||
int(71)
|
||||
int(72)
|
||||
int(73)
|
||||
int(74)
|
||||
int(75)
|
||||
int(76)
|
||||
int(77)
|
||||
int(78)
|
||||
int(79)
|
||||
int(80)
|
||||
int(81)
|
||||
int(82)
|
||||
int(83)
|
||||
int(84)
|
||||
int(85)
|
||||
int(86)
|
||||
int(87)
|
||||
int(88)
|
||||
int(89)
|
||||
int(90)
|
||||
int(91)
|
||||
int(92)
|
||||
int(93)
|
||||
int(94)
|
||||
int(95)
|
||||
int(96)
|
||||
int(97)
|
||||
int(98)
|
||||
int(99)
|
||||
int(100)
|
||||
int(101)
|
||||
int(102)
|
||||
int(103)
|
||||
int(104)
|
||||
int(105)
|
||||
int(106)
|
||||
int(107)
|
||||
int(108)
|
||||
int(109)
|
||||
int(110)
|
||||
int(111)
|
||||
int(112)
|
||||
int(113)
|
||||
int(114)
|
||||
int(115)
|
||||
int(116)
|
||||
int(117)
|
||||
int(118)
|
||||
int(119)
|
||||
int(120)
|
||||
int(121)
|
||||
int(122)
|
||||
int(123)
|
||||
int(124)
|
||||
int(125)
|
||||
int(126)
|
||||
int(127)
|
||||
int(128)
|
||||
int(129)
|
||||
int(130)
|
||||
int(131)
|
||||
int(132)
|
||||
int(133)
|
||||
int(134)
|
||||
int(135)
|
||||
int(136)
|
||||
int(137)
|
||||
int(138)
|
||||
int(139)
|
||||
int(140)
|
||||
int(141)
|
||||
int(142)
|
||||
int(143)
|
||||
int(144)
|
||||
int(145)
|
||||
int(146)
|
||||
int(147)
|
||||
int(148)
|
||||
int(149)
|
||||
int(150)
|
||||
int(151)
|
||||
int(152)
|
||||
int(153)
|
||||
int(154)
|
||||
int(155)
|
||||
int(156)
|
||||
int(157)
|
||||
int(158)
|
||||
int(159)
|
||||
int(160)
|
||||
int(161)
|
||||
int(162)
|
||||
int(163)
|
||||
int(164)
|
||||
int(165)
|
||||
int(166)
|
||||
int(167)
|
||||
int(168)
|
||||
int(169)
|
||||
int(170)
|
||||
int(171)
|
||||
int(172)
|
||||
int(173)
|
||||
int(174)
|
||||
int(175)
|
||||
int(176)
|
||||
int(177)
|
||||
int(178)
|
||||
int(179)
|
||||
int(180)
|
||||
int(181)
|
||||
int(182)
|
||||
int(183)
|
||||
int(184)
|
||||
int(185)
|
||||
int(186)
|
||||
int(187)
|
||||
int(188)
|
||||
int(189)
|
||||
int(190)
|
||||
int(191)
|
||||
int(192)
|
||||
int(193)
|
||||
int(194)
|
||||
int(195)
|
||||
int(196)
|
||||
int(197)
|
||||
int(198)
|
||||
int(199)
|
||||
Done
|
||||
@@ -1,252 +0,0 @@
|
||||
--TEST--
|
||||
Bug #27303 (OCIBindByName binds numeric PHP values as characters)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$create_st = array();
|
||||
$create_st[] = "drop sequence myseq";
|
||||
$create_st[] = "drop table mytab";
|
||||
$create_st[] = "create sequence myseq";
|
||||
$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
define('MYLIMIT', 200);
|
||||
define('INITMYBV', 11);
|
||||
|
||||
$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
|
||||
|
||||
$stid = OCIParse($c, $stmt);
|
||||
if (!$stid) { echo "Parse error"; die; }
|
||||
|
||||
//$mybv = INITMYBV; // Uncomment this for the 2nd test only
|
||||
$r = OCIBindByName($stid, ':MYBV', $mybv, 0 ); // Uncomment this for the 3rd test only
|
||||
if (!$r) { echo "Bind error"; die; }
|
||||
|
||||
for ($i = 1; $i < MYLIMIT; $i++) {
|
||||
$r = OCIExecute($stid, OCI_DEFAULT);
|
||||
if (!$r) { echo "Execute error"; die; }
|
||||
var_dump($mybv);
|
||||
}
|
||||
|
||||
OCICommit($c);
|
||||
|
||||
$drop_st = array();
|
||||
$drop_st[] = "drop sequence myseq";
|
||||
$drop_st[] = "drop table mytab";
|
||||
|
||||
foreach ($create_st as $statement) {
|
||||
$stmt = oci_parse($c, $statement);
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
string(1) "4"
|
||||
string(1) "5"
|
||||
string(1) "6"
|
||||
string(1) "7"
|
||||
string(1) "8"
|
||||
string(1) "9"
|
||||
string(2) "10"
|
||||
string(2) "11"
|
||||
string(2) "12"
|
||||
string(2) "13"
|
||||
string(2) "14"
|
||||
string(2) "15"
|
||||
string(2) "16"
|
||||
string(2) "17"
|
||||
string(2) "18"
|
||||
string(2) "19"
|
||||
string(2) "20"
|
||||
string(2) "21"
|
||||
string(2) "22"
|
||||
string(2) "23"
|
||||
string(2) "24"
|
||||
string(2) "25"
|
||||
string(2) "26"
|
||||
string(2) "27"
|
||||
string(2) "28"
|
||||
string(2) "29"
|
||||
string(2) "30"
|
||||
string(2) "31"
|
||||
string(2) "32"
|
||||
string(2) "33"
|
||||
string(2) "34"
|
||||
string(2) "35"
|
||||
string(2) "36"
|
||||
string(2) "37"
|
||||
string(2) "38"
|
||||
string(2) "39"
|
||||
string(2) "40"
|
||||
string(2) "41"
|
||||
string(2) "42"
|
||||
string(2) "43"
|
||||
string(2) "44"
|
||||
string(2) "45"
|
||||
string(2) "46"
|
||||
string(2) "47"
|
||||
string(2) "48"
|
||||
string(2) "49"
|
||||
string(2) "50"
|
||||
string(2) "51"
|
||||
string(2) "52"
|
||||
string(2) "53"
|
||||
string(2) "54"
|
||||
string(2) "55"
|
||||
string(2) "56"
|
||||
string(2) "57"
|
||||
string(2) "58"
|
||||
string(2) "59"
|
||||
string(2) "60"
|
||||
string(2) "61"
|
||||
string(2) "62"
|
||||
string(2) "63"
|
||||
string(2) "64"
|
||||
string(2) "65"
|
||||
string(2) "66"
|
||||
string(2) "67"
|
||||
string(2) "68"
|
||||
string(2) "69"
|
||||
string(2) "70"
|
||||
string(2) "71"
|
||||
string(2) "72"
|
||||
string(2) "73"
|
||||
string(2) "74"
|
||||
string(2) "75"
|
||||
string(2) "76"
|
||||
string(2) "77"
|
||||
string(2) "78"
|
||||
string(2) "79"
|
||||
string(2) "80"
|
||||
string(2) "81"
|
||||
string(2) "82"
|
||||
string(2) "83"
|
||||
string(2) "84"
|
||||
string(2) "85"
|
||||
string(2) "86"
|
||||
string(2) "87"
|
||||
string(2) "88"
|
||||
string(2) "89"
|
||||
string(2) "90"
|
||||
string(2) "91"
|
||||
string(2) "92"
|
||||
string(2) "93"
|
||||
string(2) "94"
|
||||
string(2) "95"
|
||||
string(2) "96"
|
||||
string(2) "97"
|
||||
string(2) "98"
|
||||
string(2) "99"
|
||||
string(3) "100"
|
||||
string(3) "101"
|
||||
string(3) "102"
|
||||
string(3) "103"
|
||||
string(3) "104"
|
||||
string(3) "105"
|
||||
string(3) "106"
|
||||
string(3) "107"
|
||||
string(3) "108"
|
||||
string(3) "109"
|
||||
string(3) "110"
|
||||
string(3) "111"
|
||||
string(3) "112"
|
||||
string(3) "113"
|
||||
string(3) "114"
|
||||
string(3) "115"
|
||||
string(3) "116"
|
||||
string(3) "117"
|
||||
string(3) "118"
|
||||
string(3) "119"
|
||||
string(3) "120"
|
||||
string(3) "121"
|
||||
string(3) "122"
|
||||
string(3) "123"
|
||||
string(3) "124"
|
||||
string(3) "125"
|
||||
string(3) "126"
|
||||
string(3) "127"
|
||||
string(3) "128"
|
||||
string(3) "129"
|
||||
string(3) "130"
|
||||
string(3) "131"
|
||||
string(3) "132"
|
||||
string(3) "133"
|
||||
string(3) "134"
|
||||
string(3) "135"
|
||||
string(3) "136"
|
||||
string(3) "137"
|
||||
string(3) "138"
|
||||
string(3) "139"
|
||||
string(3) "140"
|
||||
string(3) "141"
|
||||
string(3) "142"
|
||||
string(3) "143"
|
||||
string(3) "144"
|
||||
string(3) "145"
|
||||
string(3) "146"
|
||||
string(3) "147"
|
||||
string(3) "148"
|
||||
string(3) "149"
|
||||
string(3) "150"
|
||||
string(3) "151"
|
||||
string(3) "152"
|
||||
string(3) "153"
|
||||
string(3) "154"
|
||||
string(3) "155"
|
||||
string(3) "156"
|
||||
string(3) "157"
|
||||
string(3) "158"
|
||||
string(3) "159"
|
||||
string(3) "160"
|
||||
string(3) "161"
|
||||
string(3) "162"
|
||||
string(3) "163"
|
||||
string(3) "164"
|
||||
string(3) "165"
|
||||
string(3) "166"
|
||||
string(3) "167"
|
||||
string(3) "168"
|
||||
string(3) "169"
|
||||
string(3) "170"
|
||||
string(3) "171"
|
||||
string(3) "172"
|
||||
string(3) "173"
|
||||
string(3) "174"
|
||||
string(3) "175"
|
||||
string(3) "176"
|
||||
string(3) "177"
|
||||
string(3) "178"
|
||||
string(3) "179"
|
||||
string(3) "180"
|
||||
string(3) "181"
|
||||
string(3) "182"
|
||||
string(3) "183"
|
||||
string(3) "184"
|
||||
string(3) "185"
|
||||
string(3) "186"
|
||||
string(3) "187"
|
||||
string(3) "188"
|
||||
string(3) "189"
|
||||
string(3) "190"
|
||||
string(3) "191"
|
||||
string(3) "192"
|
||||
string(3) "193"
|
||||
string(3) "194"
|
||||
string(3) "195"
|
||||
string(3) "196"
|
||||
string(3) "197"
|
||||
string(3) "198"
|
||||
string(3) "199"
|
||||
Done
|
||||
@@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Bug #32325 (Can't retrieve collection using OCI8)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$create_stmt = oci_parse($c, "create or replace type ut_num_list_t as table of number");
|
||||
oci_execute($create_stmt);
|
||||
|
||||
$collection = oci_new_collection($c, "UT_NUM_LIST_T");
|
||||
|
||||
$sql = "
|
||||
begin
|
||||
select ut_num_list_t(1,2,3,4) into :list from dual;
|
||||
end;";
|
||||
|
||||
$stmt = oci_parse($c, $sql);
|
||||
|
||||
oci_bind_by_name($stmt, ":list", $collection, -1, OCI_B_NTY);
|
||||
oci_execute($stmt);
|
||||
|
||||
var_dump($collection->size());
|
||||
var_dump($collection->getelem(1));
|
||||
var_dump($collection->getelem(2));
|
||||
|
||||
$drop_stmt = oci_parse($c, "drop type ut_num_list_t");
|
||||
oci_execute($drop_stmt);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(4)
|
||||
float(2)
|
||||
float(3)
|
||||
Done
|
||||
@@ -1,43 +0,0 @@
|
||||
--TEST--
|
||||
Bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("oci8")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$s1 = oci_parse($c, "drop table test_nclob");
|
||||
@oci_execute($s1);
|
||||
|
||||
$s2 = oci_parse($c, "create table test_nclob (nc NCLOB)");
|
||||
oci_execute($s2);
|
||||
|
||||
$s3 = oci_parse($c, "insert into test_nclob (nc) values ('12345data')");
|
||||
oci_execute($s3);
|
||||
|
||||
$s3 = oci_parse($c, "select * from test_nclob");
|
||||
oci_execute($s3);
|
||||
|
||||
var_dump($data = oci_fetch_assoc($s3));
|
||||
$d = $data['NC'];
|
||||
|
||||
var_dump($d->read(5));
|
||||
var_dump($d->read(4));
|
||||
|
||||
$s1 = oci_parse($c, "drop table test_nclob");
|
||||
@oci_execute($s1);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
["NC"]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
}
|
||||
string(%d) "%s5"
|
||||
string(%d) "%sa"
|
||||
Done
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Bug #36010 (Crash when executing SQL statment with lob parameter twice)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
function f($conn)
|
||||
{
|
||||
$sql = "begin :p_clob := 'lob string'; end;";
|
||||
$stid = oci_parse($conn, $sql);
|
||||
$clob = oci_new_descriptor($conn, OCI_D_LOB);
|
||||
oci_bind_by_name($stid, ":p_clob", $clob, -1, OCI_B_CLOB);
|
||||
$r = oci_execute($stid, OCI_DEFAULT);
|
||||
}
|
||||
|
||||
f($c);
|
||||
f($c);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Done
|
||||
@@ -1,28 +0,0 @@
|
||||
--TEST--
|
||||
Bug #36096 (oci_result() returns garbage after oci_fetch() failed)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$sql = "SELECT 'ABC' FROM DUAL WHERE 1<>1";
|
||||
$stmt = oci_parse($c, $sql);
|
||||
|
||||
if(oci_execute($stmt, OCI_COMMIT_ON_SUCCESS)){
|
||||
var_dump(oci_fetch($stmt));
|
||||
var_dump(oci_result($stmt, 1));
|
||||
var_dump(oci_field_name($stmt, 1));
|
||||
var_dump(oci_field_type($stmt, 1));
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(5) "'ABC'"
|
||||
string(4) "CHAR"
|
||||
Done
|
||||
@@ -1,68 +0,0 @@
|
||||
--TEST--
|
||||
Bug #37220 (LOB Type mismatch when using windows & oci8.dll)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("oci8")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"create table bug37220_tab( mycolumn xmltype not null)",
|
||||
"insert into bug37220_tab values(xmltype('<THETAG myID=\"1234\"></THETAG>'))"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// 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 $item."\n";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"drop table bug37220_tab"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
<MYTAG/>
|
||||
|
||||
Done
|
||||
@@ -1,69 +0,0 @@
|
||||
--TEST--
|
||||
Bug #37581 (oci_bind_array_by_name clobbers input array when using SQLT_AFC, AVC)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("oci8")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$p1 = "create or replace package ARRAYBINDPKG1 as
|
||||
type str_array is table of char(2) index by binary_integer;
|
||||
procedure array_bind(in_str in str_array, out_str out string);
|
||||
end ARRAYBINDPKG1;";
|
||||
|
||||
$p2 = "create or replace package body ARRAYBINDPKG1 as
|
||||
procedure array_bind(in_str in str_array, out_str out string) is
|
||||
begin
|
||||
for i in 1 .. in_str.count loop
|
||||
out_str := in_str(i);
|
||||
end loop;
|
||||
end array_bind;
|
||||
end ARRAYBINDPKG1;";
|
||||
|
||||
$s1 = oci_parse($c, $p1);
|
||||
$s2 = oci_parse($c, $p2);
|
||||
oci_execute($s1);
|
||||
oci_execute($s2);
|
||||
|
||||
|
||||
$stmt = oci_parse($c,'begin ARRAYBINDPKG1.array_bind(:in_arr, :out_str); end;');
|
||||
$strings = array('A','B','C','D','E');
|
||||
|
||||
oci_bind_array_by_name($stmt,':in_arr',$strings,5,1,SQLT_AFC);
|
||||
oci_bind_by_name($stmt,':out_str',$result,10);
|
||||
|
||||
oci_execute($stmt);
|
||||
var_dump($strings);
|
||||
|
||||
oci_execute($stmt);
|
||||
var_dump($strings);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "A"
|
||||
[1]=>
|
||||
string(1) "B"
|
||||
[2]=>
|
||||
string(1) "C"
|
||||
[3]=>
|
||||
string(1) "D"
|
||||
[4]=>
|
||||
string(1) "E"
|
||||
}
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "A"
|
||||
[1]=>
|
||||
string(1) "B"
|
||||
[2]=>
|
||||
string(1) "C"
|
||||
[3]=>
|
||||
string(1) "D"
|
||||
[4]=>
|
||||
string(1) "E"
|
||||
}
|
||||
Done
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("oci8")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$query = "begin if false then :bv := 1; end if; end;";
|
||||
$stid = oci_parse($c, $query);
|
||||
oci_bind_by_name($stid, ":bv", $bv, 22);
|
||||
oci_execute($stid, OCI_DEFAULT);
|
||||
|
||||
var_dump($bv);
|
||||
unset($bv);
|
||||
|
||||
$query = "begin if false then :bv := 1; end if; end;";
|
||||
$stid = oci_parse($c, $query);
|
||||
oci_bind_by_name($stid, ":bv", $bv, 22, SQLT_INT);
|
||||
oci_execute($stid, OCI_DEFAULT);
|
||||
|
||||
var_dump($bv);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
int(0)
|
||||
Done
|
||||
@@ -1,79 +0,0 @@
|
||||
--TEST--
|
||||
Bug #38173 (Freeing nested cursors causes OCI8 to segfault)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$create_1 = "CREATE TABLE t1 (id INTEGER)";
|
||||
$create_2 = "CREATE TABLE t2 (id INTEGER)";
|
||||
$drop_1 = "DROP TABLE t1";
|
||||
$drop_2 = "DROP TABLE t2";
|
||||
|
||||
$s1 = oci_parse($c, $drop_1);
|
||||
$s2 = oci_parse($c, $drop_2);
|
||||
@oci_execute($s1);
|
||||
@oci_execute($s2);
|
||||
|
||||
$s1 = oci_parse($c, $create_1);
|
||||
$s2 = oci_parse($c, $create_2);
|
||||
oci_execute($s1);
|
||||
oci_execute($s2);
|
||||
|
||||
for($i=0; $i < 5; $i++) {
|
||||
$insert = "INSERT INTO t1 VALUES(".$i.")";
|
||||
$s = oci_parse($c, $insert);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
for($i=0; $i < 5; $i++) {
|
||||
$insert = "INSERT INTO t2 VALUES(".$i.")";
|
||||
$s = oci_parse($c, $insert);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
$query ="
|
||||
SELECT
|
||||
t1.*,
|
||||
CURSOR( SELECT * FROM t2 ) as cursor
|
||||
FROM
|
||||
t1
|
||||
";
|
||||
|
||||
$sth = oci_parse($c, $query);
|
||||
oci_execute($sth);
|
||||
|
||||
// dies on oci_free_statement on 2nd pass through loop
|
||||
while ( $row = oci_fetch_assoc($sth) ) {
|
||||
print "Got row!\n";
|
||||
var_dump(oci_execute($row['CURSOR']));
|
||||
var_dump(oci_free_statement($row['CURSOR']));
|
||||
}
|
||||
|
||||
$s1 = oci_parse($c, $drop_1);
|
||||
$s2 = oci_parse($c, $drop_2);
|
||||
@oci_execute($s1);
|
||||
@oci_execute($s2);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Got row!
|
||||
bool(true)
|
||||
bool(true)
|
||||
Got row!
|
||||
bool(true)
|
||||
bool(true)
|
||||
Got row!
|
||||
bool(true)
|
||||
bool(true)
|
||||
Got row!
|
||||
bool(true)
|
||||
bool(true)
|
||||
Got row!
|
||||
bool(true)
|
||||
bool(true)
|
||||
Done
|
||||
@@ -1,55 +0,0 @@
|
||||
--TEST--
|
||||
Bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name())
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$create_pkg = "
|
||||
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
|
||||
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
|
||||
PROCEDURE nullbind(c1 OUT ARRTYPE);
|
||||
END ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg);
|
||||
oci_execute($statement);
|
||||
|
||||
$create_pkg_body = "
|
||||
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 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 ARRAYBINDPKG1;";
|
||||
$statement = oci_parse($c, $create_pkg_body);
|
||||
oci_execute($statement);
|
||||
|
||||
$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.nullbind(:c1); END;");
|
||||
|
||||
oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR);
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(3) "one"
|
||||
[1]=>
|
||||
string(3) "two"
|
||||
[2]=>
|
||||
string(0) ""
|
||||
[3]=>
|
||||
string(4) "four"
|
||||
[4]=>
|
||||
string(4) "five"
|
||||
}
|
||||
Done
|
||||
@@ -1,200 +0,0 @@
|
||||
--TEST--
|
||||
Bug #40415 (Using oci_fetchall with nested cursors)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/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
|
||||
@@ -1,100 +0,0 @@
|
||||
--TEST--
|
||||
Bug #42134 (Collection error for invalid collection name)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/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
|
||||
@@ -1,168 +0,0 @@
|
||||
--TEST--
|
||||
Bug #42173 (TIMESTAMP and INTERVAL query and field functions)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/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
|
||||
@@ -1,61 +0,0 @@
|
||||
--TEST--
|
||||
Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP table bug42496_tab",
|
||||
"CREATE table bug42496_tab(c1 CLOB, c2 CLOB)",
|
||||
"INSERT INTO bug42496_tab VALUES('test1', 'test1')",
|
||||
"INSERT INTO bug42496_tab VALUES('test2', 'test2')",
|
||||
"INSERT INTO bug42496_tab VALUES('test3', 'test3')"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Run Test
|
||||
|
||||
echo "Test 1\n";
|
||||
|
||||
for ($i = 0; $i < 15000; $i++) {
|
||||
$s = oci_parse($c, "SELECT * from bug42496_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_tab"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test 1
|
||||
Done
|
||||
@@ -1,59 +0,0 @@
|
||||
--TEST--
|
||||
Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP table bug42496_tab",
|
||||
"CREATE table bug42496_tab(c1 CLOB, c2 CLOB)",
|
||||
"INSERT INTO bug42496_tab VALUES('test1', 'test1')",
|
||||
"INSERT INTO bug42496_tab VALUES('test2', 'test2')",
|
||||
"INSERT INTO bug42496_tab VALUES('test3', 'test3')"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Run Test
|
||||
|
||||
echo "Test 2\n";
|
||||
|
||||
for ($i = 0; $i < 15000; $i++) {
|
||||
$s = oci_parse($c, "SELECT * from bug42496_tab");
|
||||
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_tab"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test 2
|
||||
Done
|
||||
@@ -1,187 +0,0 @@
|
||||
--TEST--
|
||||
Bug #42841 (REF CURSOR and oci_new_cursor PHP crash)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--INI--
|
||||
oci8.statement_cache_size=20
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/details.inc';
|
||||
|
||||
// note a oci_new_connect() occurs lower in the script
|
||||
$c = oci_connect($user, $password, $dbase);
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"create or replace procedure bug42841_proc(out_1 out sys_refcursor) is
|
||||
begin
|
||||
open out_1 for select 11 from dual union all select 12 from dual union all select 13 from dual;
|
||||
end bug42841_proc;",
|
||||
|
||||
"create or replace package bug43449_pkg is
|
||||
type cursortype is ref Cursor;
|
||||
function testcursor return cursortype;
|
||||
end bug43449_pkg;",
|
||||
|
||||
"create or replace package body bug43449_pkg is
|
||||
function testcursor return cursortype is
|
||||
retCursor cursorType;
|
||||
begin
|
||||
Open retCursor For 'select * from dual';
|
||||
return retCursor;
|
||||
end;
|
||||
end bug43449_pkg;"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Main code
|
||||
|
||||
function do_bug42841($c)
|
||||
{
|
||||
echo "First attempt\n";
|
||||
|
||||
$sql = "BEGIN bug42841_proc(:cursor); END;";
|
||||
$stmt = oci_parse($c, $sql);
|
||||
$cursor = oci_new_cursor($c);
|
||||
oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
|
||||
|
||||
oci_execute($stmt, OCI_DEFAULT);
|
||||
oci_execute($cursor);
|
||||
|
||||
while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
|
||||
$data1[] = $row;
|
||||
}
|
||||
|
||||
oci_free_statement($stmt);
|
||||
oci_free_statement($cursor);
|
||||
var_dump($data1);
|
||||
|
||||
echo "Second attempt\n";
|
||||
|
||||
$sql = "BEGIN bug42841_proc(:cursor); END;";
|
||||
$stmt = oci_parse($c, $sql);
|
||||
$cursor = oci_new_cursor($c);
|
||||
oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
|
||||
|
||||
oci_execute($stmt, OCI_DEFAULT);
|
||||
oci_execute($cursor);
|
||||
|
||||
while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
|
||||
$data2[] = $row;
|
||||
}
|
||||
|
||||
oci_free_statement($stmt);
|
||||
oci_free_statement($cursor);
|
||||
var_dump($data2);
|
||||
}
|
||||
|
||||
function do_bug43449($c)
|
||||
{
|
||||
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
var_dump(bug43449_getCur($c));
|
||||
}
|
||||
}
|
||||
|
||||
function bug43449_getCur($c)
|
||||
{
|
||||
$cur = oci_new_cursor($c);
|
||||
$stmt = oci_parse($c, 'begin :cur := bug43449_pkg.testcursor; end;');
|
||||
oci_bind_by_name($stmt, ':cur', $cur, -1, OCI_B_CURSOR);
|
||||
oci_execute($stmt, OCI_DEFAULT);
|
||||
oci_execute($cur, OCI_DEFAULT);
|
||||
|
||||
$ret = array();
|
||||
|
||||
while (ocifetchinto($cur, $row, OCI_ASSOC)) {
|
||||
$ret[] = $row;
|
||||
}
|
||||
|
||||
oci_free_statement($cur);
|
||||
oci_free_statement($stmt);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
echo "Test bug 42841: Procedure with OUT cursor parameter\n";
|
||||
do_bug42841($c);
|
||||
|
||||
$c = oci_new_connect($user, $password, $dbase);
|
||||
|
||||
echo "Test bug 43449: Cursor as function result\n";
|
||||
do_bug43449($c);
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"drop procedure bug42841_proc",
|
||||
"drop package bug43449_pkg"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Test bug 42841: Procedure with OUT cursor parameter
|
||||
First attempt
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[11]=>
|
||||
string(2) "11"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[11]=>
|
||||
string(2) "12"
|
||||
}
|
||||
[2]=>
|
||||
array(1) {
|
||||
[11]=>
|
||||
string(2) "13"
|
||||
}
|
||||
}
|
||||
Second attempt
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[11]=>
|
||||
string(2) "11"
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
[11]=>
|
||||
string(2) "12"
|
||||
}
|
||||
[2]=>
|
||||
array(1) {
|
||||
[11]=>
|
||||
string(2) "13"
|
||||
}
|
||||
}
|
||||
Test bug 43449: Cursor as function result
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["DUMMY"]=>
|
||||
string(1) "X"
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["DUMMY"]=>
|
||||
string(1) "X"
|
||||
}
|
||||
}
|
||||
Done
|
||||
@@ -1,378 +0,0 @@
|
||||
--TEST--
|
||||
Bug #43492 (Nested cursor leaks)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP table bug43492_tab",
|
||||
"CREATE TABLE bug43492_tab(col1 VARCHAR2(1))",
|
||||
"INSERT INTO bug43492_tab VALUES ('A')",
|
||||
"INSERT INTO bug43492_tab VALUES ('B')",
|
||||
"INSERT INTO bug43492_tab VALUES ('C')",
|
||||
"INSERT INTO bug43492_tab VALUES ('D')",
|
||||
"INSERT INTO bug43492_tab VALUES ('E')",
|
||||
"INSERT INTO bug43492_tab VALUES ('F')",
|
||||
"INSERT INTO bug43492_tab VALUES ('G')",
|
||||
"INSERT INTO bug43492_tab VALUES ('H')",
|
||||
"INSERT INTO bug43492_tab VALUES ('I')",
|
||||
"INSERT INTO bug43492_tab VALUES ('J')"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
While fetching data from a ref cursor, the parent statement needs to
|
||||
be around. Also when the parent statement goes out of scope, it is
|
||||
not automatically released which causes a cursor leak.
|
||||
|
||||
If either or both of the lines marked (*) are removed, then the script
|
||||
will fail with the error "ORA-01000: maximum open cursors exceeded".
|
||||
|
||||
*/
|
||||
|
||||
function fetch($c, $i) {
|
||||
global $s; // (*) Allow parent statement to be available when child is used
|
||||
$s = ociparse($c, 'select cursor(select * from bug43492_tab) c from bug43492_tab');
|
||||
ociexecute($s, OCI_DEFAULT);
|
||||
ocifetchinto($s, $result, OCI_ASSOC);
|
||||
ociexecute($result['C'], OCI_DEFAULT);
|
||||
return $result['C'];
|
||||
}
|
||||
|
||||
for($i = 0; $i < 300; $i++) {
|
||||
$cur = fetch($c, $i);
|
||||
for($j = 0; $j < 10; $j++) {
|
||||
ocifetchinto($cur, $row, OCI_NUM);
|
||||
echo "$row[0] ";
|
||||
}
|
||||
echo "\n";
|
||||
ocifreestatement($cur);
|
||||
ocifreestatement($s); // (*) Free the parent statement cleanly
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP table bug43492_tab"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
A B C D E F G H I J
|
||||
Done
|
||||
@@ -1,294 +0,0 @@
|
||||
--TEST--
|
||||
Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
function sessionid($c) // determines and returns current session ID
|
||||
{
|
||||
$query = "select sid from v\$session where audsid = userenv('sessionid')";
|
||||
|
||||
$stmt = oci_parse($c, $query);
|
||||
|
||||
if (oci_execute($stmt, OCI_DEFAULT)) {
|
||||
$row = oci_fetch($stmt);
|
||||
return oci_result($stmt, 1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function templobs($c, $sid) // returns number of temporary LOBs
|
||||
{
|
||||
$query = "select abstract_lobs from v\$temporary_lobs where sid = " . $sid;
|
||||
|
||||
$stmt = oci_parse($c, $query);
|
||||
|
||||
if (oci_execute($stmt, OCI_DEFAULT)) {
|
||||
$row = oci_fetch($stmt);
|
||||
$val = oci_result($stmt, 1);
|
||||
oci_free_statement($stmt);
|
||||
return $val;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// Read all XML data using explicit LOB locator
|
||||
function readxmltab_ex($c)
|
||||
{
|
||||
$stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
|
||||
|
||||
$cntchk = 0;
|
||||
if (oci_execute($stmt)) {
|
||||
while ($result = oci_fetch_array($stmt, OCI_NUM)) {
|
||||
$result[0]->free(); // cleanup properly
|
||||
++$cntchk;
|
||||
}
|
||||
}
|
||||
echo "Loop count check = $cntchk\n";
|
||||
}
|
||||
|
||||
// Read all XML data using explicit LOB locator but without freeing the temp lobs
|
||||
function readxmltab_ex_nofree($c)
|
||||
{
|
||||
$stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
|
||||
|
||||
$cntchk = 0;
|
||||
if (oci_execute($stmt)) {
|
||||
while ($result = oci_fetch_array($stmt, OCI_NUM)) {
|
||||
++$cntchk;
|
||||
}
|
||||
}
|
||||
echo "Loop count check = $cntchk\n";
|
||||
}
|
||||
|
||||
// Read all XML data using implicit LOB locator
|
||||
function readxmltab_im($c)
|
||||
{
|
||||
$stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
|
||||
|
||||
$cntchk = 0;
|
||||
if (oci_execute($stmt)) {
|
||||
while ($result = oci_fetch_array($stmt, OCI_NUM+OCI_RETURN_LOBS)) {
|
||||
++$cntchk;
|
||||
}
|
||||
}
|
||||
echo "Loop count check = $cntchk\n";
|
||||
}
|
||||
|
||||
function createxmltab($c) // create table w/ field of XML type
|
||||
{
|
||||
@dropxmltab($c);
|
||||
$stmt = oci_parse($c, "create table bug43497_tab (id number primary key, xml xmltype)");
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
function dropxmltab($c) // delete table
|
||||
{
|
||||
$stmt = oci_parse($c, "drop table bug43497_tab");
|
||||
oci_execute($stmt);
|
||||
}
|
||||
|
||||
|
||||
function fillxmltab($c)
|
||||
{
|
||||
for ($id = 1; $id <= 100; $id++) {
|
||||
|
||||
// create an XML element string with random data
|
||||
$s = "<data>";
|
||||
for ($j = 0; $j < 128; $j++) {
|
||||
$s .= rand();
|
||||
}
|
||||
$s .= "</data>\n";
|
||||
for ($j = 0; $j < 4; $j++) {
|
||||
$s .= $s;
|
||||
}
|
||||
$data = "<?xml version=\"1.0\"?><records>" . $s . "</records>";
|
||||
|
||||
// insert XML data into database
|
||||
|
||||
$stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))");
|
||||
oci_bind_by_name($stmt, ":id", $id);
|
||||
$clob = oci_new_descriptor($c, OCI_D_LOB);
|
||||
oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB);
|
||||
$clob->writetemporary($data);
|
||||
oci_execute($stmt);
|
||||
|
||||
$clob->close();
|
||||
$clob->free();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Initialize
|
||||
|
||||
createxmltab($c);
|
||||
fillxmltab($c);
|
||||
|
||||
// Run Test
|
||||
|
||||
$sid = sessionid($c);
|
||||
|
||||
echo "Explicit LOB use\n";
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
echo "\nRun = " . $i . "\n";
|
||||
echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
|
||||
readxmltab_ex($c);
|
||||
}
|
||||
|
||||
echo "\nImplicit LOB use\n";
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
echo "\nRun = " . $i . "\n";
|
||||
echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
|
||||
readxmltab_im($c);
|
||||
}
|
||||
|
||||
echo "\nExplicit LOB with no free (i.e. a temp lob leak)\n";
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
echo "\nRun = " . $i . "\n";
|
||||
echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
|
||||
readxmltab_ex_nofree($c);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Cleanup
|
||||
|
||||
dropxmltab($c);
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Explicit LOB use
|
||||
|
||||
Run = 1
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 2
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 3
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 4
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 5
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 6
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 7
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 8
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 9
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 10
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Implicit LOB use
|
||||
|
||||
Run = 1
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 2
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 3
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 4
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 5
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 6
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 7
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 8
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 9
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 10
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Explicit LOB with no free (i.e. a temp lob leak)
|
||||
|
||||
Run = 1
|
||||
Temporary LOBs = 0
|
||||
Loop count check = 100
|
||||
|
||||
Run = 2
|
||||
Temporary LOBs = 99
|
||||
Loop count check = 100
|
||||
|
||||
Run = 3
|
||||
Temporary LOBs = 198
|
||||
Loop count check = 100
|
||||
|
||||
Run = 4
|
||||
Temporary LOBs = 297
|
||||
Loop count check = 100
|
||||
|
||||
Run = 5
|
||||
Temporary LOBs = 396
|
||||
Loop count check = 100
|
||||
|
||||
Run = 6
|
||||
Temporary LOBs = 495
|
||||
Loop count check = 100
|
||||
|
||||
Run = 7
|
||||
Temporary LOBs = 594
|
||||
Loop count check = 100
|
||||
|
||||
Run = 8
|
||||
Temporary LOBs = 693
|
||||
Loop count check = 100
|
||||
|
||||
Run = 9
|
||||
Temporary LOBs = 792
|
||||
Loop count check = 100
|
||||
|
||||
Run = 10
|
||||
Temporary LOBs = 891
|
||||
Loop count check = 100
|
||||
Done
|
||||
@@ -1,53 +0,0 @@
|
||||
--TEST--
|
||||
Bug #44113 (New collection creation can fail with OCI-22303)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
// Initialization
|
||||
|
||||
$stmtarray = array(
|
||||
"create or replace type bug44113_list_t as table of number"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
}
|
||||
|
||||
// Run Test
|
||||
// The test can take some time to complete and can exceed PHP's test
|
||||
// timout limit on slow networks.
|
||||
|
||||
for ($x = 0; $x < 70000; $x++)
|
||||
{
|
||||
if (!($var = oci_new_collection($c, 'BUG44113_LIST_T'))) {
|
||||
print "Failed new collection creation on $x\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
print "Completed $x\n";
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"drop type bug44113_list_t"
|
||||
);
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
oci_execute($s);
|
||||
}
|
||||
|
||||
oci_close($c);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Completed 70000
|
||||
Done
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
connect/close/connect
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
oci_close($c);
|
||||
|
||||
oci_connect($user, $password, $dbase);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Done
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
oci_new_collection()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
var_dump(oci_new_collection($c, $type_name));
|
||||
var_dump(oci_new_collection($c, "NONEXISTENT"));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Collection)#%d (1) {
|
||||
["collection"]=>
|
||||
resource(%d) of type (oci8 collection)
|
||||
}
|
||||
|
||||
Warning: oci_new_collection(): OCI-22303: type ""."NONEXISTENT" not found in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
oci_new_collection() + free()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
var_dump($coll1 = oci_new_collection($c, $type_name));
|
||||
|
||||
var_dump($coll1->free());
|
||||
var_dump($coll1->size());
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Collection)#%d (1) {
|
||||
["collection"]=>
|
||||
resource(%d) of type (oci8 collection)
|
||||
}
|
||||
bool(true)
|
||||
|
||||
Warning: OCI-Collection::size(): %d is not a valid oci8 collection resource in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
oci_new_collection() + free()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
var_dump($coll1 = oci_new_collection($c, $type_name));
|
||||
|
||||
var_dump(oci_free_collection($coll1));
|
||||
var_dump(oci_collection_size($coll1));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Collection)#%d (1) {
|
||||
["collection"]=>
|
||||
resource(%d) of type (oci8 collection)
|
||||
}
|
||||
bool(true)
|
||||
|
||||
Warning: oci_collection_size(): %d is not a valid oci8 collection resource in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
collection methods
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
$coll1 = oci_new_collection($c, $type_name);
|
||||
|
||||
var_dump($coll1->size());
|
||||
var_dump($coll1->max());
|
||||
var_dump($coll1->trim(3));
|
||||
var_dump($coll1->append(1));
|
||||
var_dump($coll1->getElem(0));
|
||||
var_dump($coll1->assignElem(0,2));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(0)
|
||||
int(0)
|
||||
|
||||
Warning: OCI-Collection::trim(): OCI-22167: given trim size [3] must be less than or equal to [0] in %s on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
float(1)
|
||||
bool(true)
|
||||
Done
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
collection methods
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
$coll1 = oci_new_collection($c, $type_name);
|
||||
|
||||
var_dump(oci_collection_size($coll1));
|
||||
var_dump(oci_collection_max($coll1));
|
||||
var_dump(oci_collection_trim($coll1, 3));
|
||||
var_dump(oci_collection_append($coll1, 1));
|
||||
var_dump(oci_collection_element_get($coll1, 0));
|
||||
var_dump(oci_collection_element_assign($coll1, 0, 2));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(0)
|
||||
int(0)
|
||||
|
||||
Warning: oci_collection_trim(): OCI-22167: given trim size [3] must be less than or equal to [0] in %s on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
float(1)
|
||||
bool(true)
|
||||
Done
|
||||
@@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
oci_collection_assign()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
$coll1 = oci_new_collection($c, $type_name);
|
||||
$coll2 = oci_new_collection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append(1));
|
||||
|
||||
var_dump($coll2->assign($coll1));
|
||||
|
||||
var_dump($coll2->getElem(0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
float(1)
|
||||
Done
|
||||
@@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
oci_collection_assign()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
$coll1 = oci_new_collection($c, $type_name);
|
||||
$coll2 = oci_new_collection($c, $type_name);
|
||||
|
||||
var_dump(oci_collection_append($coll1, 1));
|
||||
|
||||
var_dump(oci_collection_assign($coll2, $coll1));
|
||||
|
||||
var_dump(oci_collection_element_get($coll2, 0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
float(1)
|
||||
Done
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
ocinewcollection()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
var_dump(ocinewcollection($c, $type_name));
|
||||
var_dump(ocinewcollection($c, "NONEXISTENT"));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Collection)#%d (1) {
|
||||
["collection"]=>
|
||||
resource(%d) of type (oci8 collection)
|
||||
}
|
||||
|
||||
Warning: ocinewcollection(): OCI-22303: type ""."NONEXISTENT" not found in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
ocinewcollection() + free()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
var_dump($coll1 = ocinewcollection($c, $type_name));
|
||||
|
||||
var_dump($coll1->free());
|
||||
var_dump($coll1->size());
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Collection)#%d (1) {
|
||||
["collection"]=>
|
||||
resource(%d) of type (oci8 collection)
|
||||
}
|
||||
bool(true)
|
||||
|
||||
Warning: OCI-Collection::size(): %d is not a valid oci8 collection resource in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
ocinewcollection() + free()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
var_dump($coll1 = ocinewcollection($c, $type_name));
|
||||
|
||||
var_dump(oci_free_collection($coll1));
|
||||
var_dump(oci_collection_size($coll1));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Collection)#%d (1) {
|
||||
["collection"]=>
|
||||
resource(%d) of type (oci8 collection)
|
||||
}
|
||||
bool(true)
|
||||
|
||||
Warning: oci_collection_size(): %d is not a valid oci8 collection resource in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
collection methods
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump($coll1->size());
|
||||
var_dump($coll1->max());
|
||||
var_dump($coll1->trim(3));
|
||||
var_dump($coll1->append(1));
|
||||
var_dump($coll1->getElem(0));
|
||||
var_dump($coll1->assignElem(0,2));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(0)
|
||||
int(0)
|
||||
|
||||
Warning: OCI-Collection::trim(): OCI-22167: given trim size [3] must be less than or equal to [0] in %s on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
float(1)
|
||||
bool(true)
|
||||
Done
|
||||
@@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
ocicollassign()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
$coll2 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append(1));
|
||||
|
||||
var_dump($coll2->assign($coll1));
|
||||
|
||||
var_dump($coll2->getElem(0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
float(1)
|
||||
Done
|
||||
@@ -1,42 +0,0 @@
|
||||
--TEST--
|
||||
collections and wrong dates
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
$coll2 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append("2005-07-28"));
|
||||
|
||||
var_dump($coll2->assign($coll1));
|
||||
|
||||
var_dump($coll2->getElem(0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: OCI-Collection::append(): OCI-01861: literal does not match format string in %s on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,42 +0,0 @@
|
||||
--TEST--
|
||||
collections and wrong dates
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
$coll2 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump(oci_collection_append($coll1, "2005-07-28"));
|
||||
|
||||
var_dump(oci_collection_assign($coll2, $coll1));
|
||||
|
||||
var_dump(oci_collection_element_get($coll2, 0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_collection_append(): OCI-01861: literal does not match format string in %s on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,41 +0,0 @@
|
||||
--TEST--
|
||||
collections and nulls
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
$coll2 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append(null));
|
||||
|
||||
var_dump($coll2->assign($coll1));
|
||||
|
||||
var_dump($coll2->getElem(0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
NULL
|
||||
Done
|
||||
@@ -1,41 +0,0 @@
|
||||
--TEST--
|
||||
collections and nulls
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
$coll2 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump(oci_collection_append($coll1, null));
|
||||
|
||||
var_dump(oci_collection_assign($coll2, $coll1));
|
||||
|
||||
var_dump(oci_collection_element_get($coll2, 0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
NULL
|
||||
Done
|
||||
@@ -1,43 +0,0 @@
|
||||
--TEST--
|
||||
collections and strings
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
$coll2 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append("string"));
|
||||
var_dump($coll1->append("string"));
|
||||
|
||||
var_dump($coll2->assign($coll1));
|
||||
|
||||
var_dump($coll2->getElem(0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(6) "string"
|
||||
Done
|
||||
@@ -1,43 +0,0 @@
|
||||
--TEST--
|
||||
collections and strings
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
$coll2 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump(oci_collection_append($coll1, "string"));
|
||||
var_dump(oci_collection_append($coll1, "string"));
|
||||
|
||||
var_dump(oci_collection_assign($coll2, $coll1));
|
||||
|
||||
var_dump(oci_collection_element_get($coll2, 0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(6) "string"
|
||||
Done
|
||||
@@ -1,41 +0,0 @@
|
||||
--TEST--
|
||||
collections and correct dates
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
$coll2 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append("28-JUL-05"));
|
||||
|
||||
var_dump($coll2->assign($coll1));
|
||||
|
||||
var_dump($coll2->getElem(0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(9) "28-JUL-05"
|
||||
Done
|
||||
@@ -1,41 +0,0 @@
|
||||
--TEST--
|
||||
collections and correct dates
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
$coll2 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump(oci_collection_append($coll1, "28-JUL-05"));
|
||||
|
||||
var_dump(oci_collection_assign($coll2, $coll1));
|
||||
|
||||
var_dump(oci_collection_element_get($coll2, 0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(9) "28-JUL-05"
|
||||
Done
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
collections and correct dates (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append("28-JUL-05"));
|
||||
var_dump($coll1->assignElem(0,"01-JAN-05"));
|
||||
var_dump($coll1->getElem(0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(9) "01-JAN-05"
|
||||
Done
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
collections and correct dates (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump(oci_collection_append($coll1, "28-JUL-05"));
|
||||
var_dump(oci_collection_element_assign($coll1, 0, "01-JAN-05"));
|
||||
var_dump(oci_collection_element_get($coll1, 0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(9) "01-JAN-05"
|
||||
Done
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
collections and strings (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append("striing"));
|
||||
var_dump($coll1->assignElem(0,"blah"));
|
||||
var_dump($coll1->getElem(0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(4) "blah"
|
||||
Done
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
collections and strings (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump(oci_collection_append($coll1, "striing"));
|
||||
var_dump(oci_collection_element_assign($coll1, 0,"blah"));
|
||||
var_dump(oci_collection_element_get($coll1, 0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(4) "blah"
|
||||
Done
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
collections and numbers (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append(1));
|
||||
var_dump($coll1->assignElem(0,2345));
|
||||
var_dump($coll1->getElem(0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
float(2345)
|
||||
Done
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
collections and numbers (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump(oci_collection_append($coll1, 1));
|
||||
var_dump(oci_collection_element_assign($coll1,0,2345));
|
||||
var_dump(oci_collection_element_get($coll1, 0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
float(2345)
|
||||
Done
|
||||
@@ -1,48 +0,0 @@
|
||||
--TEST--
|
||||
collections and negative/too big element indexes
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append(1));
|
||||
var_dump($coll1->assignElem(-1,2345));
|
||||
var_dump($coll1->assignElem(5000,2345));
|
||||
var_dump($coll1->getElem(-1));
|
||||
var_dump($coll1->getElem(-100));
|
||||
var_dump($coll1->getElem(500));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
||||
Warning: OCI-Collection::assignelem(): OCI-22165: given index [%d] must be in the range of %s to [0] in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: OCI-Collection::assignelem(): OCI-22165: given index [5000] must be in the range of %s to [0] in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,48 +0,0 @@
|
||||
--TEST--
|
||||
collections and negative/too big element indexes
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump(oci_collection_append($coll1, 1));
|
||||
var_dump(oci_collection_element_assign($coll1,-1,2345));
|
||||
var_dump(oci_collection_element_assign($coll1,5000,2345));
|
||||
var_dump(oci_collection_element_get($coll1, -1));
|
||||
var_dump(oci_collection_element_get($coll1, -100));
|
||||
var_dump(oci_collection_element_get($coll1, 500));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
||||
Warning: oci_collection_element_assign(): OCI-22165: given index [%d] must be in the range of%s0%sto [0] in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: oci_collection_element_assign(): OCI-22165: given index [5000] must be in the range of%s0%sto [0] in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
collections and nulls (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append("string"));
|
||||
var_dump($coll1->assignElem(0, null));
|
||||
var_dump($coll1->getElem(0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
NULL
|
||||
Done
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
collections and nulls (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
$coll1 = ocinewcollection($c, $type_name);
|
||||
|
||||
var_dump(oci_collection_append($coll1, "string"));
|
||||
var_dump(oci_collection_element_assign($coll1, 0, null));
|
||||
var_dump(oci_collection_element_get($coll1, 0));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
NULL
|
||||
Done
|
||||
@@ -1,93 +0,0 @@
|
||||
--TEST--
|
||||
Collection trim tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_type.inc";
|
||||
|
||||
$coll1 = oci_new_collection($c, $type_name);
|
||||
|
||||
echo "Test 1.\n";
|
||||
var_dump($coll1->trim());
|
||||
|
||||
echo "\nTest 2.\n";
|
||||
var_dump($coll1->trim(0));
|
||||
|
||||
echo "\nTest 3.\n";
|
||||
var_dump($coll1->append(1));
|
||||
var_dump($coll1->append(2));
|
||||
var_dump($coll1->append(3));
|
||||
var_dump($coll1->append(4));
|
||||
|
||||
var_dump($coll1->getElem(-1)); // check before the beginning
|
||||
var_dump($coll1->getElem(0));
|
||||
var_dump($coll1->getElem(1));
|
||||
var_dump($coll1->getElem(2));
|
||||
var_dump($coll1->getElem(3));
|
||||
var_dump($coll1->getElem(4)); // check past the end
|
||||
|
||||
echo "\nTest 4.\n";
|
||||
var_dump($coll1->trim(1));
|
||||
var_dump($coll1->getElem(2)); // this should be the last element
|
||||
var_dump($coll1->getElem(3)); // this element should have gone
|
||||
|
||||
echo "\nTest 5.\n";
|
||||
var_dump($coll1->trim(2));
|
||||
var_dump($coll1->getElem(0)); // this should be the last element
|
||||
var_dump($coll1->getElem(1)); // this element should have gone
|
||||
|
||||
echo "\nTest 6.\n";
|
||||
var_dump($coll1->trim(0));
|
||||
var_dump($coll1->getElem(0)); // this should still be the last element
|
||||
|
||||
echo "\nTest 7.\n";
|
||||
var_dump($coll1->trim(1));
|
||||
var_dump($coll1->getElem(0)); // this should have gone
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test 1.
|
||||
|
||||
Warning: OCI-Collection::trim() expects exactly 1 parameter, 0 given in %s on line 9
|
||||
NULL
|
||||
|
||||
Test 2.
|
||||
bool(true)
|
||||
|
||||
Test 3.
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(false)
|
||||
float(1)
|
||||
float(2)
|
||||
float(3)
|
||||
float(4)
|
||||
bool(false)
|
||||
|
||||
Test 4.
|
||||
bool(true)
|
||||
float(3)
|
||||
bool(false)
|
||||
|
||||
Test 5.
|
||||
bool(true)
|
||||
float(1)
|
||||
bool(false)
|
||||
|
||||
Test 6.
|
||||
bool(true)
|
||||
float(1)
|
||||
|
||||
Test 7.
|
||||
bool(true)
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,104 +0,0 @@
|
||||
--TEST--
|
||||
Test collection Oracle error handling collections and numbers (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
$ora_sql = "DROP TYPE ".$type_name;;
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
@oci_execute($statement);
|
||||
|
||||
|
||||
echo "Test 0\n";
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF BLOB";
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
oci_execute($statement);
|
||||
|
||||
$coll1 = oci_new_collection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append('a long string')); // invalid type for append
|
||||
var_dump($coll1->assignElem(1, 'a long string')); // invalid type for assignelem()
|
||||
var_dump($coll1->getElem(0));
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
echo "Test 1\n";
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
oci_execute($statement);
|
||||
|
||||
$coll1 = oci_new_collection($c, $type_name);
|
||||
|
||||
var_dump($coll1->assignElem(1, null)); // invalid location for null
|
||||
var_dump($coll1->getElem(0));
|
||||
|
||||
echo "Test 2\n";
|
||||
var_dump($coll1->assignElem(1, 1234)); // invalid location for number
|
||||
var_dump($coll1->getElem(0));
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
echo "Test 3\n";
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR2(1)";
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
oci_execute($statement);
|
||||
|
||||
$coll1 = oci_new_collection($c, $type_name);
|
||||
|
||||
var_dump($coll1->assignElem(1, 'abc')); // invalid location for string
|
||||
var_dump($coll1->getElem(0));
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
echo "Test 4\n";
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
oci_execute($statement);
|
||||
|
||||
$coll1 = oci_new_collection($c, $type_name);
|
||||
|
||||
var_dump($coll1->append(1)); // invalid date format
|
||||
var_dump($coll1->assignElem(1, '01-JAN-06')); // invalid location for date
|
||||
var_dump($coll1->getElem(0));
|
||||
|
||||
require dirname(__FILE__)."/drop_type.inc";
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test 0
|
||||
|
||||
Notice: OCI-Collection::append(): Unknown or unsupported type of element: 113 in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Notice: OCI-Collection::assignelem(): Unknown or unsupported type of element: 113 in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
Test 1
|
||||
|
||||
Warning: OCI-Collection::assignelem(): OCI-22165: given index [1] must be in the range of %s in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
Test 2
|
||||
|
||||
Warning: OCI-Collection::assignelem(): OCI-22165: given index [1] must be in the range of %s in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
Test 3
|
||||
|
||||
Warning: OCI-Collection::assignelem(): OCI-22165: given index [1] must be in the range of %s in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
Test 4
|
||||
|
||||
Warning: OCI-Collection::append(): OCI-01840: input value not long enough for date format in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: OCI-Collection::assignelem(): OCI-22165: given index [1] must be in the range of %s in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,148 +0,0 @@
|
||||
--TEST--
|
||||
oci_commit()/oci_rollback()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s, OCI_DEFAULT)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
var_dump(oci_rollback($c));
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema.$table_name."";
|
||||
|
||||
if (!($select = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
/* oci_fetch_all */
|
||||
if (!oci_execute($select)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
var_dump(oci_fetch_all($select, $all));
|
||||
var_dump($all);
|
||||
|
||||
/* ocifetchstatement */
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s, OCI_DEFAULT)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
var_dump(oci_commit($c));
|
||||
|
||||
/* oci_fetch_all */
|
||||
if (!oci_execute($select)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
var_dump(oci_fetch_all($select, $all));
|
||||
var_dump($all);
|
||||
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
int(0)
|
||||
array(5) {
|
||||
["ID"]=>
|
||||
array(0) {
|
||||
}
|
||||
["VALUE"]=>
|
||||
array(0) {
|
||||
}
|
||||
["BLOB"]=>
|
||||
array(0) {
|
||||
}
|
||||
["CLOB"]=>
|
||||
array(0) {
|
||||
}
|
||||
["STRING"]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(4)
|
||||
array(5) {
|
||||
["ID"]=>
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
string(1) "1"
|
||||
[3]=>
|
||||
string(1) "1"
|
||||
}
|
||||
["VALUE"]=>
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
string(1) "1"
|
||||
[3]=>
|
||||
string(1) "1"
|
||||
}
|
||||
["BLOB"]=>
|
||||
array(4) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
NULL
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
}
|
||||
["CLOB"]=>
|
||||
array(4) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
NULL
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
}
|
||||
["STRING"]=>
|
||||
array(4) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
NULL
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
}
|
||||
}
|
||||
Done
|
||||
@@ -1,146 +0,0 @@
|
||||
--TEST--
|
||||
ocicommit()/ocirollback()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = ociparse($c, $insert_sql))) {
|
||||
die("ociparse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!ociexecute($s, OCI_DEFAULT)) {
|
||||
die("ociexecute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
var_dump(ocirollback($c));
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema.$table_name."";
|
||||
|
||||
if (!($select = ociparse($c, $select_sql))) {
|
||||
die("ociparse(select) failed!\n");
|
||||
}
|
||||
|
||||
if (!oci_execute($select)) {
|
||||
die("ociexecute(select) failed!\n");
|
||||
}
|
||||
var_dump(ocifetchstatement($select, $all));
|
||||
var_dump($all);
|
||||
|
||||
/* ocifetchstatement */
|
||||
if (!ociexecute($s)) {
|
||||
die("ociexecute(select) failed!\n");
|
||||
}
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = ociparse($c, $insert_sql))) {
|
||||
die("ociparse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!ociexecute($s, OCI_DEFAULT)) {
|
||||
die("ociexecute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
var_dump(ocicommit($c));
|
||||
|
||||
if (!ociexecute($select)) {
|
||||
die("ociexecute(select) failed!\n");
|
||||
}
|
||||
var_dump(ocifetchstatement($select, $all));
|
||||
var_dump($all);
|
||||
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
int(0)
|
||||
array(5) {
|
||||
["ID"]=>
|
||||
array(0) {
|
||||
}
|
||||
["VALUE"]=>
|
||||
array(0) {
|
||||
}
|
||||
["BLOB"]=>
|
||||
array(0) {
|
||||
}
|
||||
["CLOB"]=>
|
||||
array(0) {
|
||||
}
|
||||
["STRING"]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
int(4)
|
||||
array(5) {
|
||||
["ID"]=>
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
string(1) "1"
|
||||
[3]=>
|
||||
string(1) "1"
|
||||
}
|
||||
["VALUE"]=>
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
string(1) "1"
|
||||
[3]=>
|
||||
string(1) "1"
|
||||
}
|
||||
["BLOB"]=>
|
||||
array(4) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
NULL
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
}
|
||||
["CLOB"]=>
|
||||
array(4) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
NULL
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
}
|
||||
["STRING"]=>
|
||||
array(4) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
NULL
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
}
|
||||
}
|
||||
Done
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
include "details.inc";
|
||||
|
||||
/*
|
||||
* You should have privileges to create tables in this schema
|
||||
*
|
||||
* */
|
||||
/*
|
||||
$schema = "system";
|
||||
*/
|
||||
|
||||
$table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
|
||||
$type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
|
||||
|
||||
if (!empty($dbase)) {
|
||||
$c = ocilogon($user,$password,$dbase);
|
||||
}
|
||||
else {
|
||||
$c = ocilogon($user,$password);
|
||||
}
|
||||
|
||||
if (!empty($schema)) {
|
||||
$schema = $schema.".";
|
||||
}
|
||||
else {
|
||||
$schema = '';
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
oci_connect()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
if (!empty($dbase)) {
|
||||
var_dump(oci_connect($user, $password, $dbase));
|
||||
}
|
||||
else {
|
||||
var_dump(oci_connect($user, $password));
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (oci8 connection)
|
||||
Done
|
||||
Loaded 100 of 496 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user