mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
upgrade bundled OCI8 to v.1.1
This commit is contained in:
parent
916ad6c8f7
commit
3756201e04
@ -1,2 +1,2 @@
|
||||
OCI8
|
||||
Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson, Maxim Maletsky, Harald Radi, Antony Dovgal
|
||||
Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson, Maxim Maletsky, Harald Radi, Antony Dovgal, Andi Gutmans, Wez Furlong
|
||||
|
61
ext/oci8/README
Normal file
61
ext/oci8/README
Normal file
@ -0,0 +1,61 @@
|
||||
Installing OCI8
|
||||
---------------
|
||||
|
||||
1. Common requirements.
|
||||
2. Installing as shared extension.
|
||||
3. Installing as statically compiled extension.
|
||||
4. Installing from PECL.
|
||||
|
||||
|
||||
1. Common requirements
|
||||
----------------------
|
||||
In case if you use Oracle Instant Client, you don't have to set ORACLE_HOME and
|
||||
most of the other environment variables to build PHP with OCI8 support.
|
||||
The only variables you may have to set are:
|
||||
LD_LIBRARY_PATH - it must include Instant Client libraries dir
|
||||
NLS_LANG - in case if you want to change the default encoding used during
|
||||
interaction with Oracle servers
|
||||
|
||||
If you use common Oracle Client installation that comes along with the Oracle
|
||||
server installation, you MUST set at least ORACLE_HOME environment variable
|
||||
and make it visible for your web-server BEFORE it starts. Most appropriate
|
||||
places to add ORACLE_HOME definition are:
|
||||
- /etc/profile
|
||||
- /etc/profile.local
|
||||
- /etc/profile.d
|
||||
and others.
|
||||
|
||||
2. Installing as shared extension
|
||||
---------------------------------
|
||||
To install OCI8 as shared extension (i.e. the one you should put into
|
||||
your php.ini) use the following configure lines to configure PHP:
|
||||
a) if you use common Oracle Client installation:
|
||||
./configure --with-oci8=shared,$ORACLE_HOME
|
||||
|
||||
b) with Oracle Instant Client:
|
||||
./configure --with-oci8=shared,instantclient,/path/to/instant/client/lib
|
||||
If you use rpm-based installation of Oracle Instant Client, your configure
|
||||
line will look like this:
|
||||
./configure --with-oci8=shared,instantclient,/usr/lib/oracle/<OIC version>/client/lib
|
||||
|
||||
Follow the usual building procedure after that and you'll get OCI8 shared
|
||||
extension (i.e. oci8.so). Add it into the php.ini file like this:
|
||||
extension=oci8.so
|
||||
and don't forget to specify the right extension_dir for PHP to be able
|
||||
to find shared extensions correctly.
|
||||
|
||||
3. Installing as statically compiled extension
|
||||
----------------------------------------------
|
||||
To install OCI8 as statically compiled module use the following configure lines:
|
||||
a) with common Oracle Client installation
|
||||
./configure --with-oci8=$ORACLE_HOME
|
||||
|
||||
b) with Oracle Instant Client
|
||||
./configure --with-oci8=instantclient,/path/to/instant/client/lib
|
||||
|
||||
After successful compile, you don't have to add oci8.so to the php.ini, the module will
|
||||
be usable without any additional actions.
|
||||
|
||||
4. Installing from PECL
|
||||
-----------------------
|
||||
TBD
|
@ -2,6 +2,12 @@ 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
|
||||
@ -19,7 +25,16 @@ AC_DEFUN([PHP_OCI_IF_DEFINED],[
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[
|
||||
PHP_CHECK_64BIT([ TMP_OCI8_LIB_DIR=lib32 ], [ TMP_OCI8_LIB_DIR=lib ])
|
||||
AC_CHECK_SIZEOF(long int, 4)
|
||||
AC_MSG_CHECKING([checking if we're at 64-bit platform])
|
||||
if test "$ac_cv_sizeof_long_int" = "4" ; then
|
||||
AC_MSG_RESULT([no])
|
||||
TMP_OCI8_LIB_DIR=lib32
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
TMP_OCI8_LIB_DIR=lib
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([OCI8 libraries dir])
|
||||
if test -d "$OCI8_DIR/lib" -a ! -d "$OCI8_DIR/lib32"; then
|
||||
OCI8_LIB_DIR=lib
|
||||
@ -54,7 +69,7 @@ AC_DEFUN([AC_OCI8IC_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 | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
|
||||
OCI8_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | $PHP_OCI_SED 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
|
||||
test -z "$OCI8_VERSION" && OCI8_VERSION=7.3
|
||||
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
|
||||
OCI8_VERSION=10.1
|
||||
@ -76,26 +91,33 @@ AC_DEFUN([AC_OCI8_VERSION],[
|
||||
AC_MSG_RESULT($OCI8_VERSION)
|
||||
])
|
||||
|
||||
PHP_ARG_WITH(oci8, for Oracle (OCI8) support using ORACLE_HOME installation,
|
||||
[ --with-oci8[=DIR] Include Oracle (OCI8) support using an ORACLE_HOME
|
||||
install. The default DIR is ORACLE_HOME])
|
||||
|
||||
if test "$PHP_OCI8" = "no"; then
|
||||
PHP_ARG_WITH(oci8-instant-client, for Oracle (OCI8) support using Oracle Instant Client,
|
||||
[ --with-oci8-instant-client[=DIR]
|
||||
Include Oracle (OCI8) support using
|
||||
Oracle Instant Client. DIR is the directory with the
|
||||
Instant Client libraries. On Linux it will default to
|
||||
/usr/lib/oracle/<most_recent_version>/client/lib
|
||||
Other platforms will need to have it explicitly specified])
|
||||
else
|
||||
PHP_OCI8_INSTANT_CLIENT="no";
|
||||
dnl --with-oci8=shared,instantclient,/path/to/client/dir/lib
|
||||
dnl or
|
||||
dnl --with-oci8=shared,/path/to/oracle/home
|
||||
PHP_ARG_WITH(oci8, for Oracle (OCI8) support,
|
||||
[ --with-oci8[=DIR] Include Oracle (OCI8) support.
|
||||
The default DIR is ORACLE_HOME.
|
||||
Use --with-oci8=instantclient,/path/to/oic/lib
|
||||
to use Oracle Instant Client installation])
|
||||
|
||||
PHP_OCI8_INSTANT_CLIENT="no"
|
||||
|
||||
if test "`echo $PHP_OCI8 | cut -d, -f2`" = "instantclient"; then
|
||||
PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f3`"
|
||||
PHP_OCI8="`echo $PHP_OCI8 | cut -d, -f1,4`"
|
||||
if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then
|
||||
PHP_OCI8_INSTANT_CLIENT="yes"
|
||||
fi
|
||||
elif test "`echo $PHP_OCI8 | cut -d, -f1`" = "instantclient"; then
|
||||
PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f2`"
|
||||
PHP_OCI8="`echo $PHP_OCI8 | cut -d, -f3,4`"
|
||||
if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then
|
||||
PHP_OCI8_INSTANT_CLIENT="yes"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$PHP_OCI8" != "no"; then
|
||||
if test "$PHP_OCI8_INSTANT_CLIENT" != "no"; then
|
||||
AC_MSG_ERROR([--with-oci8 and --with-oci8-instant-client are mutually exclusive])
|
||||
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
|
||||
@ -138,12 +160,40 @@ if test "$PHP_OCI8" != "no"; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(core4, "", OCI8_SHARED_LIBADD)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(psa, "", OCI8_SHARED_LIBADD)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(clntsh, $OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD)
|
||||
|
||||
PHP_CHECK_LIBRARY(clntsh, OCIEnvCreate,
|
||||
[
|
||||
AC_DEFINE(HAVE_OCI_ENV_CREATE,1,[ ])
|
||||
], [], [
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
|
||||
PHP_CHECK_LIBRARY(clntsh, OCIStmtPrepare2,
|
||||
[
|
||||
AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ])
|
||||
], [], [
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
;;
|
||||
|
||||
8.1)
|
||||
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
|
||||
PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD)
|
||||
|
||||
PHP_CHECK_LIBRARY(clntsh, OCIEnvCreate,
|
||||
[
|
||||
AC_DEFINE(HAVE_OCI_ENV_CREATE,1,[ ])
|
||||
], [], [
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
|
||||
PHP_CHECK_LIBRARY(clntsh, OCIStmtPrepare2,
|
||||
[
|
||||
AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ])
|
||||
], [], [
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl OCI_ATTR_STATEMENT is not available in all 8.1.x versions
|
||||
dnl
|
||||
@ -160,7 +210,7 @@ if test "$PHP_OCI8" != "no"; then
|
||||
[
|
||||
PHP_CHECK_LIBRARY(clntsh, OCINlsCharSetNameToId,
|
||||
[
|
||||
AC_DEFINE(HAVE_OCI_9_2,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI_ENV_NLS_CREATE,1,[ ])
|
||||
OCI8_VERSION=9.2
|
||||
], [], [
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
@ -168,13 +218,30 @@ if test "$PHP_OCI8" != "no"; then
|
||||
], [], [
|
||||
-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
|
||||
])
|
||||
|
||||
;;
|
||||
|
||||
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_9_2,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_OCI8_TEMP_LOB,1,[ ])
|
||||
AC_DEFINE(PHP_OCI8_HAVE_COLLECTIONS,1,[ ])
|
||||
;;
|
||||
@ -207,18 +274,22 @@ if test "$PHP_OCI8" != "no"; then
|
||||
PHP_CHECK_LIBRARY(clntsh, OCICollAssign,
|
||||
[
|
||||
AC_DEFINE(PHP_OCI8_HAVE_COLLECTIONS,1,[ ])
|
||||
], [], [
|
||||
PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared)
|
||||
],
|
||||
[
|
||||
PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_interface.c, $ext_shared)
|
||||
],
|
||||
[
|
||||
-L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD
|
||||
])
|
||||
|
||||
PHP_NEW_EXTENSION(oci8, oci8.c, $ext_shared)
|
||||
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_INSTANT_CLIENT" != "no"; then
|
||||
elif test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" != "no"; then
|
||||
|
||||
AC_MSG_CHECKING([Oracle Instant Client directory])
|
||||
if test "$PHP_OCI8_INSTANT_CLIENT" = "yes"; then
|
||||
@ -227,7 +298,7 @@ dnl directory to the libraries. But on Linux we default to the most recent
|
||||
dnl version in /usr/lib
|
||||
PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client/lib 2> /dev/null | tail -1`
|
||||
if test -z "$PHP_OCI8_INSTANT_CLIENT"; then
|
||||
AC_MSG_ERROR([Oracle Instant Client directory not found. Try --with-oci8-instant-client=DIR])
|
||||
AC_MSG_ERROR([Oracle Instant Client directory not found. Try --with-oci8=instantclient,DIR])
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT($PHP_OCI8_INSTANT_CLIENT)
|
||||
@ -237,11 +308,14 @@ dnl version in /usr/lib
|
||||
AC_MSG_CHECKING([Oracle Instant Client SDK header directory])
|
||||
|
||||
dnl Header directory for Instant Client SDK RPM install
|
||||
OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | sed -e 's!^/usr/lib/oracle/\(.*\)/client/lib[[/]]*$!/usr/include/oracle/\1/client!'`
|
||||
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)
|
||||
@ -250,11 +324,15 @@ dnl Header directory for Instant Client SDK zip file install
|
||||
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" | sed -e 's!\(.*\)/include$!\1/demo/sysliblist!'`
|
||||
OCISYSLIBLIST=`echo "$OCI8INCDIR" | $PHP_OCI_SED -e 's!\(.*\)/include$!\1/demo/sysliblist!'`
|
||||
if test -f "$OCISYSLIBLIST"; then
|
||||
PHP_EVAL_LIBLINE(`cat $OCISYSLIBLIST`, OCI8_SYSLIB)
|
||||
fi
|
||||
@ -271,13 +349,15 @@ dnl Header directory for Instant Client SDK zip file install
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_DEFINE(HAVE_OCI_INSTANT_CLIENT,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI_9_2,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_OCI8_TEMP_LOB,1,[ ])
|
||||
AC_DEFINE(PHP_OCI8_HAVE_COLLECTIONS,1,[ ])
|
||||
AC_DEFINE(HAVE_OCI_INSTANT_CLIENT,1,[ ])
|
||||
|
||||
PHP_NEW_EXTENSION(oci8, oci8.c, $ext_shared)
|
||||
PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared)
|
||||
AC_DEFINE(HAVE_OCI8,1,[ ])
|
||||
|
||||
PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
|
||||
|
@ -5,11 +5,11 @@ ARG_WITH("oci8", "OCI8 support", "no");
|
||||
|
||||
if (PHP_OCI8 != "no") {
|
||||
|
||||
if (CHECK_HEADER_ADD_INCLUDE("oci.h", "CFLAGS_OCI8", PHP_PHP_BUILD + "\\oci805\\include;" + PHP_OCI8) &&
|
||||
CHECK_LIB("oci.lib", "oci8", PHP_OCI8)
|
||||
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');
|
||||
EXTENSION('oci8', 'oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c');
|
||||
|
||||
AC_DEFINE('HAVE_OCI8_TEMP_LOB', 1);
|
||||
AC_DEFINE('HAVE_OCI8', 1);
|
||||
|
7570
ext/oci8/oci8.c
7570
ext/oci8/oci8.c
File diff suppressed because it is too large
Load Diff
@ -44,7 +44,7 @@ RSC=rc.exe
|
||||
# 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\oci805\include" /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 /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"
|
||||
@ -54,7 +54,7 @@ BSC32=bscmake.exe
|
||||
# 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 php5ts.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\oci805\lib" /libpath:"..\..\Release_TS_Inline"
|
||||
# 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"
|
||||
|
||||
@ -71,7 +71,7 @@ LINK32=link.exe
|
||||
# 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\oci805" /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 /FR /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"
|
||||
@ -81,7 +81,7 @@ BSC32=bscmake.exe
|
||||
# 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 php5ts_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\oci805"
|
||||
# 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
|
||||
|
||||
@ -96,6 +96,22 @@ LINK32=link.exe
|
||||
|
||||
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"
|
||||
|
||||
@ -104,6 +120,10 @@ SOURCE=.\oci8.c
|
||||
|
||||
SOURCE=.\php_oci8.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_oci8_int.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
|
611
ext/oci8/oci8_collection.c
Normal file
611
ext/oci8/oci8_collection.c
Normal file
@ -0,0 +1,611 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2005 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 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_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Stig Sæther Bakken <ssb@php.net> |
|
||||
| Thies C. Arntzen <thies@thieso.net> |
|
||||
| |
|
||||
| Collection support by Andy Sautins <asautins@veripost.net> |
|
||||
| Temporary LOB support by David Benson <dbenson@mancala.com> |
|
||||
| ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> |
|
||||
| |
|
||||
| Redesigned by: Antony Dovgal <antony@zend.com> |
|
||||
| Andi Gutmans <andi@zend.com> |
|
||||
| Wez Furlong <wez@omniti.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_ini.h"
|
||||
|
||||
#if HAVE_OCI8
|
||||
|
||||
#include "php_oci8.h"
|
||||
#include "php_oci8_int.h"
|
||||
|
||||
/* {{{ php_oci_collection_create()
|
||||
Create and return connection handle */
|
||||
php_oci_collection * php_oci_collection_create(php_oci_connection* connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC)
|
||||
{
|
||||
dvoid *dschp1;
|
||||
dvoid *parmp1;
|
||||
dvoid *parmp2;
|
||||
php_oci_collection *collection;
|
||||
|
||||
collection = emalloc(sizeof(php_oci_collection));
|
||||
|
||||
collection->connection = connection;
|
||||
collection->collection = NULL;
|
||||
|
||||
/* get type handle by name */
|
||||
connection->errcode = PHP_OCI_CALL(OCITypeByName, (connection->env, connection->err, connection->svc, (text *) schema, (ub4) schema_len, (text *) tdo, (ub4) tdo_len, (CONST text *) 0, (ub4) 0, OCI_DURATION_SESSION, OCI_TYPEGET_ALL, &(collection->tdo)));
|
||||
|
||||
if (connection->errcode) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* allocate describe handle */
|
||||
connection->errcode = PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0));
|
||||
|
||||
if (connection->errcode) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* describe TDO */
|
||||
connection->errcode = PHP_OCI_CALL(OCIDescribeAny, (connection->svc, connection->err, (dvoid *) collection->tdo, (ub4) 0, OCI_OTYPE_PTR, (ub1) OCI_DEFAULT, (ub1) OCI_PTYPE_TYPE, dschp1));
|
||||
|
||||
if (connection->errcode) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get first parameter handle */
|
||||
connection->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err));
|
||||
|
||||
if (connection->errcode) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get the collection type code of the attribute */
|
||||
connection->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid*) parmp1, (ub4) OCI_DTYPE_PARAM, (dvoid*) &(collection->coll_typecode), (ub4 *) 0, (ub4) OCI_ATTR_COLLECTION_TYPECODE, connection->err));
|
||||
|
||||
if (connection->errcode) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
switch(collection->coll_typecode) {
|
||||
case OCI_TYPECODE_TABLE:
|
||||
case OCI_TYPECODE_VARRAY:
|
||||
/* get collection element handle */
|
||||
connection->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid*) parmp1, (ub4) OCI_DTYPE_PARAM, (dvoid*) &parmp2, (ub4 *) 0, (ub4) OCI_ATTR_COLLECTION_ELEMENT, connection->err));
|
||||
|
||||
if (connection->errcode) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get REF of the TDO for the type */
|
||||
connection->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid*) parmp2, (ub4) OCI_DTYPE_PARAM, (dvoid*) &(collection->elem_ref), (ub4 *) 0, (ub4) OCI_ATTR_REF_TDO, connection->err));
|
||||
|
||||
if (connection->errcode) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get the TDO (only header) */
|
||||
connection->errcode = PHP_OCI_CALL(OCITypeByRef, (connection->env, connection->err, collection->elem_ref, OCI_DURATION_SESSION, OCI_TYPEGET_HEADER, &(collection->element_type)));
|
||||
|
||||
if (connection->errcode) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
/* get typecode */
|
||||
connection->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid*) parmp2, (ub4) OCI_DTYPE_PARAM, (dvoid*) &(collection->element_typecode), (ub4 *) 0, (ub4) OCI_ATTR_TYPECODE, connection->err));
|
||||
|
||||
if (connection->errcode) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
break;
|
||||
/* we only support VARRAYs and TABLEs */
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCINewCollection - Unknown Type %d", collection->coll_typecode);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Create object to hold return table */
|
||||
connection->errcode = PHP_OCI_CALL(OCIObjectNew,
|
||||
(
|
||||
connection->env,
|
||||
connection->err,
|
||||
connection->svc,
|
||||
OCI_TYPECODE_TABLE,
|
||||
collection->tdo,
|
||||
(dvoid *)0,
|
||||
OCI_DURATION_DEFAULT,
|
||||
TRUE,
|
||||
(dvoid **) &(collection->collection)
|
||||
)
|
||||
);
|
||||
|
||||
if (connection->errcode) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
PHP_OCI_REGISTER_RESOURCE(collection, le_collection);
|
||||
return collection;
|
||||
|
||||
CLEANUP:
|
||||
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
php_oci_collection_close(collection TSRMLS_CC);
|
||||
return NULL;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_size()
|
||||
Return size of the collection */
|
||||
int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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;
|
||||
|
||||
*max = PHP_OCI_CALL(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;
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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 */
|
||||
connection->errcode = PHP_OCI_CALL(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 */
|
||||
connection->errcode = PHP_OCI_CALL(OCIDateFromText, (connection->err, date, date_len, NULL, 0, NULL, 0, &oci_date));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
/* failed to convert string to date */
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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);
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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;
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(OCIStringAssignText, (connection->env, connection->err, element, element_len, &ocistr));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(OCICollAppend, (connection->env, connection->err, (dvoid *) ocistr, (dvoid *) &new_index, (OCIColl *) collection->collection));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_append()
|
||||
Append wrapper. Appends any supported element to the end of the collection */
|
||||
int php_oci_collection_append(php_oci_collection *collection, char *element, int element_len TSRMLS_DC)
|
||||
{
|
||||
if (element_len == 0) {
|
||||
return php_oci_collection_append_null(collection TSRMLS_CC);
|
||||
}
|
||||
|
||||
switch(collection->element_typecode) {
|
||||
case OCI_TYPECODE_DATE:
|
||||
return php_oci_collection_append_date(collection, element, element_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_VARCHAR2 :
|
||||
return php_oci_collection_append_string(collection, element, element_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
|
||||
case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
|
||||
case OCI_TYPECODE_REAL : /* REAL */
|
||||
case OCI_TYPECODE_DOUBLE : /* DOUBLE */
|
||||
case OCI_TYPECODE_INTEGER : /* INT */
|
||||
case OCI_TYPECODE_SIGNED16 : /* SHORT */
|
||||
case OCI_TYPECODE_SIGNED32 : /* LONG */
|
||||
case OCI_TYPECODE_DECIMAL : /* DECIMAL */
|
||||
case OCI_TYPECODE_FLOAT : /* FLOAT */
|
||||
case OCI_TYPECODE_NUMBER : /* NUMBER */
|
||||
case OCI_TYPECODE_SMALLINT : /* SMALLINT */
|
||||
return php_oci_collection_append_number(collection, element, element_len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown or unsupported type of element: %d", collection->element_typecode);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
/* never reached */
|
||||
return 1;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_collection_element_get()
|
||||
Get the element with the given index */
|
||||
int php_oci_collection_element_get(php_oci_collection *collection, long index, zval **result_element TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = collection->connection;
|
||||
dvoid *element;
|
||||
OCIInd *element_index;
|
||||
boolean exists;
|
||||
char buff[1024];
|
||||
int buff_len = 1024;
|
||||
|
||||
MAKE_STD_ZVAL(*result_element);
|
||||
ZVAL_NULL(*result_element);
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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:
|
||||
connection->errcode = PHP_OCI_CALL(OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
FREE_ZVAL(*result_element);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ZVAL_STRINGL(*result_element, buff, buff_len, 1);
|
||||
Z_STRVAL_P(*result_element)[buff_len] = '\0';
|
||||
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_VARCHAR2:
|
||||
{
|
||||
OCIString *oci_string = *(OCIString **)element;
|
||||
text *str;
|
||||
|
||||
str = (text *)PHP_OCI_CALL(OCIStringPtr, (connection->env, oci_string));
|
||||
|
||||
if (str) {
|
||||
ZVAL_STRING(*result_element, str, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case OCI_TYPECODE_UNSIGNED16: /* UNSIGNED SHORT */
|
||||
case OCI_TYPECODE_UNSIGNED32: /* UNSIGNED LONG */
|
||||
case OCI_TYPECODE_REAL: /* REAL */
|
||||
case OCI_TYPECODE_DOUBLE: /* DOUBLE */
|
||||
case OCI_TYPECODE_INTEGER: /* INT */
|
||||
case OCI_TYPECODE_SIGNED16: /* SHORT */
|
||||
case OCI_TYPECODE_SIGNED32: /* LONG */
|
||||
case OCI_TYPECODE_DECIMAL: /* DECIMAL */
|
||||
case OCI_TYPECODE_FLOAT: /* FLOAT */
|
||||
case OCI_TYPECODE_NUMBER: /* NUMBER */
|
||||
case OCI_TYPECODE_SMALLINT: /* SMALLINT */
|
||||
{
|
||||
double double_number;
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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 */
|
||||
connection->errcode = PHP_OCI_CALL(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 */
|
||||
connection->errcode = PHP_OCI_CALL(OCIDateFromText, (connection->err, date, date_len, NULL, 0, NULL, 0, &oci_date));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
/* failed to convert string to date */
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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);
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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;
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(OCIStringAssignText, (connection->env, connection->err, element, element_len, &ocistr));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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;
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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) {
|
||||
connection->errcode = PHP_OCI_CALL(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 */
|
2125
ext/oci8/oci8_interface.c
Normal file
2125
ext/oci8/oci8_interface.c
Normal file
File diff suppressed because it is too large
Load Diff
702
ext/oci8/oci8_lob.c
Normal file
702
ext/oci8/oci8_lob.c
Normal file
@ -0,0 +1,702 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2005 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 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_0.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 = emalloc(sizeof(php_oci_descriptor));
|
||||
descriptor->type = type;
|
||||
|
||||
OCI_G(errcode) = PHP_OCI_CALL(OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0));
|
||||
|
||||
if (OCI_G(errcode) != OCI_SUCCESS) {
|
||||
connection->errcode = php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
efree(descriptor);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
descriptor->connection = connection;
|
||||
|
||||
PHP_OCI_REGISTER_RESOURCE(descriptor, le_descriptor);
|
||||
|
||||
descriptor->lob_current_position = 0;
|
||||
descriptor->lob_size = -1; /* we should set it to -1 to know, that it's just not initialized */
|
||||
descriptor->buffering = PHP_OCI_LOB_BUFFER_DISABLED; /* buffering is off by default */
|
||||
|
||||
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, 13, 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) {
|
||||
connection->errcode = PHP_OCI_CALL(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;
|
||||
}
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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) {
|
||||
connection->errcode = PHP_OCI_CALL(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_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;
|
||||
ub4 block_length = PHP_OCI_LOB_BUFFER_SIZE;
|
||||
int bytes_read, bytes_total = 0, offset = 0, data_len_chars = 0;
|
||||
int requested_len = read_length; /* this is by default */
|
||||
|
||||
*data_len = 0;
|
||||
*data = NULL;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (requested_len < block_length) {
|
||||
block_length = requested_len;
|
||||
}
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
connection->errcode = PHP_OCI_CALL(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;
|
||||
}
|
||||
}
|
||||
|
||||
*data = (char *)emalloc(block_length + 1);
|
||||
bytes_read = block_length;
|
||||
offset = initial_offset;
|
||||
|
||||
do {
|
||||
connection->errcode = PHP_OCI_CALL(OCILobRead,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
descriptor->descriptor,
|
||||
&bytes_read, /* IN/OUT bytes toread/read */
|
||||
offset + 1, /* offset (starts with 1) */
|
||||
(dvoid *) ((char *) *data + *data_len),
|
||||
block_length, /* size of buffer */
|
||||
(dvoid *)0,
|
||||
(OCICallbackLobRead) 0, /* callback... */
|
||||
(ub2) connection->charset, /* The character set ID of the buffer data. */
|
||||
(ub1) SQLCS_IMPLICIT /* The character set form of the buffer data. */
|
||||
)
|
||||
);
|
||||
|
||||
bytes_total += bytes_read;
|
||||
/*
|
||||
* Oracle doesn't tell use how many CHARS were read,
|
||||
* so we have to count them to get the correct offset for CLOBS */
|
||||
data_len_chars = OCIMultiByteStrnDisplayLength(connection->env, *data, bytes_total);
|
||||
offset = initial_offset + data_len_chars;
|
||||
|
||||
*data_len += bytes_read;
|
||||
block_length = PHP_OCI_LOB_BUFFER_SIZE;
|
||||
|
||||
if (connection->errcode != OCI_NEED_DATA) {
|
||||
break;
|
||||
}
|
||||
*data = erealloc(*data, *data_len + PHP_OCI_LOB_BUFFER_SIZE + 1);
|
||||
} while (connection->errcode == OCI_NEED_DATA);
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
efree(*data);
|
||||
*data = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
descriptor->lob_current_position += data_len_chars;
|
||||
|
||||
if (descriptor->type == OCI_DTYPE_FILE) {
|
||||
connection->errcode = PHP_OCI_CALL(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);
|
||||
efree(*data);
|
||||
*data = NULL;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
*data = erealloc(*data, *data_len + 1);
|
||||
(*data)[ *data_len ] = 0;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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) 0, (ub1) SQLCS_IMPLICIT));
|
||||
|
||||
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) {
|
||||
connection->errcode = PHP_OCI_CALL(OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor));
|
||||
}
|
||||
else {
|
||||
connection->errcode = PHP_OCI_CALL(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 TSRMLS_DC)
|
||||
{
|
||||
if (descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_copy()
|
||||
Copy one LOB (or its part) to another one */
|
||||
int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from, long length TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor_dest->connection;
|
||||
int length_dest, length_from, copy_len;
|
||||
|
||||
if (php_oci_lob_get_length(descriptor_dest, &length_dest TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (php_oci_lob_get_length(descriptor_from, &length_from TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (length == -1) {
|
||||
copy_len = length_from - descriptor_from->lob_current_position;
|
||||
}
|
||||
else {
|
||||
copy_len = length;
|
||||
}
|
||||
|
||||
if ((int)copy_len <= 0) {
|
||||
/* silently fail, there is nothing to copy */
|
||||
return 1;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(OCILobCopy, (connection->svc, connection->err, descriptor_dest->descriptor, descriptor_from->descriptor, copy_len, descriptor_dest->lob_current_position+1, descriptor_from->lob_current_position+1));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_close()
|
||||
Close LOB */
|
||||
int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
int is_temporary;
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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) {
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_flush()
|
||||
Flush buffers for the LOB (only if they have been used) */
|
||||
int php_oci_lob_flush(php_oci_descriptor *descriptor, int flush_flag TSRMLS_DC)
|
||||
{
|
||||
OCILobLocator *lob = descriptor->descriptor;
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
|
||||
if (!lob) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (flush_flag) {
|
||||
case 0:
|
||||
case OCI_LOB_BUFFER_FREE:
|
||||
/* only these two are allowed */
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid flag value: %d", flush_flag);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* do not really flush buffer, but report success
|
||||
* to suppress OCI error when flushing not used buffer
|
||||
* */
|
||||
if (descriptor->buffering != PHP_OCI_LOB_BUFFER_USED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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)
|
||||
{
|
||||
/* flushing Lobs & Files with buffering enabled */
|
||||
if ((descriptor->type == OCI_DTYPE_FILE || descriptor->type == OCI_DTYPE_LOB) && descriptor->buffering == PHP_OCI_LOB_BUFFER_USED) {
|
||||
php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE TSRMLS_CC);
|
||||
}
|
||||
|
||||
PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type));
|
||||
|
||||
zend_list_delete(descriptor->connection->rsrc_id);
|
||||
efree(descriptor);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_import()
|
||||
Import LOB contents from the given file */
|
||||
int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC)
|
||||
{
|
||||
int fp, loblen;
|
||||
OCILobLocator *lob = (OCILobLocator *)descriptor->descriptor;
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
char buf[8192];
|
||||
ub4 offset = 1;
|
||||
|
||||
if ((PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((fp = VCWD_OPEN(filename, O_RDONLY|O_BINARY)) == -1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't open file %s", filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {
|
||||
connection->errcode = PHP_OCI_CALL(
|
||||
OCILobWrite,
|
||||
(
|
||||
connection->svc,
|
||||
connection->err,
|
||||
lob,
|
||||
&loblen,
|
||||
(ub4) offset,
|
||||
(dvoid *) &buf,
|
||||
(ub4) loblen,
|
||||
OCI_ONE_PIECE,
|
||||
(dvoid *)0,
|
||||
(OCICallbackLobWrite) 0,
|
||||
(ub2) 0,
|
||||
(ub1) SQLCS_IMPLICIT
|
||||
)
|
||||
);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(OCILobTrim, (connection->svc, connection->err, lob, new_lob_length));
|
||||
|
||||
if (connection->errcode != OCI_SUCCESS) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
descriptor->lob_size = new_lob_length;
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_erase()
|
||||
Erase (or fill with whitespaces, depending on LOB type) the LOB (or its part) */
|
||||
int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, long length, ub4 *bytes_erased TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
OCILobLocator *lob = descriptor->descriptor;
|
||||
ub4 lob_length;
|
||||
|
||||
*bytes_erased = 0;
|
||||
|
||||
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (offset == -1) {
|
||||
offset = descriptor->lob_current_position;
|
||||
}
|
||||
|
||||
if (length == -1) {
|
||||
length = lob_length;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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 to 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;
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(OCILobIsEqual, (connection->env, first_lob, second_lob, result));
|
||||
|
||||
if (connection->errcode) {
|
||||
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
|
||||
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ php_oci_lob_write_tmp()
|
||||
Create temporary LOB and write data to it */
|
||||
int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data, int data_len TSRMLS_DC)
|
||||
{
|
||||
php_oci_connection *connection = descriptor->connection;
|
||||
OCILobLocator *lob = descriptor->descriptor;
|
||||
ub4 bytes_written = 0;
|
||||
|
||||
switch (type) {
|
||||
case OCI_TEMP_BLOB:
|
||||
case OCI_TEMP_CLOB:
|
||||
/* only these two are allowed */
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid temporary lob type: %d", type);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!data || data_len <= 0) {
|
||||
/* nothing to write, silently fail */
|
||||
return 1;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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;
|
||||
}
|
||||
|
||||
connection->errcode = PHP_OCI_CALL(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 */
|
1347
ext/oci8/oci8_statement.c
Normal file
1347
ext/oci8/oci8_statement.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,84 +2,200 @@
|
||||
<!DOCTYPE package SYSTEM "../pear/package.dtd">
|
||||
<package>
|
||||
<name>oci8</name>
|
||||
<summary>Oracle 8 call interface functions</summary>
|
||||
<summary>OCI8 functions</summary>
|
||||
<maintainers>
|
||||
<maintainer>
|
||||
<user>tony2001</user>
|
||||
<name>Antony Dovgal</name>
|
||||
<email>tony2001@php.net</email>
|
||||
<role>developer</role>
|
||||
<role>lead</role>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<user>ssb</user>
|
||||
<name>Stig Bakken</name>
|
||||
<email>ssb@php.net</email>
|
||||
<role>developer</role>
|
||||
<user>wez</user>
|
||||
<name>Wez Furlong</name>
|
||||
<email>wez@php.net</email>
|
||||
<role>lead</role>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<user>thies</user>
|
||||
<name>Thies C. Arntzen</name>
|
||||
<email>thies@php.net</email>
|
||||
<role>developer</role>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<user>asautins</user>
|
||||
<name>Andy Sautins</name>
|
||||
<email>asautins@php.net</email>
|
||||
<role>developer</role>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<user>dbenson</user>
|
||||
<name>David Benson</name>
|
||||
<email>dbenson@php.net</email>
|
||||
<role>developer</role>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<user>maxim</user>
|
||||
<name>Maxim Maletsky</name>
|
||||
<email>maxim@php.net</email>
|
||||
<role>developer</role>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<user>phanto</user>
|
||||
<name>Harald Radi</name>
|
||||
<email>phanto@php.net</email>
|
||||
<role>developer</role>
|
||||
<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 8 call interface.
|
||||
These functions allow you to access Oracle database servers using
|
||||
the Oracle Call Interface (OCI8).
|
||||
</description>
|
||||
<license>PHP</license>
|
||||
<release>
|
||||
<state>beta</state>
|
||||
<version>5.0.0rc1</version>
|
||||
<date>2004-03-19</date>
|
||||
<version>1.2</version>
|
||||
<date>2005-??-??</date>
|
||||
<notes>
|
||||
package.xml added to support intallation using pear installer
|
||||
Fixed PECL bug #5571 (oci_new_connect() not closed by oci_close())
|
||||
Fixed bug #33383 (crash when retrieving empty BLOBs)
|
||||
</notes>
|
||||
<configureoptions>
|
||||
<configureoption name="with-oci8" default="autodetect" prompt="ORACLE_HOME directory?"/>
|
||||
</configureoptions>
|
||||
<filelist>
|
||||
<file role="doc" name="CREDITS"/>
|
||||
<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="php_oci8.h"/>
|
||||
<file role="test" name="tests/bug26133.phpt"/>
|
||||
<file role="test" name="tests/connect.inc"/>
|
||||
<file role="test" name="tests/create_table.inc"/>
|
||||
<file role="test" name="tests/drop_table.inc"/>
|
||||
<file role="test" name="tests/skipif.inc"/>
|
||||
</filelist>
|
||||
<deps>
|
||||
<dep type="php" rel="ge" version="5" />
|
||||
</deps>
|
||||
</release>
|
||||
</package>
|
||||
<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/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/close.phpt"/>
|
||||
<file role="test" name="tests/coll_001.phpt"/>
|
||||
<file role="test" name="tests/coll_002_func.phpt"/>
|
||||
<file role="test" name="tests/coll_002.phpt"/>
|
||||
<file role="test" name="tests/coll_003_func.phpt"/>
|
||||
<file role="test" name="tests/coll_003.phpt"/>
|
||||
<file role="test" name="tests/coll_004_func.phpt"/>
|
||||
<file role="test" name="tests/coll_004.phpt"/>
|
||||
<file role="test" name="tests/coll_005.phpt"/>
|
||||
<file role="test" name="tests/coll_006_func.phpt"/>
|
||||
<file role="test" name="tests/coll_006.phpt"/>
|
||||
<file role="test" name="tests/coll_007.phpt"/>
|
||||
<file role="test" name="tests/coll_008.phpt"/>
|
||||
<file role="test" name="tests/coll_009_func.phpt"/>
|
||||
<file role="test" name="tests/coll_009.phpt"/>
|
||||
<file role="test" name="tests/coll_010_func.phpt"/>
|
||||
<file role="test" name="tests/coll_010.phpt"/>
|
||||
<file role="test" name="tests/coll_011_func.phpt"/>
|
||||
<file role="test" name="tests/coll_011.phpt"/>
|
||||
<file role="test" name="tests/coll_012_func.phpt"/>
|
||||
<file role="test" name="tests/coll_012.phpt"/>
|
||||
<file role="test" name="tests/coll_013_func.phpt"/>
|
||||
<file role="test" name="tests/coll_013.phpt"/>
|
||||
<file role="test" name="tests/coll_014_func.phpt"/>
|
||||
<file role="test" name="tests/coll_014.phpt"/>
|
||||
<file role="test" name="tests/coll_015_func.phpt"/>
|
||||
<file role="test" name="tests/coll_015.phpt"/>
|
||||
<file role="test" name="tests/coll_016_func.phpt"/>
|
||||
<file role="test" name="tests/coll_016.phpt"/>
|
||||
<file role="test" name="tests/coll_017_func.phpt"/>
|
||||
<file role="test" name="tests/coll_017.phpt"/>
|
||||
<file role="test" name="tests/commit_old.phpt"/>
|
||||
<file role="test" name="tests/commit.phpt"/>
|
||||
<file role="test" name="tests/connect_1_old.phpt"/>
|
||||
<file role="test" name="tests/connect_1.phpt"/>
|
||||
<file role="test" name="tests/connect.inc"/>
|
||||
<file role="test" name="tests/connect_old.phpt"/>
|
||||
<file role="test" name="tests/connect.phpt"/>
|
||||
<file role="test" name="tests/connect_without_oracle_home_old.phpt"/>
|
||||
<file role="test" name="tests/connect_without_oracle_home.phpt"/>
|
||||
<file role="test" name="tests/create_table.inc"/>
|
||||
<file role="test" name="tests/create_type.inc"/>
|
||||
<file role="test" name="tests/cursor_bind_err.phpt"/>
|
||||
<file role="test" name="tests/cursors_old.phpt"/>
|
||||
<file role="test" name="tests/cursors.phpt"/>
|
||||
<file role="test" name="tests/debug.phpt"/>
|
||||
<file role="test" name="tests/default_prefetch1.phpt"/>
|
||||
<file role="test" name="tests/default_prefetch2.phpt"/>
|
||||
<file role="test" name="tests/default_prefetch.phpt"/>
|
||||
<file role="test" name="tests/define_old.phpt"/>
|
||||
<file role="test" name="tests/define.phpt"/>
|
||||
<file role="test" name="tests/drop_table.inc"/>
|
||||
<file role="test" name="tests/drop_type.inc"/>
|
||||
<file role="test" name="tests/error_old.phpt"/>
|
||||
<file role="test" name="tests/error.phpt"/>
|
||||
<file role="test" name="tests/exec_fetch.phpt"/>
|
||||
<file role="test" name="tests/fetch_all.phpt"/>
|
||||
<file role="test" name="tests/fetch_array.phpt"/>
|
||||
<file role="test" name="tests/fetch_assoc.phpt"/>
|
||||
<file role="test" name="tests/fetch_into1.phpt"/>
|
||||
<file role="test" name="tests/fetch_into2.phpt"/>
|
||||
<file role="test" name="tests/fetch_into.phpt"/>
|
||||
<file role="test" name="tests/fetch_object.phpt"/>
|
||||
<file role="test" name="tests/fetch.phpt"/>
|
||||
<file role="test" name="tests/fetch_row.phpt"/>
|
||||
<file role="test" name="tests/field_funcs_old.phpt"/>
|
||||
<file role="test" name="tests/field_funcs.phpt"/>
|
||||
<file role="test" name="tests/lob_001.phpt"/>
|
||||
<file role="test" name="tests/lob_002.phpt"/>
|
||||
<file role="test" name="tests/lob_003.phpt"/>
|
||||
<file role="test" name="tests/lob_004.phpt"/>
|
||||
<file role="test" name="tests/lob_005.phpt"/>
|
||||
<file role="test" name="tests/lob_006.phpt"/>
|
||||
<file role="test" name="tests/lob_007.phpt"/>
|
||||
<file role="test" name="tests/lob_008.phpt"/>
|
||||
<file role="test" name="tests/lob_009.phpt"/>
|
||||
<file role="test" name="tests/lob_009.txt"/>
|
||||
<file role="test" name="tests/lob_010.phpt"/>
|
||||
<file role="test" name="tests/lob_011.phpt"/>
|
||||
<file role="test" name="tests/lob_012.phpt"/>
|
||||
<file role="test" name="tests/lob_013.phpt"/>
|
||||
<file role="test" name="tests/lob_014.phpt"/>
|
||||
<file role="test" name="tests/lob_015.phpt"/>
|
||||
<file role="test" name="tests/lob_016.phpt"/>
|
||||
<file role="test" name="tests/lob_017.phpt"/>
|
||||
<file role="test" name="tests/lob_018.phpt"/>
|
||||
<file role="test" name="tests/lob_temp1.phpt"/>
|
||||
<file role="test" name="tests/lob_temp.phpt"/>
|
||||
<file role="test" name="tests/num.phpt"/>
|
||||
<file role="test" name="tests/oci_execute_segfault.phpt"/>
|
||||
<file role="test" name="tests/old_oci_close1.phpt"/>
|
||||
<file role="test" name="tests/old_oci_close.phpt"/>
|
||||
<file role="test" name="tests/password_new.phpt"/>
|
||||
<file role="test" name="tests/password_old.phpt"/>
|
||||
<file role="test" name="tests/password.phpt"/>
|
||||
<file role="test" name="tests/persistent.phpt"/>
|
||||
<file role="test" name="tests/prefetch_old.phpt"/>
|
||||
<file role="test" name="tests/prefetch.phpt"/>
|
||||
<file role="test" name="tests/privileged_connect1.phpt"/>
|
||||
<file role="test" name="tests/privileged_connect.phpt"/>
|
||||
<file role="test" name="tests/serverversion.phpt"/>
|
||||
<file role="test" name="tests/skipif.inc"/>
|
||||
<file role="test" name="tests/statement_cache.phpt"/>
|
||||
<file role="test" name="tests/statement_type_old.phpt"/>
|
||||
<file role="test" name="tests/statement_type.phpt"/>
|
||||
<file role="test" name="tests/uncommitted.phpt"/>
|
||||
</filelist>
|
||||
<configureoptions>
|
||||
<configureoption name="with-oci8" default="autodetect" prompt="Please provide the path to ORACLE_HOME dir. Use 'instantclient,/path/to/instant/client/lib' if you're compiling against Oracle Instant Client"/>
|
||||
</configureoptions>
|
||||
<changelog>
|
||||
<release>
|
||||
<state>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
|
||||
-->
|
||||
|
@ -14,6 +14,14 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| 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> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@ -22,19 +30,6 @@
|
||||
#if HAVE_OCI8
|
||||
# ifndef PHP_OCI8_H
|
||||
# define PHP_OCI8_H
|
||||
# endif
|
||||
|
||||
# if (defined(__osf__) && defined(__alpha))
|
||||
# ifndef A_OSF
|
||||
# define A_OSF
|
||||
# endif
|
||||
# ifndef OSF1
|
||||
# define OSF1
|
||||
# endif
|
||||
# ifndef _INTRINSICS
|
||||
# define _INTRINSICS
|
||||
# endif
|
||||
# endif /* osf alpha */
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_OCI_API __declspec(dllexport)
|
||||
@ -42,175 +37,21 @@
|
||||
#define PHP_OCI_API
|
||||
#endif
|
||||
|
||||
#if defined(min)
|
||||
#undef min
|
||||
#ifdef ZTS
|
||||
# include "TSRM.h"
|
||||
#endif
|
||||
#if defined(max)
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
#include <oci.h>
|
||||
|
||||
#define OCI_SEEK_SET 0
|
||||
#define OCI_SEEK_CUR 1
|
||||
#define OCI_SEEK_END 2
|
||||
|
||||
typedef struct {
|
||||
int num;
|
||||
int persistent;
|
||||
int is_open;
|
||||
char *dbname;
|
||||
OCIServer *pServer;
|
||||
#if 0
|
||||
OCIFocbkStruct failover;
|
||||
#endif
|
||||
} oci_server;
|
||||
|
||||
typedef struct {
|
||||
int num;
|
||||
zend_bool persistent;
|
||||
zend_bool is_open;
|
||||
zend_bool exclusive;
|
||||
#if ZTS
|
||||
THREAD_T thread;
|
||||
#else
|
||||
zend_bool thread;
|
||||
#endif
|
||||
zend_llist *sessions_list;
|
||||
oci_server *server;
|
||||
OCISession *pSession;
|
||||
OCIEnv *pEnv; /* sessions own environment */
|
||||
ub2 charsetId; /* sessions used character set (mostly this will be 0, so NLS_LANG will be used. */
|
||||
} oci_session;
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
int is_open;
|
||||
oci_session *session;
|
||||
OCISvcCtx *pServiceContext;
|
||||
sword error;
|
||||
OCIError *pError;
|
||||
int needs_commit;
|
||||
HashTable *descriptors;
|
||||
} oci_connection;
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
oci_connection *conn;
|
||||
dvoid *ocidescr;
|
||||
ub4 type;
|
||||
int lob_current_position;
|
||||
int lob_size; /* -1 = Lob wasn't initialized yet */
|
||||
int buffering; /* 0 - off, 1 - on, 2 - on and buffer was used */
|
||||
} oci_descriptor;
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
oci_connection *conn;
|
||||
OCIType *tdo;
|
||||
OCITypeCode coll_typecode;
|
||||
OCIRef *elem_ref;
|
||||
OCIType *element_type;
|
||||
OCITypeCode element_typecode;
|
||||
OCIColl *coll;
|
||||
} oci_collection;
|
||||
|
||||
typedef struct {
|
||||
zval *zval;
|
||||
text *name;
|
||||
ub4 name_len;
|
||||
ub4 type;
|
||||
} oci_define;
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
oci_connection *conn;
|
||||
sword error;
|
||||
OCIError *pError;
|
||||
OCIStmt *pStmt;
|
||||
char *last_query;
|
||||
HashTable *columns;
|
||||
HashTable *binds;
|
||||
HashTable *defines;
|
||||
int ncolumns;
|
||||
int executed;
|
||||
int has_data;
|
||||
ub2 stmttype;
|
||||
} oci_statement;
|
||||
|
||||
typedef struct {
|
||||
OCIBind *pBind;
|
||||
zval *zval;
|
||||
dvoid *descr; /* used for binding of LOBS etc */
|
||||
OCIStmt *pStmt; /* used for binding REFCURSORs */
|
||||
sb2 indicator;
|
||||
ub2 retcode;
|
||||
} oci_bind;
|
||||
|
||||
typedef struct {
|
||||
oci_statement *statement;
|
||||
OCIDefine *pDefine;
|
||||
char *name;
|
||||
ub4 name_len;
|
||||
ub2 data_type;
|
||||
ub2 data_size;
|
||||
ub4 storage_size4;
|
||||
sb2 indicator;
|
||||
ub2 retcode;
|
||||
ub2 retlen;
|
||||
ub4 retlen4;
|
||||
ub2 is_descr;
|
||||
ub2 is_cursor;
|
||||
int descr;
|
||||
oci_statement *pstmt;
|
||||
int stmtid;
|
||||
int descid;
|
||||
void *data;
|
||||
oci_define *define;
|
||||
int piecewise;
|
||||
ub4 cb_retlen;
|
||||
ub2 scale;
|
||||
ub2 precision;
|
||||
} oci_out_column;
|
||||
|
||||
typedef struct {
|
||||
sword error;
|
||||
OCIError *pError;
|
||||
|
||||
/*
|
||||
char *default_username;
|
||||
char *default_password;
|
||||
char *default_dbname;
|
||||
*/
|
||||
|
||||
long debug_mode;
|
||||
|
||||
int shutdown;
|
||||
|
||||
/* XXX NYI
|
||||
long allow_persistent;
|
||||
long max_persistent;
|
||||
long max_links;
|
||||
*/
|
||||
|
||||
OCIEnv *pEnv;
|
||||
|
||||
int in_call;
|
||||
} php_oci_globals;
|
||||
|
||||
extern zend_module_entry oci8_module_entry;
|
||||
#define phpext_oci8_ptr &oci8_module_entry
|
||||
|
||||
#define OCI_MAX_NAME_LEN 64
|
||||
#define OCI_MAX_DATA_SIZE INT_MAX
|
||||
#define OCI_PIECE_SIZE (64*1024)-1
|
||||
|
||||
#ifdef ZTS
|
||||
#define OCI(v) TSRMG(oci_globals_id, php_oci_globals *, v)
|
||||
#else
|
||||
#define OCI(v) (oci_globals.v)
|
||||
#endif
|
||||
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
|
||||
@ -223,3 +64,5 @@ extern zend_module_entry oci8_module_entry;
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
||||
|
||||
|
422
ext/oci8/php_oci8_int.h
Normal file
422
ext/oci8/php_oci8_int.h
Normal file
@ -0,0 +1,422 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2005 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 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_0.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
|
||||
|
||||
#define PHP_OCI_ASSOC 1<<0
|
||||
#define PHP_OCI_NUM 1<<1
|
||||
#define PHP_OCI_BOTH (PHP_OCI_ASSOC|PHP_OCI_NUM)
|
||||
|
||||
#define PHP_OCI_RETURN_NULLS 1<<2
|
||||
#define PHP_OCI_RETURN_LOBS 1<<3
|
||||
|
||||
#define PHP_OCI_FETCHSTATEMENT_BY_COLUMN 1<<4
|
||||
#define PHP_OCI_FETCHSTATEMENT_BY_ROW 1<<5
|
||||
#define PHP_OCI_FETCHSTATEMENT_BY (PHP_OCI_FETCHSTATEMENT_BY_COLUMN | PHP_OCI_FETCHSTATEMENT_BY_ROW)
|
||||
|
||||
#define PHP_OCI_LOB_BUFFER_DISABLED 0
|
||||
#define PHP_OCI_LOB_BUFFER_ENABLED 1
|
||||
#define PHP_OCI_LOB_BUFFER_USED 2
|
||||
|
||||
/* }}} */
|
||||
|
||||
typedef struct { /* php_oci_connection {{{ */
|
||||
OCIEnv *env; /* private env handle */
|
||||
ub2 charset; /* charset ID */
|
||||
OCIServer *server; /* private server handle */
|
||||
OCISvcCtx *svc; /* private service context handle */
|
||||
OCISession *session; /* private session handle */
|
||||
OCIError *err; /* private error handle */
|
||||
sword errcode; /* last errcode */
|
||||
|
||||
HashTable *descriptors; /* descriptors hash, used to flush all the LOBs using this connection on commit */
|
||||
unsigned is_open:1; /* hels to determine if the connection is dead or not */
|
||||
unsigned is_attached:1; /* hels to determine if we should detach from the server when closing/freeing the connection */
|
||||
unsigned is_persistent:1; /* self-descriptive */
|
||||
unsigned used_this_request:1; /* helps to determine if we should reset connection's next ping time and check its timeout */
|
||||
unsigned needs_commit:1; /* helps to determine if we should rollback this connection on close/shutdown */
|
||||
int rsrc_id; /* resource ID */
|
||||
time_t idle_expiry; /* time when the connection will be considered as expired */
|
||||
time_t next_ping; /* time of the next ping */
|
||||
char *hash_key; /* hashed details of the connection */
|
||||
} php_oci_connection; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_descriptor {{{ */
|
||||
int id;
|
||||
php_oci_connection *connection; /* parent connection handle */
|
||||
dvoid *descriptor; /* OCI descriptor handle */
|
||||
ub4 type; /* descriptor type */
|
||||
int lob_current_position; /* LOB internal pointer */
|
||||
int lob_size; /* cached LOB size. -1 = Lob wasn't initialized yet */
|
||||
int buffering; /* cached buffering flag. 0 - off, 1 - on, 2 - on and buffer was used */
|
||||
} php_oci_descriptor; /* }}} */
|
||||
|
||||
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 */
|
||||
ub2 stmttype; /* statement type */
|
||||
} php_oci_statement; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_bind {{{ */
|
||||
OCIBind *bind; /* bind handle */
|
||||
zval *zval; /* value */
|
||||
dvoid *descriptor; /* used for binding of LOBS etc */
|
||||
OCIStmt *statement; /* used for binding REFCURSORs */
|
||||
php_oci_statement *parent_statement; /* pointer to the parent statement */
|
||||
struct {
|
||||
void *elements;
|
||||
/* ub2 *indicators;
|
||||
ub2 *element_lengths;
|
||||
ub2 *retcodes; */
|
||||
long current_length;
|
||||
long old_length;
|
||||
long max_length;
|
||||
long type;
|
||||
} array;
|
||||
sb2 indicator; /* */
|
||||
ub2 retcode; /* */
|
||||
} php_oci_bind; /* }}} */
|
||||
|
||||
typedef struct { /* php_oci_out_column {{{ */
|
||||
php_oci_statement *statement; /* statement handle. used when fetching REFCURSORS */
|
||||
OCIDefine *oci_define; /* define handle */
|
||||
char *name; /* column name */
|
||||
ub4 name_len; /* column name length */
|
||||
ub2 data_type; /* column data type */
|
||||
ub2 data_size; /* data size */
|
||||
ub4 storage_size4; /* size used when allocating buffers */
|
||||
sb2 indicator; /* */
|
||||
ub2 retcode; /* code returned when fetching this particular column */
|
||||
ub2 retlen; /* */
|
||||
ub4 retlen4; /* */
|
||||
ub2 is_descr; /* column contains a descriptor */
|
||||
ub2 is_cursor; /* column contains a cursor */
|
||||
int stmtid; /* statement id for cursors */
|
||||
int descid; /* descriptor id for descriptors */
|
||||
void *data; /* */
|
||||
php_oci_define *define; /* define handle */
|
||||
int piecewise; /* column is fetched piece-by-piece */
|
||||
ub4 cb_retlen; /* */
|
||||
ub2 scale; /* column scale */
|
||||
ub2 precision; /* column precision */
|
||||
} php_oci_out_column; /* }}} */
|
||||
|
||||
/* {{{ macros */
|
||||
|
||||
#define PHP_OCI_CALL(func, params) \
|
||||
func params; \
|
||||
if (OCI_G(debug_mode)) { \
|
||||
php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
|
||||
}
|
||||
|
||||
#define PHP_OCI_HANDLE_ERROR(connection, errcode) \
|
||||
{ \
|
||||
switch (errcode) { \
|
||||
case 1013: \
|
||||
zend_bailout(); \
|
||||
break; \
|
||||
case 22: \
|
||||
case 1012: \
|
||||
case 3113: \
|
||||
case 604: \
|
||||
case 1041: \
|
||||
case 3114: \
|
||||
connection->is_open = 0; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
|
||||
#define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \
|
||||
resource->id = ZEND_REGISTER_RESOURCE(NULL, resource, le_resource); \
|
||||
zend_list_addref(resource->connection->rsrc_id);
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_CONNECTION(zval, connection) \
|
||||
ZEND_FETCH_RESOURCE2(connection, php_oci_connection *, &zval, -1, "oci8 connection", le_connection, le_pconnection);
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_STATEMENT(zval, statement) \
|
||||
ZEND_FETCH_RESOURCE(statement, php_oci_statement *, &zval, -1, "oci8 statement", le_statement)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_DESCRIPTOR(zval, descriptor) \
|
||||
ZEND_FETCH_RESOURCE(descriptor, php_oci_descriptor *, &zval, -1, "oci8 descriptor", le_descriptor)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_COLLECTION(zval, collection) \
|
||||
ZEND_FETCH_RESOURCE(collection, php_oci_collection *, &zval, -1, "oci8 collection", le_collection)
|
||||
|
||||
#define PHP_OCI_FETCH_RESOURCE_EX(zval, var, type, name, resource_type) \
|
||||
var = (type) zend_fetch_resource(&zval TSRMLS_CC, -1, name, NULL, 1, resource_type); \
|
||||
if (!var) { \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_CONNECTION_EX(zval, connection) \
|
||||
PHP_OCI_FETCH_RESOURCE_EX(zval, connection, php_oci_connection *, "oci8 connection", le_connection)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_STATEMENT_EX(zval, statement) \
|
||||
PHP_OCI_FETCH_RESOURCE_EX(zval, statement, php_oci_statement *, "oci8 statement", le_statement)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(zval, descriptor) \
|
||||
PHP_OCI_FETCH_RESOURCE_EX(zval, descriptor, php_oci_descriptor *, "oci8 descriptor", le_descriptor)
|
||||
|
||||
#define PHP_OCI_ZVAL_TO_COLLECTION_EX(zval, collection) \
|
||||
PHP_OCI_FETCH_RESOURCE_EX(zval, collection, php_oci_collection *, "oci8 collection", le_collection)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* PROTOS */
|
||||
|
||||
/* main prototypes {{{ */
|
||||
|
||||
void php_oci_column_hash_dtor (void *data);
|
||||
void php_oci_define_hash_dtor (void *data);
|
||||
void php_oci_bind_hash_dtor (void *data);
|
||||
void php_oci_descriptor_flush_hash_dtor (void *data);
|
||||
|
||||
sb4 php_oci_error (OCIError *, sword TSRMLS_DC);
|
||||
sb4 php_oci_fetch_errmsg(OCIError *, text ** TSRMLS_DC);
|
||||
#ifdef HAVE_OCI8_ATTR_STATEMENT
|
||||
int php_oci_fetch_sqltext_offset(php_oci_statement *, text **, ub2 * TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
void php_oci_do_connect (INTERNAL_FUNCTION_PARAMETERS, int , int);
|
||||
php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC);
|
||||
|
||||
int php_oci_connection_rollback(php_oci_connection * TSRMLS_DC);
|
||||
int php_oci_connection_commit(php_oci_connection * TSRMLS_DC);
|
||||
|
||||
int php_oci_password_change(php_oci_connection *, char *, int, char *, int, char *, int TSRMLS_DC);
|
||||
int php_oci_server_get_version(php_oci_connection *, char ** TSRMLS_DC);
|
||||
|
||||
void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int, int);
|
||||
int php_oci_column_to_zval(php_oci_out_column *, zval *, int TSRMLS_DC);
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* lob related prototypes {{{ */
|
||||
|
||||
php_oci_descriptor * php_oci_lob_create (php_oci_connection *, long TSRMLS_DC);
|
||||
int php_oci_lob_get_length (php_oci_descriptor *, ub4 * TSRMLS_DC);
|
||||
int php_oci_lob_read (php_oci_descriptor *, long, long, char **, ub4 * TSRMLS_DC);
|
||||
int php_oci_lob_write (php_oci_descriptor *, ub4, char *, int, ub4 * TSRMLS_DC);
|
||||
int php_oci_lob_flush (php_oci_descriptor *, int TSRMLS_DC);
|
||||
int php_oci_lob_set_buffering (php_oci_descriptor *, int TSRMLS_DC);
|
||||
int php_oci_lob_get_buffering (php_oci_descriptor * TSRMLS_DC);
|
||||
int php_oci_lob_copy (php_oci_descriptor *, php_oci_descriptor *, long TSRMLS_DC);
|
||||
#ifdef HAVE_OCI8_TEMP_LOB
|
||||
int php_oci_lob_close (php_oci_descriptor * TSRMLS_DC);
|
||||
int php_oci_lob_write_tmp (php_oci_descriptor *, ub1, char *, int TSRMLS_DC);
|
||||
#endif
|
||||
void php_oci_lob_free(php_oci_descriptor * TSRMLS_DC);
|
||||
int php_oci_lob_import(php_oci_descriptor *descriptor, char * TSRMLS_DC);
|
||||
int php_oci_lob_append (php_oci_descriptor *, php_oci_descriptor * TSRMLS_DC);
|
||||
int php_oci_lob_truncate (php_oci_descriptor *, long TSRMLS_DC);
|
||||
int php_oci_lob_erase (php_oci_descriptor *, long, long, ub4 * TSRMLS_DC);
|
||||
int php_oci_lob_is_equal (php_oci_descriptor *, php_oci_descriptor *, boolean * TSRMLS_DC);
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* 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 *, long, zend_bool TSRMLS_DC);
|
||||
int php_oci_statement_set_prefetch (php_oci_statement *, ub4 TSRMLS_DC);
|
||||
int php_oci_statement_fetch (php_oci_statement *, ub4 TSRMLS_DC);
|
||||
php_oci_out_column * php_oci_statement_get_column (php_oci_statement *, long, char*, long 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 php_oci_statement_get_type(php_oci_statement *, ub2 * TSRMLS_DC);
|
||||
int php_oci_statement_get_numrows(php_oci_statement *, ub4 * TSRMLS_DC);
|
||||
int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long max_table_length, long maxlength, long type TSRMLS_DC);
|
||||
php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length TSRMLS_DC);
|
||||
php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length TSRMLS_DC);
|
||||
php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, long maxlength TSRMLS_DC);
|
||||
php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, php_oci_connection *connection TSRMLS_DC);
|
||||
|
||||
/* }}} */
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ */
|
||||
sword errcode; /* global last error code (used when connect fails, for example) */
|
||||
OCIError *err; /* global error handle */
|
||||
|
||||
/*
|
||||
char *default_username;
|
||||
char *default_password;
|
||||
char *default_dbname;
|
||||
*/
|
||||
|
||||
zend_bool debug_mode; /* debug mode flag */
|
||||
|
||||
long max_persistent; /* maximum number of persistent connections per process */
|
||||
long num_persistent; /* number of existing persistent connections */
|
||||
long num_links; /* non-persistent + persistent connections */
|
||||
long ping_interval; /* time interval between pings */
|
||||
long persistent_timeout; /* time period after which idle persistent connection is considered expired */
|
||||
long statement_cache_size; /* statement cache size. used with 9i+ clients only*/
|
||||
long default_prefetch; /* default prefetch setting */
|
||||
zend_bool privileged_connect; /* privileged connect flag (On/Off) */
|
||||
zend_bool old_oci_close_semantics; /* old_oci_close_semantics flag (to determine the way oci_close() should behave) */
|
||||
|
||||
int shutdown; /* in shutdown flag */
|
||||
|
||||
OCIEnv *env; /* global environment handle */
|
||||
|
||||
ZEND_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:
|
||||
*/
|
||||
|
||||
|
44
ext/oci8/tests/bind_empty.phpt
Normal file
44
ext/oci8/tests/bind_empty.phpt
Normal file
@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
binding empty values
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table bind_test(name VARCHAR(10))";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
|
||||
$name = null;
|
||||
$stmt = oci_parse($c, "UPDATE bind_test SET name=:name");
|
||||
oci_bind_by_name($stmt, ":name", &$name);
|
||||
|
||||
$res = oci_execute($stmt);
|
||||
|
||||
$name = "";
|
||||
$stmt = oci_parse($c, "UPDATE bind_test SET name=:name");
|
||||
oci_bind_by_name($stmt, ":name", &$name);
|
||||
|
||||
$res = oci_execute($stmt);
|
||||
|
||||
$drop = "DROP table bind_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Done
|
@ -1,36 +1,39 @@
|
||||
--TEST--
|
||||
Bug #26133 (ocifreedesc() segfault)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require 'skipif.inc';
|
||||
?>
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
require 'connect.inc';
|
||||
require 'create_table.inc';
|
||||
|
||||
if ($connection) {
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
if ($c) {
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema."php_test_table (id, value)
|
||||
".$schema.$table_name." (id, value)
|
||||
VALUES ('1','1')
|
||||
RETURNING
|
||||
ROWID
|
||||
INTO :v_rowid ";
|
||||
|
||||
$statement = OCIParse($connection,$ora_sql);
|
||||
$rowid = OCINewDescriptor($connection,OCI_D_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($connection);
|
||||
OCICommit($c);
|
||||
}
|
||||
OCIFreeStatement($statement);
|
||||
$rowid->free();
|
||||
}
|
||||
|
||||
require 'drop_table.inc';
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
Done
|
||||
|
||||
|
257
ext/oci8/tests/bug27303.phpt
Normal file
257
ext/oci8/tests/bug27303.phpt
Normal file
@ -0,0 +1,257 @@
|
||||
--TEST--
|
||||
bug #27303 (OCIBindByName binds numeric PHP values as characters)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--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
|
257
ext/oci8/tests/bug27303_2.phpt
Normal file
257
ext/oci8/tests/bug27303_2.phpt
Normal file
@ -0,0 +1,257 @@
|
||||
--TEST--
|
||||
bug #27303 (OCIBindByName binds numeric PHP values as characters)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--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
|
257
ext/oci8/tests/bug27303_3.phpt
Normal file
257
ext/oci8/tests/bug27303_3.phpt
Normal file
@ -0,0 +1,257 @@
|
||||
--TEST--
|
||||
bug #27303 (OCIBindByName binds numeric PHP values as characters)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--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
|
257
ext/oci8/tests/bug27303_4.phpt
Normal file
257
ext/oci8/tests/bug27303_4.phpt
Normal file
@ -0,0 +1,257 @@
|
||||
--TEST--
|
||||
bug #27303 (OCIBindByName binds numeric PHP values as characters)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--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
|
44
ext/oci8/tests/bug32325.phpt
Normal file
44
ext/oci8/tests/bug32325.phpt
Normal file
@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
bug #32325 (Can't retrieve collection using OCI8)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--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
|
22
ext/oci8/tests/close.phpt
Normal file
22
ext/oci8/tests/close.phpt
Normal file
@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
connect/close/connect
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
oci_close($c);
|
||||
|
||||
oci_connect($user, $password, $dbase);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Done
|
33
ext/oci8/tests/coll_001.phpt
Normal file
33
ext/oci8/tests/coll_001.phpt
Normal file
@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
oci_new_collection()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
36
ext/oci8/tests/coll_002.phpt
Normal file
36
ext/oci8/tests/coll_002.phpt
Normal file
@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
oci_new_collection() + free()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
36
ext/oci8/tests/coll_002_func.phpt
Normal file
36
ext/oci8/tests/coll_002_func.phpt
Normal file
@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
oci_new_collection() + free()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
40
ext/oci8/tests/coll_003.phpt
Normal file
40
ext/oci8/tests/coll_003.phpt
Normal file
@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
collection methods
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
40
ext/oci8/tests/coll_003_func.phpt
Normal file
40
ext/oci8/tests/coll_003_func.phpt
Normal file
@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
collection methods
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
35
ext/oci8/tests/coll_004.phpt
Normal file
35
ext/oci8/tests/coll_004.phpt
Normal file
@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
oci_collection_assign()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
35
ext/oci8/tests/coll_004_func.phpt
Normal file
35
ext/oci8/tests/coll_004_func.phpt
Normal file
@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
oci_collection_assign()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
33
ext/oci8/tests/coll_005.phpt
Normal file
33
ext/oci8/tests/coll_005.phpt
Normal file
@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
ocinewcollection()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
36
ext/oci8/tests/coll_006.phpt
Normal file
36
ext/oci8/tests/coll_006.phpt
Normal file
@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
ocinewcollection() + free()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
36
ext/oci8/tests/coll_006_func.phpt
Normal file
36
ext/oci8/tests/coll_006_func.phpt
Normal file
@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
ocinewcollection() + free()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
40
ext/oci8/tests/coll_007.phpt
Normal file
40
ext/oci8/tests/coll_007.phpt
Normal file
@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
collection methods
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
35
ext/oci8/tests/coll_008.phpt
Normal file
35
ext/oci8/tests/coll_008.phpt
Normal file
@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
ocicollassign()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
48
ext/oci8/tests/coll_009.phpt
Normal file
48
ext/oci8/tests/coll_009.phpt
Normal file
@ -0,0 +1,48 @@
|
||||
--TEST--
|
||||
collections and wrong dates
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
48
ext/oci8/tests/coll_009_func.phpt
Normal file
48
ext/oci8/tests/coll_009_func.phpt
Normal file
@ -0,0 +1,48 @@
|
||||
--TEST--
|
||||
collections and wrong dates
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
47
ext/oci8/tests/coll_010.phpt
Normal file
47
ext/oci8/tests/coll_010.phpt
Normal file
@ -0,0 +1,47 @@
|
||||
--TEST--
|
||||
collections and nulls
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
47
ext/oci8/tests/coll_010_func.phpt
Normal file
47
ext/oci8/tests/coll_010_func.phpt
Normal file
@ -0,0 +1,47 @@
|
||||
--TEST--
|
||||
collections and nulls
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
49
ext/oci8/tests/coll_011.phpt
Normal file
49
ext/oci8/tests/coll_011.phpt
Normal file
@ -0,0 +1,49 @@
|
||||
--TEST--
|
||||
collections and strings
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
49
ext/oci8/tests/coll_011_func.phpt
Normal file
49
ext/oci8/tests/coll_011_func.phpt
Normal file
@ -0,0 +1,49 @@
|
||||
--TEST--
|
||||
collections and strings
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
47
ext/oci8/tests/coll_012.phpt
Normal file
47
ext/oci8/tests/coll_012.phpt
Normal file
@ -0,0 +1,47 @@
|
||||
--TEST--
|
||||
collections and correct dates
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
47
ext/oci8/tests/coll_012_func.phpt
Normal file
47
ext/oci8/tests/coll_012_func.phpt
Normal file
@ -0,0 +1,47 @@
|
||||
--TEST--
|
||||
collections and correct dates
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
44
ext/oci8/tests/coll_013.phpt
Normal file
44
ext/oci8/tests/coll_013.phpt
Normal file
@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
collections and correct dates (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
44
ext/oci8/tests/coll_013_func.phpt
Normal file
44
ext/oci8/tests/coll_013_func.phpt
Normal file
@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
collections and correct dates (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
44
ext/oci8/tests/coll_014.phpt
Normal file
44
ext/oci8/tests/coll_014.phpt
Normal file
@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
collections and strings (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
44
ext/oci8/tests/coll_014_func.phpt
Normal file
44
ext/oci8/tests/coll_014_func.phpt
Normal file
@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
collections and strings (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
44
ext/oci8/tests/coll_015.phpt
Normal file
44
ext/oci8/tests/coll_015.phpt
Normal file
@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
collections and numbers (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
44
ext/oci8/tests/coll_015_func.phpt
Normal file
44
ext/oci8/tests/coll_015_func.phpt
Normal file
@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
collections and numbers (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
54
ext/oci8/tests/coll_016.phpt
Normal file
54
ext/oci8/tests/coll_016.phpt
Normal file
@ -0,0 +1,54 @@
|
||||
--TEST--
|
||||
collections and negative/too big element indexes
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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 [4294967295] must be in the range of 0 to [0] in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: OCI-Collection::assignelem(): OCI-22165: given index [5000] must be in the range of 0 to [0] in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
Done
|
54
ext/oci8/tests/coll_016_func.phpt
Normal file
54
ext/oci8/tests/coll_016_func.phpt
Normal file
@ -0,0 +1,54 @@
|
||||
--TEST--
|
||||
collections and negative/too big element indexes
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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 [4294967295] must be in the range of 0 to [0] in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: oci_collection_element_assign(): OCI-22165: given index [5000] must be in the range of 0 to [0] in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
Done
|
44
ext/oci8/tests/coll_017.phpt
Normal file
44
ext/oci8/tests/coll_017.phpt
Normal file
@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
collections and nulls (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
44
ext/oci8/tests/coll_017_func.phpt
Normal file
44
ext/oci8/tests/coll_017_func.phpt
Normal file
@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
collections and nulls (2)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
|
||||
";
|
||||
--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
|
153
ext/oci8/tests/commit.phpt
Normal file
153
ext/oci8/tests/commit.phpt
Normal file
@ -0,0 +1,153 @@
|
||||
--TEST--
|
||||
oci_commit()/oci_rollback()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--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
|
151
ext/oci8/tests/commit_old.phpt
Normal file
151
ext/oci8/tests/commit_old.phpt
Normal file
@ -0,0 +1,151 @@
|
||||
--TEST--
|
||||
ocicommit()/ocirollback()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--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
|
@ -4,29 +4,27 @@
|
||||
* Please, change user, password and dbase to match your configuration.
|
||||
*
|
||||
* */
|
||||
|
||||
$user = "user";
|
||||
$password = "pass";
|
||||
$dbase = "base";
|
||||
|
||||
$user = "system";
|
||||
$password = "system";
|
||||
$dbase = "oracle";
|
||||
|
||||
/*
|
||||
* You should have privileges to create tables in this schema
|
||||
*
|
||||
* */
|
||||
|
||||
$schema = "system";
|
||||
|
||||
/*
|
||||
* Remove the last line in skipif.inc to run tests
|
||||
*
|
||||
* */
|
||||
|
||||
$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)) {
|
||||
$connection = ocilogon($user,$password,$dbase);
|
||||
$c = ocilogon($user,$password,$dbase);
|
||||
}
|
||||
else {
|
||||
$connection = ocilogon($user,$password);
|
||||
$c = ocilogon($user,$password);
|
||||
}
|
||||
|
||||
if (!empty($schema)) {
|
||||
|
27
ext/oci8/tests/connect.phpt
Normal file
27
ext/oci8/tests/connect.phpt
Normal file
@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
oci_connect()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--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
|
40
ext/oci8/tests/connect_1.phpt
Normal file
40
ext/oci8/tests/connect_1.phpt
Normal file
@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
oci_pconnect() & oci_new_connect()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
if (!empty($dbase)) {
|
||||
var_dump($c1 = oci_pconnect($user, $password, $dbase));
|
||||
}
|
||||
else {
|
||||
var_dump($c1 = oci_pconnect($user, $password));
|
||||
}
|
||||
|
||||
if (!empty($dbase)) {
|
||||
var_dump($c2 = oci_new_connect($user, $password, $dbase));
|
||||
}
|
||||
else {
|
||||
var_dump($c2 = oci_new_connect($user, $password));
|
||||
}
|
||||
|
||||
var_dump(oci_close($c1));
|
||||
var_dump(ocilogoff($c2));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (oci8 persistent connection)
|
||||
resource(%d) of type (oci8 connection)
|
||||
bool(true)
|
||||
bool(true)
|
||||
Done
|
40
ext/oci8/tests/connect_1_old.phpt
Normal file
40
ext/oci8/tests/connect_1_old.phpt
Normal file
@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
ociplogon() & ocinlogon()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
if (!empty($dbase)) {
|
||||
var_dump($c1 = ociplogon($user, $password, $dbase));
|
||||
}
|
||||
else {
|
||||
var_dump($c1 = ociplogon($user, $password));
|
||||
}
|
||||
|
||||
if (!empty($dbase)) {
|
||||
var_dump($c2 = ocinlogon($user, $password, $dbase));
|
||||
}
|
||||
else {
|
||||
var_dump($c2 = ocinlogon($user, $password));
|
||||
}
|
||||
|
||||
var_dump(ocilogoff($c1));
|
||||
var_dump(ocilogoff($c2));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (oci8 persistent connection)
|
||||
resource(%d) of type (oci8 connection)
|
||||
bool(true)
|
||||
bool(true)
|
||||
Done
|
27
ext/oci8/tests/connect_old.phpt
Normal file
27
ext/oci8/tests/connect_old.phpt
Normal file
@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
ocilogon()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
if (!empty($dbase)) {
|
||||
var_dump(ocilogon($user, $password, $dbase));
|
||||
}
|
||||
else {
|
||||
var_dump(ocilogon($user, $password));
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (oci8 connection)
|
||||
Done
|
25
ext/oci8/tests/connect_without_oracle_home.phpt
Normal file
25
ext/oci8/tests/connect_without_oracle_home.phpt
Normal file
@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
oci_connect() without ORACLE_HOME set (OCIServerAttach() segfaults)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
if (!empty($dbase)) {
|
||||
var_dump(oci_connect($user, $password, $dbase));
|
||||
}
|
||||
else {
|
||||
var_dump(oci_connect($user, $password));
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ocilogon(): _oci_open_server failed, check ORACLE_HOME and NLS_LANG variables: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor in %sconnect.inc on line %d
|
||||
|
||||
Warning: oci_connect(): _oci_open_server failed, check ORACLE_HOME and NLS_LANG variables: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor in %sconnect_without_oracle_home.php on line %d
|
||||
bool(false)
|
||||
Done
|
25
ext/oci8/tests/connect_without_oracle_home_old.phpt
Normal file
25
ext/oci8/tests/connect_without_oracle_home_old.phpt
Normal file
@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
ocilogon() without ORACLE_HOME set (OCIServerAttach() segfaults)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
if (!empty($dbase)) {
|
||||
var_dump(ocilogon($user, $password, $dbase));
|
||||
}
|
||||
else {
|
||||
var_dump(ocilogon($user, $password));
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ocilogon(): _oci_open_server failed, check ORACLE_HOME and NLS_LANG variables: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor in %sconnect.inc on line %d
|
||||
|
||||
Warning: oci_connect(): _oci_open_server failed, check ORACLE_HOME and NLS_LANG variables: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor in %sconnect_without_oracle_home.php on line %d
|
||||
bool(false)
|
||||
Done
|
@ -1,11 +1,18 @@
|
||||
<?php
|
||||
|
||||
if ($connection) {
|
||||
if ($c) {
|
||||
$ora_sql = "DROP TABLE
|
||||
".$schema.$table_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c, $ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TABLE
|
||||
".$schema."php_test_table (id NUMBER, value NUMBER)
|
||||
".$schema.$table_name." (id NUMBER, value NUMBER, blob BLOB, clob CLOB, string VARCHAR(10))
|
||||
";
|
||||
|
||||
$statement = OCIParse($connection,$ora_sql);
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
}
|
||||
|
||||
|
17
ext/oci8/tests/create_type.inc
Normal file
17
ext/oci8/tests/create_type.inc
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
if ($c) {
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER(11)";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
}
|
||||
|
||||
?>
|
53
ext/oci8/tests/cursor_bind_err.phpt
Normal file
53
ext/oci8/tests/cursor_bind_err.phpt
Normal file
@ -0,0 +1,53 @@
|
||||
--TEST--
|
||||
binding a cursor (with errors)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_table.inc";
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$sql = "select CURSOR(select * from ".$schema.$table_name.") into :cursor from dual";
|
||||
$stmt = oci_parse($c, $sql);
|
||||
|
||||
$cursor = oci_new_cursor($c);
|
||||
oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
|
||||
|
||||
oci_execute($stmt);
|
||||
|
||||
oci_execute($cursor);
|
||||
var_dump(oci_fetch_assoc($cursor));
|
||||
|
||||
require dirname(__FILE__)."/drop_table.inc";
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_by_name(): ORA-01036: illegal variable name/number in %s on line %d
|
||||
|
||||
Warning: oci_fetch_assoc(): ORA-24338: statement handle not executed in %s on line %d
|
||||
bool(false)
|
||||
Done
|
64
ext/oci8/tests/cursors.phpt
Normal file
64
ext/oci8/tests/cursors.phpt
Normal file
@ -0,0 +1,64 @@
|
||||
--TEST--
|
||||
fetching cursor from a statement
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_table.inc";
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$sql = "select CURSOR(select * from ".$schema.$table_name.") as curs FROM dual";
|
||||
$stmt = oci_parse($c, $sql);
|
||||
|
||||
oci_execute($stmt);
|
||||
|
||||
while ($data = oci_fetch_assoc($stmt)) {
|
||||
oci_execute($data["CURS"]);
|
||||
$subdata = oci_fetch_assoc($data["CURS"]);
|
||||
var_dump($subdata);
|
||||
var_dump(oci_cancel($data["CURS"]));
|
||||
$subdata = oci_fetch_assoc($data["CURS"]);
|
||||
var_dump($subdata);
|
||||
var_dump(oci_cancel($data["CURS"]));
|
||||
}
|
||||
|
||||
require dirname(__FILE__)."/drop_table.inc";
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
bool(true)
|
||||
|
||||
Warning: oci_fetch_assoc()%sORA-01002: fetch out of sequence in %scursors.php on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
Done
|
69
ext/oci8/tests/cursors_old.phpt
Normal file
69
ext/oci8/tests/cursors_old.phpt
Normal file
@ -0,0 +1,69 @@
|
||||
--TEST--
|
||||
fetching cursor from a statement
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_table.inc";
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = ociparse($c, $insert_sql))) {
|
||||
die("ociparse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!ociexecute($s)) {
|
||||
die("ociexecute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!ocicommit($c)) {
|
||||
die("ocicommit() failed!\n");
|
||||
}
|
||||
|
||||
$sql = "select CURSOR(select * from ".$schema.$table_name.") as curs FROM dual";
|
||||
$stmt = ociparse($c, $sql);
|
||||
|
||||
ociexecute($stmt);
|
||||
|
||||
while ($result = ocifetchinto($stmt, $data, OCI_ASSOC)) {
|
||||
ociexecute($data["CURS"]);
|
||||
ocifetchinto($data["CURS"], $subdata, OCI_ASSOC);
|
||||
var_dump($subdata);
|
||||
var_dump(ocicancel($data["CURS"]));
|
||||
ocifetchinto($data["CURS"], $subdata, OCI_ASSOC);
|
||||
var_dump($subdata);
|
||||
var_dump(ocicancel($data["CURS"]));
|
||||
}
|
||||
|
||||
require dirname(__FILE__)."/drop_table.inc";
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
bool(true)
|
||||
|
||||
Warning: ocifetchinto():%sORA-01002: fetch out of sequence in %scursors_old.php on line %d
|
||||
array(2) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
bool(true)
|
||||
Done
|
36
ext/oci8/tests/debug.phpt
Normal file
36
ext/oci8/tests/debug.phpt
Normal file
@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
oci_internal_debug()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
oci_internal_debug(true);
|
||||
|
||||
if (!empty($dbase)) {
|
||||
oci_connect($user, $password, $dbase);
|
||||
}
|
||||
else {
|
||||
oci_connect($user, $password);
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
OCI8 DEBUG: OCINlsEnvironmentVariableGet in php_oci_do_connect_ex() (%s/oci8.c:%d)
|
||||
Done
|
||||
OCI8 DEBUG: OCISessionEnd in php_oci_connection_close() (%s/oci8.c:%d)
|
||||
OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d)
|
||||
OCI8 DEBUG: OCIServerDetach in php_oci_connection_close() (%s/oci8.c:%d)
|
||||
OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d)
|
||||
OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d)
|
||||
OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d)
|
||||
OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d)
|
55
ext/oci8/tests/default_prefetch.phpt
Normal file
55
ext/oci8/tests/default_prefetch.phpt
Normal file
@ -0,0 +1,55 @@
|
||||
--TEST--
|
||||
oci8.default_prefetch ini option
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--INI--
|
||||
oci8.default_prefetch=20
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema.$table_name."";
|
||||
|
||||
if (!($s = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
|
||||
var_dump(oci_fetch($s));
|
||||
|
||||
var_dump(oci_num_rows($s));
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
int(1)
|
||||
Done
|
55
ext/oci8/tests/default_prefetch1.phpt
Normal file
55
ext/oci8/tests/default_prefetch1.phpt
Normal file
@ -0,0 +1,55 @@
|
||||
--TEST--
|
||||
oci8.default_prefetch ini option
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--INI--
|
||||
oci8.default_prefetch=100
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema.$table_name."";
|
||||
|
||||
if (!($s = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
|
||||
var_dump(oci_fetch($s));
|
||||
|
||||
var_dump(oci_num_rows($s));
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
int(1)
|
||||
Done
|
58
ext/oci8/tests/default_prefetch2.phpt
Normal file
58
ext/oci8/tests/default_prefetch2.phpt
Normal file
@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
oci8.default_prefetch ini option
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--INI--
|
||||
oci8.default_prefetch=100
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema.$table_name."";
|
||||
|
||||
if (!($s = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
var_dump(oci_set_prefetch($s, 10));
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
|
||||
var_dump(oci_fetch($s));
|
||||
|
||||
var_dump(oci_num_rows($s));
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
int(1)
|
||||
Done
|
46
ext/oci8/tests/define.phpt
Normal file
46
ext/oci8/tests/define.phpt
Normal file
@ -0,0 +1,46 @@
|
||||
--TEST--
|
||||
oci_define_by_name()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_table.inc";
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (string) VALUES ('some')";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
|
||||
$stmt = oci_parse($c, "SELECT string FROM ".$table_name."");
|
||||
|
||||
/* the define MUST be done BEFORE ociexecute! */
|
||||
|
||||
$strong = '';
|
||||
oci_define_by_name($stmt, "STRING", $string, 20);
|
||||
|
||||
oci_execute($stmt);
|
||||
|
||||
while (oci_fetch($stmt)) {
|
||||
var_dump($string);
|
||||
}
|
||||
|
||||
require dirname(__FILE__)."/drop_table.inc";
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(4) "some"
|
||||
Done
|
46
ext/oci8/tests/define_old.phpt
Normal file
46
ext/oci8/tests/define_old.phpt
Normal file
@ -0,0 +1,46 @@
|
||||
--TEST--
|
||||
ocidefinebyname()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_table.inc";
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (string) VALUES ('some')";
|
||||
|
||||
if (!($s = ociparse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
if (!ociexecute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
|
||||
$stmt = ociparse($c, "SELECT string FROM ".$table_name."");
|
||||
|
||||
/* the define MUST be done BEFORE ociexecute! */
|
||||
|
||||
$strong = '';
|
||||
ocidefinebyname($stmt, "STRING", $string, 20);
|
||||
|
||||
ociexecute($stmt);
|
||||
|
||||
while (ocifetch($stmt)) {
|
||||
var_dump($string);
|
||||
}
|
||||
|
||||
require dirname(__FILE__)."/drop_table.inc";
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(4) "some"
|
||||
Done
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
if ($connection) {
|
||||
if ($c) {
|
||||
$ora_sql = "DROP TABLE
|
||||
".$schema."php_test_table
|
||||
".$schema.$table_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($connection,$ora_sql);
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
}
|
||||
|
||||
|
12
ext/oci8/tests/drop_type.inc
Normal file
12
ext/oci8/tests/drop_type.inc
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
if ($c) {
|
||||
$ora_sql = "DROP TYPE
|
||||
".$type_name."
|
||||
";
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
}
|
||||
|
||||
?>
|
45
ext/oci8/tests/error.phpt
Normal file
45
ext/oci8/tests/error.phpt
Normal file
@ -0,0 +1,45 @@
|
||||
--TEST--
|
||||
oci_error()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
if (!empty($dbase)) {
|
||||
var_dump(oci_connect($user, $password, $dbase));
|
||||
}
|
||||
else {
|
||||
var_dump(oci_connect($user, $password));
|
||||
}
|
||||
|
||||
var_dump($s = oci_parse($c, "WRONG SYNTAX"));
|
||||
var_dump(oci_execute($s));
|
||||
var_dump(oci_error($s));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%s) of type (oci8 connection)
|
||||
resource(%s) of type (oci8 statement)
|
||||
|
||||
Warning: oci_execute(): ORA-00900: invalid SQL statement in %s on line %d
|
||||
bool(false)
|
||||
array(4) {
|
||||
["code"]=>
|
||||
int(900)
|
||||
["message"]=>
|
||||
string(32) "ORA-00900: invalid SQL statement"
|
||||
["offset"]=>
|
||||
int(0)
|
||||
["sqltext"]=>
|
||||
string(12) "WRONG SYNTAX"
|
||||
}
|
||||
Done
|
23
ext/oci8/tests/error1.phpt
Normal file
23
ext/oci8/tests/error1.phpt
Normal file
@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
oci_error() when oci_connect() fails
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(oci_connect("some", "some", "some"));
|
||||
var_dump(oci_error());
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
Done
|
45
ext/oci8/tests/error_old.phpt
Normal file
45
ext/oci8/tests/error_old.phpt
Normal file
@ -0,0 +1,45 @@
|
||||
--TEST--
|
||||
ocierror()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
|
||||
if (!empty($dbase)) {
|
||||
var_dump(ocilogon($user, $password, $dbase));
|
||||
}
|
||||
else {
|
||||
var_dump(ocilogon($user, $password));
|
||||
}
|
||||
|
||||
var_dump($s = ociparse($c, "WRONG SYNTAX"));
|
||||
var_dump(ociexecute($s));
|
||||
var_dump(ocierror($s));
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%s) of type (oci8 connection)
|
||||
resource(%s) of type (oci8 statement)
|
||||
|
||||
Warning: ociexecute(): ORA-00900: invalid SQL statement in %s on line %d
|
||||
bool(false)
|
||||
array(4) {
|
||||
["code"]=>
|
||||
int(900)
|
||||
["message"]=>
|
||||
string(32) "ORA-00900: invalid SQL statement"
|
||||
["offset"]=>
|
||||
int(0)
|
||||
["sqltext"]=>
|
||||
string(12) "WRONG SYNTAX"
|
||||
}
|
||||
Done
|
24
ext/oci8/tests/exec_fetch.phpt
Normal file
24
ext/oci8/tests/exec_fetch.phpt
Normal file
@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
fetch after failed oci_execute()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$sql = "select 2 from nonex_dual";
|
||||
$stmt = oci_parse($c, $sql);
|
||||
|
||||
var_dump(oci_execute($stmt));
|
||||
var_dump(oci_fetch_array($stmt));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Done
|
61
ext/oci8/tests/fetch.phpt
Normal file
61
ext/oci8/tests/fetch.phpt
Normal file
@ -0,0 +1,61 @@
|
||||
--TEST--
|
||||
ocifetch() & ociresult()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema.$table_name."";
|
||||
|
||||
if (!($s = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
|
||||
while(ocifetch($s)) {
|
||||
$i = 1;
|
||||
while ($row = ociresult($s, $i)) {
|
||||
$i++;
|
||||
var_dump($row);
|
||||
}
|
||||
}
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
Done
|
154
ext/oci8/tests/fetch_all.phpt
Normal file
154
ext/oci8/tests/fetch_all.phpt
Normal file
@ -0,0 +1,154 @@
|
||||
--TEST--
|
||||
oci_fetch_all()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
|
||||
|
||||
if (!($s = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
/* oci_fetch_all */
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
var_dump(oci_fetch_all($s, $all));
|
||||
var_dump($all);
|
||||
|
||||
/* ocifetchstatement */
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
|
||||
var_dump(ocifetchstatement($s, $all));
|
||||
var_dump($all);
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
int(3)
|
||||
array(5) {
|
||||
["ID"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
string(1) "1"
|
||||
}
|
||||
["VALUE"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
string(1) "1"
|
||||
}
|
||||
["BLOB"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
NULL
|
||||
[2]=>
|
||||
NULL
|
||||
}
|
||||
["CLOB"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
NULL
|
||||
[2]=>
|
||||
NULL
|
||||
}
|
||||
["STRING"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
NULL
|
||||
[2]=>
|
||||
NULL
|
||||
}
|
||||
}
|
||||
int(3)
|
||||
array(5) {
|
||||
["ID"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
string(1) "1"
|
||||
}
|
||||
["VALUE"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
string(1) "1"
|
||||
}
|
||||
["BLOB"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
NULL
|
||||
[2]=>
|
||||
NULL
|
||||
}
|
||||
["CLOB"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
NULL
|
||||
[2]=>
|
||||
NULL
|
||||
}
|
||||
["STRING"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
NULL
|
||||
[2]=>
|
||||
NULL
|
||||
}
|
||||
}
|
||||
Done
|
235
ext/oci8/tests/fetch_array.phpt
Normal file
235
ext/oci8/tests/fetch_array.phpt
Normal file
@ -0,0 +1,235 @@
|
||||
--TEST--
|
||||
oci_fetch_array()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
|
||||
|
||||
if (!($s = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
while ($row = oci_fetch_array($s)) {
|
||||
var_dump($row);
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
while ($row = oci_fetch_array($s, OCI_NUM)) {
|
||||
var_dump($row);
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
while ($row = oci_fetch_array($s, OCI_ASSOC)) {
|
||||
var_dump($row);
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
while ($row = oci_fetch_array($s, OCI_BOTH)) {
|
||||
var_dump($row);
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
while ($row = oci_fetch_array($s, OCI_RETURN_LOBS)) {
|
||||
var_dump($row);
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
while ($row = oci_fetch_array($s, OCI_RETURN_NULLS)) {
|
||||
var_dump($row);
|
||||
}
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(2) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(2) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(2) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
[4]=>
|
||||
NULL
|
||||
}
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
[4]=>
|
||||
NULL
|
||||
}
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
[4]=>
|
||||
NULL
|
||||
}
|
||||
Done
|
69
ext/oci8/tests/fetch_assoc.phpt
Normal file
69
ext/oci8/tests/fetch_assoc.phpt
Normal file
@ -0,0 +1,69 @@
|
||||
--TEST--
|
||||
oci_fetch_assoc()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
|
||||
|
||||
if (!($s = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
while ($row = oci_fetch_assoc($s)) {
|
||||
var_dump($row);
|
||||
}
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(2) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(2) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
Done
|
87
ext/oci8/tests/fetch_into.phpt
Normal file
87
ext/oci8/tests/fetch_into.phpt
Normal file
@ -0,0 +1,87 @@
|
||||
--TEST--
|
||||
ocifetchinto()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
|
||||
|
||||
if (!($s = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
/* oci_fetch_all */
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
var_dump(ocifetchinto($s, $all));
|
||||
var_dump($all);
|
||||
|
||||
/* oci_fetch_all */
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
|
||||
var_dump($all);
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
int(5)
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
int(5)
|
||||
array(10) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
NULL
|
||||
["BLOB"]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
["CLOB"]=>
|
||||
NULL
|
||||
[4]=>
|
||||
NULL
|
||||
["STRING"]=>
|
||||
NULL
|
||||
}
|
||||
Done
|
197
ext/oci8/tests/fetch_into1.phpt
Normal file
197
ext/oci8/tests/fetch_into1.phpt
Normal file
@ -0,0 +1,197 @@
|
||||
--TEST--
|
||||
various ocifetchinto() tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value, string) VALUES (1, 1, NULL)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<20; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
|
||||
|
||||
if (!($s = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
var_dump(ocifetchinto($s, $all, OCI_NUM));
|
||||
var_dump($all);
|
||||
var_dump(ocifetchinto($s, $all, OCI_ASSOC));
|
||||
var_dump($all);
|
||||
var_dump(ocifetchinto($s, $all, OCI_RETURN_NULLS));
|
||||
var_dump($all);
|
||||
var_dump(ocifetchinto($s, $all, OCI_RETURN_LOBS));
|
||||
var_dump($all);
|
||||
var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC));
|
||||
var_dump($all);
|
||||
var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS));
|
||||
var_dump($all);
|
||||
var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
|
||||
var_dump($all);
|
||||
var_dump(ocifetchinto($s, $all, OCI_RETURN_NULLS+OCI_RETURN_LOBS));
|
||||
var_dump($all);
|
||||
var_dump(ocifetchinto($s, $all, OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
|
||||
var_dump($all);
|
||||
var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
|
||||
var_dump($all);
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
int(5)
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
int(5)
|
||||
array(2) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
int(5)
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
[4]=>
|
||||
NULL
|
||||
}
|
||||
int(5)
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
int(5)
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
int(5)
|
||||
array(10) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
NULL
|
||||
["BLOB"]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
["CLOB"]=>
|
||||
NULL
|
||||
[4]=>
|
||||
NULL
|
||||
["STRING"]=>
|
||||
NULL
|
||||
}
|
||||
int(5)
|
||||
array(10) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
NULL
|
||||
["BLOB"]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
["CLOB"]=>
|
||||
NULL
|
||||
[4]=>
|
||||
NULL
|
||||
["STRING"]=>
|
||||
NULL
|
||||
}
|
||||
int(5)
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
[4]=>
|
||||
NULL
|
||||
}
|
||||
int(5)
|
||||
array(5) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
["BLOB"]=>
|
||||
NULL
|
||||
["CLOB"]=>
|
||||
NULL
|
||||
["STRING"]=>
|
||||
NULL
|
||||
}
|
||||
int(5)
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
[4]=>
|
||||
NULL
|
||||
}
|
||||
Done
|
75
ext/oci8/tests/fetch_into2.phpt
Normal file
75
ext/oci8/tests/fetch_into2.phpt
Normal file
@ -0,0 +1,75 @@
|
||||
--TEST--
|
||||
ocifetchinto() & wrong number of params
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value, string) VALUES (1, 1, NULL)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<20; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
|
||||
|
||||
if (!($s = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
var_dump(ocifetchinto($s));
|
||||
var_dump($all);
|
||||
var_dump(ocifetchinto($s, $all, OCI_ASSOC, 5));
|
||||
var_dump($all);
|
||||
var_dump(ocifetchinto($c, $all, OCI_RETURN_LOBS));
|
||||
var_dump($all);
|
||||
var_dump(ocifetchinto($s, $all, 1000000));
|
||||
var_dump($all);
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ocifetchinto() expects at least 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Undefined variable: all in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: ocifetchinto() expects at most 3 parameters, 4 given in %s on line %d
|
||||
NULL
|
||||
NULL
|
||||
|
||||
Warning: ocifetchinto(): supplied resource is not a valid oci8 statement resource in %s on line %d
|
||||
bool(false)
|
||||
NULL
|
||||
int(5)
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
Done
|
69
ext/oci8/tests/fetch_object.phpt
Normal file
69
ext/oci8/tests/fetch_object.phpt
Normal file
@ -0,0 +1,69 @@
|
||||
--TEST--
|
||||
oci_fetch_object()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
|
||||
|
||||
if (!($s = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
while ($row = oci_fetch_object($s)) {
|
||||
var_dump($row);
|
||||
}
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(stdClass)#1 (2) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
object(stdClass)#2 (2) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
object(stdClass)#1 (2) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["VALUE"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
Done
|
69
ext/oci8/tests/fetch_row.phpt
Normal file
69
ext/oci8/tests/fetch_row.phpt
Normal file
@ -0,0 +1,69 @@
|
||||
--TEST--
|
||||
oci_fetch_row()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
|
||||
|
||||
if (!($s = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
while ($row = oci_fetch_row($s)) {
|
||||
var_dump($row);
|
||||
}
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
}
|
||||
Done
|
110
ext/oci8/tests/field_funcs.phpt
Normal file
110
ext/oci8/tests/field_funcs.phpt
Normal file
@ -0,0 +1,110 @@
|
||||
--TEST--
|
||||
oci_field_*() family
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!oci_commit($c)) {
|
||||
die("oci_commit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
|
||||
|
||||
if (!($s = oci_parse($c, $select_sql))) {
|
||||
die("oci_parse(select) failed!\n");
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(select) failed!\n");
|
||||
}
|
||||
|
||||
$row = oci_fetch_array($s, OCI_RETURN_NULLS + OCI_RETURN_LOBS);
|
||||
var_dump($row);
|
||||
|
||||
foreach ($row as $num => $field) {
|
||||
$num++;
|
||||
var_dump(oci_field_is_null($s, $num));
|
||||
var_dump(oci_field_name($s, $num));
|
||||
var_dump(oci_field_type($s, $num));
|
||||
var_dump(oci_field_type_raw($s, $num));
|
||||
var_dump(oci_field_scale($s, $num));
|
||||
var_dump(oci_field_precision($s, $num));
|
||||
var_dump(oci_field_size($s, $num));
|
||||
}
|
||||
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
[4]=>
|
||||
NULL
|
||||
}
|
||||
bool(false)
|
||||
string(2) "ID"
|
||||
string(6) "NUMBER"
|
||||
int(2)
|
||||
int(0)
|
||||
int(0)
|
||||
int(22)
|
||||
bool(false)
|
||||
string(5) "VALUE"
|
||||
string(6) "NUMBER"
|
||||
int(2)
|
||||
int(0)
|
||||
int(0)
|
||||
int(22)
|
||||
bool(true)
|
||||
string(4) "BLOB"
|
||||
string(4) "BLOB"
|
||||
int(113)
|
||||
int(0)
|
||||
int(0)
|
||||
int(4000)
|
||||
bool(true)
|
||||
string(4) "CLOB"
|
||||
string(4) "CLOB"
|
||||
int(112)
|
||||
int(0)
|
||||
int(0)
|
||||
int(4000)
|
||||
bool(true)
|
||||
string(6) "STRING"
|
||||
string(7) "VARCHAR"
|
||||
int(1)
|
||||
int(0)
|
||||
int(0)
|
||||
int(10)
|
||||
Done
|
110
ext/oci8/tests/field_funcs_old.phpt
Normal file
110
ext/oci8/tests/field_funcs_old.phpt
Normal file
@ -0,0 +1,110 @@
|
||||
--TEST--
|
||||
ocicolumn*() family
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
|
||||
|
||||
if (!($s = ociparse($c, $insert_sql))) {
|
||||
die("ociparse(insert) failed!\n");
|
||||
}
|
||||
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
if (!ociexecute($s)) {
|
||||
die("ociexecute(insert) failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!ocicommit($c)) {
|
||||
die("ocicommit() failed!\n");
|
||||
}
|
||||
|
||||
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
|
||||
|
||||
if (!($s = ociparse($c, $select_sql))) {
|
||||
die("ociparse(select) failed!\n");
|
||||
}
|
||||
|
||||
if (!ociexecute($s)) {
|
||||
die("ociexecute(select) failed!\n");
|
||||
}
|
||||
|
||||
ocifetchinto($s, $row, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
|
||||
var_dump($row);
|
||||
|
||||
foreach ($row as $num => $field) {
|
||||
$num++;
|
||||
var_dump(ocicolumnisnull($s, $num));
|
||||
var_dump(ocicolumnname($s, $num));
|
||||
var_dump(ocicolumntype($s, $num));
|
||||
var_dump(ocicolumntyperaw($s, $num));
|
||||
var_dump(ocicolumnscale($s, $num));
|
||||
var_dump(ocicolumnprecision($s, $num));
|
||||
var_dump(ocicolumnsize($s, $num));
|
||||
}
|
||||
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(1) "1"
|
||||
[2]=>
|
||||
NULL
|
||||
[3]=>
|
||||
NULL
|
||||
[4]=>
|
||||
NULL
|
||||
}
|
||||
bool(false)
|
||||
string(2) "ID"
|
||||
string(6) "NUMBER"
|
||||
int(2)
|
||||
int(0)
|
||||
int(0)
|
||||
int(22)
|
||||
bool(false)
|
||||
string(5) "VALUE"
|
||||
string(6) "NUMBER"
|
||||
int(2)
|
||||
int(0)
|
||||
int(0)
|
||||
int(22)
|
||||
bool(true)
|
||||
string(4) "BLOB"
|
||||
string(4) "BLOB"
|
||||
int(113)
|
||||
int(0)
|
||||
int(0)
|
||||
int(4000)
|
||||
bool(true)
|
||||
string(4) "CLOB"
|
||||
string(4) "CLOB"
|
||||
int(112)
|
||||
int(0)
|
||||
int(0)
|
||||
int(4000)
|
||||
bool(true)
|
||||
string(6) "STRING"
|
||||
string(7) "VARCHAR"
|
||||
int(1)
|
||||
int(0)
|
||||
int(0)
|
||||
int(10)
|
||||
Done
|
BIN
ext/oci8/tests/lob_001.phpt
Normal file
BIN
ext/oci8/tests/lob_001.phpt
Normal file
Binary file not shown.
71
ext/oci8/tests/lob_002.phpt
Normal file
71
ext/oci8/tests/lob_002.phpt
Normal file
@ -0,0 +1,71 @@
|
||||
--TEST--
|
||||
oci_lob_write() and friends (with errors)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (blob)
|
||||
VALUES (empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
var_dump($blob);
|
||||
|
||||
var_dump($blob->write("test", -1));
|
||||
var_dump($blob->write("test", "str"));
|
||||
var_dump($blob->write("test", 1000000));
|
||||
var_dump($blob->write(str_repeat("test", 10000), 1000000));
|
||||
var_dump($blob->tell());
|
||||
var_dump($blob->seek("str", -5));
|
||||
var_dump($blob->flush());
|
||||
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name."";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s);
|
||||
|
||||
$row = oci_fetch_array($s, OCI_RETURN_LOBS);
|
||||
|
||||
var_dump(strlen($row[0]));
|
||||
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
int(0)
|
||||
|
||||
Warning: OCI-Lob::write() expects parameter 2 to be long, string given in %slob_002.php on line %d
|
||||
NULL
|
||||
int(4)
|
||||
int(40000)
|
||||
int(40004)
|
||||
|
||||
Warning: OCI-Lob::seek() expects parameter 1 to be long, string given in %slob_002.php on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
int(40004)
|
||||
Done
|
BIN
ext/oci8/tests/lob_003.phpt
Normal file
BIN
ext/oci8/tests/lob_003.phpt
Normal file
Binary file not shown.
85
ext/oci8/tests/lob_004.phpt
Normal file
85
ext/oci8/tests/lob_004.phpt
Normal file
@ -0,0 +1,85 @@
|
||||
--TEST--
|
||||
oci_lob_seek()/rewind()/append()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (blob)
|
||||
VALUES (empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
var_dump($blob);
|
||||
|
||||
var_dump($blob->write("test"));
|
||||
var_dump($blob->rewind());
|
||||
var_dump($blob->write("str"));
|
||||
var_dump($blob->seek(10, OCI_SEEK_SET));
|
||||
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
var_dump($row = oci_fetch_array($s));
|
||||
|
||||
var_dump($row[0]->append($blob));
|
||||
var_dump($row[0]->read(10000));
|
||||
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
$row = oci_fetch_array($s);
|
||||
|
||||
var_dump($row[0]->read(10000));
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
int(4)
|
||||
bool(true)
|
||||
int(3)
|
||||
bool(true)
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
["BLOB"]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
string(4) "strt"
|
||||
string(8) "strtstrt"
|
||||
Done
|
57
ext/oci8/tests/lob_005.phpt
Normal file
57
ext/oci8/tests/lob_005.phpt
Normal file
@ -0,0 +1,57 @@
|
||||
--TEST--
|
||||
oci_lob_is_equal()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (blob)
|
||||
VALUES (empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
var_dump($row = oci_fetch_array($s));
|
||||
|
||||
var_dump(oci_lob_is_equal($row[0], $row['BLOB']));
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
["BLOB"]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
Done
|
BIN
ext/oci8/tests/lob_006.phpt
Normal file
BIN
ext/oci8/tests/lob_006.phpt
Normal file
Binary file not shown.
71
ext/oci8/tests/lob_007.phpt
Normal file
71
ext/oci8/tests/lob_007.phpt
Normal file
@ -0,0 +1,71 @@
|
||||
--TEST--
|
||||
oci_lob_write()/size()/load()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (blob)
|
||||
VALUES (empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
var_dump($blob);
|
||||
|
||||
var_dump($blob->size());
|
||||
var_dump($blob->write(str_repeat("string.", 1000)));
|
||||
var_dump($blob->size());
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
var_dump($row = oci_fetch_array($s));
|
||||
|
||||
var_dump($row[0]->size());
|
||||
var_dump(strlen($row[0]->load()));
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
int(0)
|
||||
int(7000)
|
||||
int(7000)
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
["BLOB"]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
}
|
||||
int(7000)
|
||||
int(7000)
|
||||
Done
|
70
ext/oci8/tests/lob_008.phpt
Normal file
70
ext/oci8/tests/lob_008.phpt
Normal file
@ -0,0 +1,70 @@
|
||||
--TEST--
|
||||
oci_lob_write()/read()/eof()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (blob)
|
||||
VALUES (empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
var_dump($blob);
|
||||
|
||||
var_dump($blob->write(str_repeat("string.", 1000)));
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
var_dump($row = oci_fetch_array($s));
|
||||
|
||||
|
||||
$len = 0;
|
||||
while (!$row[0]->eof()) {
|
||||
$len += strlen($row[0]->read(1024));
|
||||
}
|
||||
var_dump($len);
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
int(7000)
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
["BLOB"]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
}
|
||||
int(7000)
|
||||
Done
|
74
ext/oci8/tests/lob_009.phpt
Normal file
74
ext/oci8/tests/lob_009.phpt
Normal file
@ -0,0 +1,74 @@
|
||||
--TEST--
|
||||
oci_lob_import()/read()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (blob)
|
||||
VALUES (empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
var_dump($blob);
|
||||
var_dump($blob->seek(10, OCI_SEEK_CUR));
|
||||
var_dump($blob->import(dirname(__FILE__)."/lob_009.txt"));
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
var_dump($row = oci_fetch_array($s));
|
||||
|
||||
while (!$row[0]->eof()) {
|
||||
var_dump($row[0]->read(1024));
|
||||
}
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
bool(true)
|
||||
bool(true)
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
["BLOB"]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
}
|
||||
string(43) "this
|
||||
is
|
||||
a
|
||||
test
|
||||
file for
|
||||
test lob_009.phpt
|
||||
"
|
||||
Done
|
6
ext/oci8/tests/lob_009.txt
Normal file
6
ext/oci8/tests/lob_009.txt
Normal file
@ -0,0 +1,6 @@
|
||||
this
|
||||
is
|
||||
a
|
||||
test
|
||||
file for
|
||||
test lob_009.phpt
|
51
ext/oci8/tests/lob_010.phpt
Normal file
51
ext/oci8/tests/lob_010.phpt
Normal file
@ -0,0 +1,51 @@
|
||||
--TEST--
|
||||
oci_lob_save()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (blob)
|
||||
VALUES (empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
var_dump($blob->save("string"));
|
||||
var_dump($blob->save("string", 3));
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
$row = oci_fetch_array($s);
|
||||
|
||||
while (!$row[0]->eof()) {
|
||||
var_dump($row[0]->read(1024));
|
||||
}
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(9) "strstring"
|
||||
Done
|
81
ext/oci8/tests/lob_011.phpt
Normal file
81
ext/oci8/tests/lob_011.phpt
Normal file
@ -0,0 +1,81 @@
|
||||
--TEST--
|
||||
oci_lob_copy()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--ENV--
|
||||
return "
|
||||
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
|
||||
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
|
||||
";
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (id, blob)
|
||||
VALUES (1, empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
var_dump($blob->write("some string here. string, I said"));
|
||||
oci_commit($c);
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (id, blob)
|
||||
VALUES (2, empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 1";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s);
|
||||
|
||||
$row1 = oci_fetch_array($s);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 2 FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
$row2 = oci_fetch_array($s);
|
||||
|
||||
var_dump(oci_lob_copy($row2[0], $row1[0]));
|
||||
var_dump($row1[0]->read(100));
|
||||
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 2 FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
var_dump($row2 = oci_fetch_array($s, OCI_RETURN_LOBS));
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(32)
|
||||
bool(true)
|
||||
string(32) "some string here. string, I said"
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(32) "some string here. string, I said"
|
||||
}
|
||||
Done
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user