summaryrefslogtreecommitdiff
path: root/ext/oci8
diff options
context:
space:
mode:
Diffstat (limited to 'ext/oci8')
-rw-r--r--ext/oci8/config.m44
-rw-r--r--ext/oci8/oci8.c43
-rw-r--r--ext/oci8/oci8_collection.c26
-rw-r--r--ext/oci8/oci8_interface.c30
-rw-r--r--ext/oci8/oci8_lob.c58
-rw-r--r--ext/oci8/oci8_statement.c210
-rw-r--r--ext/oci8/package.xml118
-rw-r--r--ext/oci8/package2.xml375
-rw-r--r--ext/oci8/php_oci8.h4
-rw-r--r--ext/oci8/php_oci8_int.h94
-rw-r--r--ext/oci8/tests/array_bind_005.phpt1
-rw-r--r--ext/oci8/tests/array_bind_013.phpt2
-rw-r--r--ext/oci8/tests/array_bind_014.phpt73
-rw-r--r--ext/oci8/tests/array_bind_int1.phpt2
-rw-r--r--ext/oci8/tests/bind_empty.phpt69
-rw-r--r--ext/oci8/tests/bug40078.phpt55
-rw-r--r--ext/oci8/tests/bug40415.phpt200
-rw-r--r--ext/oci8/tests/coll_018.phpt93
-rw-r--r--ext/oci8/tests/coll_019.phpt104
-rw-r--r--ext/oci8/tests/connect.inc9
-rw-r--r--ext/oci8/tests/connect_without_oracle_home.phpt7
-rw-r--r--ext/oci8/tests/connect_without_oracle_home_old.phpt6
-rw-r--r--ext/oci8/tests/define2.phpt87
-rw-r--r--ext/oci8/tests/define3.phpt105
-rw-r--r--ext/oci8/tests/define4.phpt67
-rw-r--r--ext/oci8/tests/define5.phpt64
-rw-r--r--ext/oci8/tests/details.inc16
-rw-r--r--ext/oci8/tests/error2.phpt24
-rw-r--r--ext/oci8/tests/fetch_all2.phpt242
-rw-r--r--ext/oci8/tests/fetch_all3.phpt577
-rw-r--r--ext/oci8/tests/function_aliases.phpt198
-rw-r--r--ext/oci8/tests/lob_020.phptbin1597 -> 3076 bytes
-rw-r--r--ext/oci8/tests/lob_027.phpt103
-rw-r--r--ext/oci8/tests/lob_028.phpt84
-rw-r--r--ext/oci8/tests/lob_029.phpt119
-rw-r--r--ext/oci8/tests/lob_030.phpt75
-rw-r--r--ext/oci8/tests/lob_031.phpt107
-rw-r--r--ext/oci8/tests/lob_032.phpt33
-rw-r--r--ext/oci8/tests/lob_033.phpt38
-rw-r--r--ext/oci8/tests/lob_034.phpt50
-rw-r--r--ext/oci8/tests/lob_035.phpt108
-rw-r--r--ext/oci8/tests/lob_036.phpt40
-rw-r--r--ext/oci8/tests/lob_037.phpt68
-rw-r--r--ext/oci8/tests/lob_038.phpt189
-rw-r--r--ext/oci8/tests/lob_039.phpt65
-rw-r--r--ext/oci8/tests/lob_aliases.phpt99
-rw-r--r--ext/oci8/tests/num.phpt171
-rw-r--r--ext/oci8/tests/oci_execute_segfault.phpt36
-rw-r--r--ext/oci8/tests/pecl_bug10194.phpt47
-rw-r--r--ext/oci8/tests/pecl_bug10194_blob.phpt47
-rw-r--r--ext/oci8/tests/privileged_connect1.phpt4
-rw-r--r--ext/oci8/tests/statement_type.phpt32
-rw-r--r--ext/oci8/tests/statement_type_old.phpt24
53 files changed, 4277 insertions, 225 deletions
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4
index ca334de82..36feaf4e3 100644
--- a/ext/oci8/config.m4
+++ b/ext/oci8/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.55.2.3.2.3 2006/09/18 21:23:42 tony2001 Exp $
+dnl $Id: config.m4,v 1.55.2.3.2.4 2007/02/12 09:36:23 tony2001 Exp $
dnl
if test -z "$SED"; then
@@ -99,7 +99,7 @@ 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])
+ to use an Oracle Instant Client installation])
AC_MSG_CHECKING([checking PHP version])
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 450b9753d..d34ecf7cd 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -26,7 +26,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8.c,v 1.269.2.16.2.25 2006/10/18 14:23:23 tony2001 Exp $ */
+/* $Id: oci8.c,v 1.269.2.16.2.32 2007/02/24 02:17:25 helly Exp $ */
/* TODO
*
* file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty() with OCI_ATTR_LOBEMPTY
@@ -89,7 +89,9 @@ static void php_oci_connection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC);
static void php_oci_pconnection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC);
static void php_oci_statement_list_dtor (zend_rsrc_list_entry * TSRMLS_DC);
static void php_oci_descriptor_list_dtor (zend_rsrc_list_entry * TSRMLS_DC);
+#ifdef PHP_OCI8_HAVE_COLLECTIONS
static void php_oci_collection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC);
+#endif
static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC);
#ifdef ZTS
@@ -375,7 +377,7 @@ zend_module_entry oci8_module_entry = {
PHP_RINIT(oci), /* per-request startup function */
PHP_RSHUTDOWN(oci), /* per-request shutdown function */
PHP_MINFO(oci), /* information function */
- "1.2.2",
+ "1.2.3",
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
PHP_MODULE_GLOBALS(oci), /* globals descriptor */
PHP_GINIT(oci), /* globals ctor */
@@ -646,8 +648,12 @@ PHP_RSHUTDOWN_FUNCTION(oci)
{
#ifdef ZTS
zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_descriptor TSRMLS_CC);
+#ifdef PHP_OCI8_HAVE_COLLECTIONS
zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_collection TSRMLS_CC);
- zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_statement TSRMLS_CC);
+#endif
+ while (OCI_G(num_statements)) {
+ zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_statement TSRMLS_CC);
+ }
#endif
/* check persistent connections and do the necessary actions if needed */
@@ -667,12 +673,12 @@ PHP_MINFO_FUNCTION(oci)
php_info_print_table_start();
php_info_print_table_row(2, "OCI8 Support", "enabled");
- php_info_print_table_row(2, "Version", "1.2.2");
- php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.25 $");
+ php_info_print_table_row(2, "Version", "1.2.3");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.32 $");
- sprintf(buf, "%ld", OCI_G(num_persistent));
+ snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
- sprintf(buf, "%ld", OCI_G(num_links));
+ snprintf(buf, sizeof(buf), "%ld", OCI_G(num_links));
php_info_print_table_row(2, "Active Connections", buf);
#if !defined(PHP_WIN32) && !defined(HAVE_OCI_INSTANT_CLIENT)
@@ -681,7 +687,7 @@ PHP_MINFO_FUNCTION(oci)
php_info_print_table_row(2, "Libraries Used", PHP_OCI8_SHARED_LIBADD );
#else
# if defined(HAVE_OCI_INSTANT_CLIENT) && defined(OCI_MAJOR_VERSION) && defined(OCI_MINOR_VERSION)
- sprintf(buf, "%d.%d", OCI_MAJOR_VERSION, OCI_MINOR_VERSION);
+ snprintf(buf, sizeof(buf), "%d.%d", OCI_MAJOR_VERSION, OCI_MINOR_VERSION);
php_info_print_table_row(2, "Oracle Instant Client Version", buf);
# endif
#endif
@@ -740,6 +746,7 @@ static void php_oci_descriptor_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
php_oci_lob_free(descriptor TSRMLS_CC);
} /* }}} */
+#ifdef PHP_OCI8_HAVE_COLLECTIONS
/* {{{ php_oci_collection_list_dtor()
Collection destructor */
static void php_oci_collection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
@@ -747,6 +754,7 @@ static void php_oci_collection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
php_oci_collection *collection = (php_oci_collection *)entry->ptr;
php_oci_collection_close(collection TSRMLS_CC);
} /* }}} */
+#endif
/* }}} */
@@ -776,13 +784,16 @@ void php_oci_bind_hash_dtor(void *data)
if (bind->array.elements) {
efree(bind->array.elements);
}
+
if (bind->array.element_lengths) {
efree(bind->array.element_lengths);
}
-/*
+
if (bind->array.indicators) {
efree(bind->array.indicators);
- }
+ }
+
+/*
if (bind->array.retcodes) {
efree(bind->array.retcodes);
}
@@ -1043,7 +1054,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
size_t rsize = 0;
sword result;
- PHP_OCI_CALL_RETURN(result, OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize))
+ PHP_OCI_CALL_RETURN(result, OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize));
if (result != OCI_SUCCESS) {
charsetid_nls_lang = 0;
}
@@ -1810,13 +1821,13 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC)
static int php_oci_list_helper(zend_rsrc_list_entry *le, void *le_type TSRMLS_DC)
{
int type = (int) le_type;
-
+
if (le->type == type) {
- if (le->ptr != NULL) {
- return 1;
+ if (le->ptr != NULL && --le->refcount<=0) {
+ return ZEND_HASH_APPLY_REMOVE;
}
}
- return 0;
+ return ZEND_HASH_APPLY_KEEP;
} /* }}} */
#endif
diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c
index 127504524..713861e97 100644
--- a/ext/oci8/oci8_collection.c
+++ b/ext/oci8/oci8_collection.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_collection.c,v 1.5.2.3.2.3 2006/08/21 16:41:13 tony2001 Exp $ */
+/* $Id: oci8_collection.c,v 1.5.2.3.2.5 2007/01/01 09:36:03 sebastian Exp $ */
@@ -74,14 +74,14 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
)
);
- if (connection->errcode) {
+ if (connection->errcode != OCI_SUCCESS) {
goto CLEANUP;
}
/* allocate describe handle */
PHP_OCI_CALL_RETURN(connection->errcode, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0));
- if (connection->errcode) {
+ if (connection->errcode != OCI_SUCCESS) {
goto CLEANUP;
}
@@ -99,14 +99,14 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
)
);
- if (connection->errcode) {
+ if (connection->errcode != OCI_SUCCESS) {
goto CLEANUP;
}
/* get first parameter handle */
PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err));
- if (connection->errcode) {
+ if (connection->errcode != OCI_SUCCESS) {
goto CLEANUP;
}
@@ -122,7 +122,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
)
);
- if (connection->errcode) {
+ if (connection->errcode != OCI_SUCCESS) {
goto CLEANUP;
}
@@ -141,7 +141,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
)
);
- if (connection->errcode) {
+ if (connection->errcode != OCI_SUCCESS) {
goto CLEANUP;
}
@@ -157,7 +157,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
)
);
- if (connection->errcode) {
+ if (connection->errcode != OCI_SUCCESS) {
goto CLEANUP;
}
@@ -173,7 +173,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
)
);
- if (connection->errcode) {
+ if (connection->errcode != OCI_SUCCESS) {
goto CLEANUP;
}
@@ -189,13 +189,13 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
)
);
- if (connection->errcode) {
+ if (connection->errcode != OCI_SUCCESS) {
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);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "unknown collection type %d", collection->coll_typecode);
break;
}
@@ -214,7 +214,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
)
);
- if (connection->errcode) {
+ if (connection->errcode != OCI_SUCCESS) {
goto CLEANUP;
}
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index dbbce2290..8a5640e08 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_interface.c,v 1.8.2.7.2.3 2006/08/22 11:09:12 tony2001 Exp $ */
+/* $Id: oci8_interface.c,v 1.8.2.7.2.9 2007/01/11 12:01:08 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -40,6 +40,10 @@
#include "php_oci8.h"
#include "php_oci8_int.h"
+#ifndef OCI_STMT_CALL
+#define OCI_STMT_CALL 10
+#endif
+
/* {{{ proto bool oci_define_by_name(resource stmt, string name, mixed &var [, int type])
Define a PHP variable to an Oracle column by name */
/* if you want to define a LOB/CLOB etc make sure you allocate it via OCINewDescriptor BEFORE defining!!! */
@@ -48,7 +52,7 @@ PHP_FUNCTION(oci_define_by_name)
zval *stmt, *var;
char *name;
int name_len;
- long type = SQLT_CHR;
+ long type = 0;
php_oci_statement *statement;
php_oci_define *define, *tmp_define;
@@ -587,7 +591,8 @@ PHP_FUNCTION(oci_lob_truncate)
{
zval **tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- ub4 trim_length = 0;
+ long trim_length = 0;
+ ub4 ub_trim_length;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &trim_length) == FAILURE) {
@@ -604,10 +609,16 @@ PHP_FUNCTION(oci_lob_truncate)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
+ if (trim_length < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to zero");
+ RETURN_FALSE;
+ }
+
+ ub_trim_length = (ub4) trim_length;
PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
- if (php_oci_lob_truncate(descriptor, trim_length TSRMLS_CC)) {
+ if (php_oci_lob_truncate(descriptor, ub_trim_length TSRMLS_CC)) {
RETURN_FALSE;
}
RETURN_TRUE;
@@ -674,7 +685,7 @@ PHP_FUNCTION(oci_lob_flush)
{
zval **tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- ub4 flush_flag = 0;
+ long flush_flag = 0;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flush_flag) == FAILURE) {
@@ -1549,7 +1560,7 @@ PHP_FUNCTION(oci_error)
php_oci_connection *connection;
text *errbuf;
sb4 errcode = 0;
- sword error = 0;
+ sword error = OCI_SUCCESS;
dvoid *errh = NULL;
#ifdef HAVE_OCI8_ATTR_STATEMENT
ub2 error_offset = 0;
@@ -1840,6 +1851,9 @@ PHP_FUNCTION(oci_statement_type)
case OCI_STMT_DECLARE:
RETVAL_STRING("DECLARE",1);
break;
+ case OCI_STMT_CALL:
+ RETVAL_STRING("CALL",1);
+ break;
default:
RETVAL_STRING("UNKNOWN",1);
}
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index 39c61d87d..e3aa23127 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_lob.c,v 1.7.2.6.2.6 2006/08/22 11:09:12 tony2001 Exp $ */
+/* $Id: oci8_lob.c,v 1.7.2.6.2.11 2007/03/29 09:33:03 tony2001 Exp $ */
@@ -160,7 +160,12 @@ sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece)
switch (piece)
{
case OCI_LAST_PIECE:
- *(ctx->lob_data) = erealloc(*(ctx->lob_data), (size_t) (*(ctx->lob_len) + lenp + 1));
+ if ((*(ctx->lob_len) + lenp) > (ctx->alloc_len)) {
+ /* this should not happen ever */
+ *(ctx->lob_data) = NULL;
+ *(ctx->lob_len) = 0;
+ return OCI_ERROR;
+ }
memcpy(*(ctx->lob_data) + *(ctx->lob_len), bufxp, (size_t) lenp);
*(ctx->lob_len) += lenp;
*(*(ctx->lob_data) + *(ctx->lob_len)) = 0x00;
@@ -168,7 +173,12 @@ sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece)
case OCI_FIRST_PIECE:
case OCI_NEXT_PIECE:
- *(ctx->lob_data) = erealloc(*(ctx->lob_data), (size_t) (*(ctx->lob_len) + lenp));
+ if ((*(ctx->lob_len) + lenp) > ctx->alloc_len) {
+ /* this should not happen ever */
+ *(ctx->lob_data) = NULL;
+ *(ctx->lob_len) = 0;
+ return OCI_ERROR;
+ }
memcpy(*(ctx->lob_data) + *(ctx->lob_len), bufxp, (size_t) lenp);
*(ctx->lob_len) += lenp;
return OCI_CONTINUE;
@@ -176,7 +186,6 @@ sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece)
default: {
TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected LOB piece id received (value:%d)", piece);
- efree(*(ctx->lob_data));
*(ctx->lob_data) = NULL;
*(ctx->lob_len) = 0;
return OCI_ERROR;
@@ -190,7 +199,11 @@ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, l
{
php_oci_connection *connection = descriptor->connection;
ub4 chunk_size;
-
+
+ if (descriptor->type == OCI_DTYPE_FILE) {
+ return read_length;
+ }
+
if (!descriptor->chunk_size) {
PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size));
@@ -222,16 +235,19 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
oraub8 bytes_read, offset = 0;
oraub8 requested_len = read_length; /* this is by default */
oraub8 chars_read = 0;
- int is_clob = 0;
#else
int bytes_read, offset = 0;
int requested_len = read_length; /* this is by default */
#endif
+ int is_clob = 0;
+ sb4 bytes_per_char = 1;
*data_len = 0;
*data = NULL;
+
ctx.lob_len = data_len;
ctx.lob_data = data;
+ ctx.alloc_len = 0;
if (php_oci_lob_get_length(descriptor, &length TSRMLS_CC)) {
return 1;
@@ -268,9 +284,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
- }
-#ifdef HAVE_OCI_LOB_READ2
- else {
+ } else {
ub2 charset_id = 0;
PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id));
@@ -287,6 +301,22 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
}
if (is_clob) {
+ PHP_OCI_CALL_RETURN(connection->errcode, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ));
+
+ if (connection->errcode != OCI_SUCCESS) {
+ php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
+ return 1;
+ }
+ } else {
+ /* BLOBs don't have encoding, so bytes_per_char == 1 */
+ }
+
+ ctx.alloc_len = (requested_len + 1) * bytes_per_char;
+ *data = ecalloc(bytes_per_char, requested_len + 1);
+
+#ifdef HAVE_OCI_LOB_READ2
+ if (is_clob) {
chars_read = requested_len;
bytes_read = 0;
} else {
@@ -493,7 +523,7 @@ int php_oci_lob_get_buffering (php_oci_descriptor *descriptor)
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;
+ ub4 length_dest, length_from, copy_len;
if (php_oci_lob_get_length(descriptor_dest, &length_dest TSRMLS_CC)) {
return 1;
@@ -573,7 +603,7 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
/* {{{ 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)
+int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC)
{
OCILobLocator *lob = descriptor->descriptor;
php_oci_connection *connection = descriptor->connection;
@@ -588,7 +618,7 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, int flush_flag TSRMLS_DC)
/* only these two are allowed */
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid flag value: %d", flush_flag);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid flag value: %ld", flush_flag);
return 1;
break;
}
@@ -760,7 +790,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TS
/* {{{ 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)
+int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index 1d1e2df15..0fabd881a 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_statement.c,v 1.7.2.14.2.13 2006/10/13 14:26:34 tony2001 Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.23 2007/03/01 22:27:44 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
@@ -113,6 +113,8 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
}
PHP_OCI_REGISTER_RESOURCE(statement, le_statement);
+
+ OCI_G(num_statements)++;
return statement;
}
@@ -120,7 +122,7 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
/* {{{ php_oci_statement_set_prefetch()
Set prefetch buffer size for the statement (we're assuming that one row is ~1K sized) */
-int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 size TSRMLS_DC)
+int php_oci_statement_set_prefetch(php_oci_statement *statement, long size TSRMLS_DC)
{
ub4 prefetch = size * 1024;
@@ -312,6 +314,77 @@ php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, l
}
/* }}} */
+/* php_oci_define_callback() {{{ */
+sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **bufpp, ub4 **alenpp, ub1 *piecep, dvoid **indpp, ub2 **rcpp)
+{
+ php_oci_out_column *outcol = (php_oci_out_column *)ctx;
+
+ if (!outcol) {
+ TSRMLS_FETCH();
+
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid context pointer value");
+ return OCI_ERROR;
+ }
+
+ switch(outcol->data_type) {
+ case SQLT_RSET: {
+ php_oci_statement *nested_stmt;
+ TSRMLS_FETCH();
+
+ nested_stmt = php_oci_statement_create(outcol->statement->connection, NULL, 0 TSRMLS_CC);
+ if (!nested_stmt) {
+ return OCI_ERROR;
+ }
+ zend_list_addref(outcol->statement->id);
+ outcol->nested_statement = nested_stmt;
+ outcol->stmtid = nested_stmt->id;
+
+ *bufpp = nested_stmt->stmt;
+ *alenpp = &(outcol->retlen4);
+ *piecep = OCI_ONE_PIECE;
+ *indpp = &(outcol->indicator);
+ *rcpp = &(outcol->retcode);
+ return OCI_CONTINUE;
+ }
+ break;
+ case SQLT_RDD:
+ case SQLT_BLOB:
+ case SQLT_CLOB:
+ case SQLT_BFILE: {
+ php_oci_descriptor *descr;
+ int dtype;
+ TSRMLS_FETCH();
+
+ if (outcol->data_type == SQLT_BFILE) {
+ dtype = OCI_DTYPE_FILE;
+ } else if (outcol->data_type == SQLT_RDD ) {
+ dtype = OCI_DTYPE_ROWID;
+ } else {
+ dtype = OCI_DTYPE_LOB;
+ }
+
+ descr = php_oci_lob_create(outcol->statement->connection, dtype TSRMLS_CC);
+ if (!descr) {
+ return OCI_ERROR;
+ }
+ zend_list_addref(outcol->statement->id);
+ outcol->descid = descr->id;
+ descr->charset_form = outcol->charset_form;
+
+ *bufpp = descr->descriptor;
+ *alenpp = &(outcol->retlen4);
+ *piecep = OCI_ONE_PIECE;
+ *indpp = &(outcol->indicator);
+ *rcpp = &(outcol->retcode);
+
+ return OCI_CONTINUE;
+ }
+ break;
+ }
+ return OCI_ERROR;
+}
+/* }}} */
+
/* {{{ php_oci_statement_execute()
Execute statement */
int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
@@ -325,9 +398,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
ub4 iters;
ub4 colcount;
ub2 dynamic;
- int dtype;
dvoid *buf;
- php_oci_descriptor *descr;
switch (mode) {
case OCI_COMMIT_ON_SUCCESS:
@@ -415,8 +486,6 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
return 1;
}
- outcol->statement = statement;
-
/* get column */
PHP_OCI_CALL_RETURN(statement->errcode, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)&param, counter));
@@ -504,50 +573,35 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
/* find a user-setted define */
if (statement->defines) {
- zend_hash_find(statement->defines,outcol->name,outcol->name_len,(void **) &outcol->define);
+ if (zend_hash_find(statement->defines,outcol->name,outcol->name_len,(void **) &outcol->define) == SUCCESS) {
+ if (outcol->define->type) {
+ outcol->data_type = outcol->define->type;
+ }
+ }
}
buf = 0;
switch (outcol->data_type) {
case SQLT_RSET:
- outcol->statement = php_oci_statement_create(statement->connection, NULL, 0 TSRMLS_CC);
- outcol->stmtid = outcol->statement->id;
- outcol->statement->nested = 1;
+ outcol->statement = statement; /* parent handle */
define_type = SQLT_RSET;
outcol->is_cursor = 1;
outcol->storage_size4 = -1;
outcol->retlen = -1;
- dynamic = OCI_DEFAULT;
- buf = &(outcol->statement->stmt);
+ dynamic = OCI_DYNAMIC_FETCH;
break;
case SQLT_RDD: /* ROWID */
case SQLT_BLOB: /* binary LOB */
case SQLT_CLOB: /* character LOB */
case SQLT_BFILE: /* binary file LOB */
+ outcol->statement = statement; /* parent handle */
+
define_type = outcol->data_type;
outcol->is_descr = 1;
outcol->storage_size4 = -1;
- dynamic = OCI_DEFAULT;
-
- if (outcol->data_type == SQLT_BFILE) {
- dtype = OCI_DTYPE_FILE;
- } else if (outcol->data_type == SQLT_RDD ) {
- dtype = OCI_DTYPE_ROWID;
- } else {
- dtype = OCI_DTYPE_LOB;
- }
-
- descr = php_oci_lob_create(statement->connection, dtype TSRMLS_CC);
- if (!descr) {
- efree(outcol->name);
- return 1;
- }
- outcol->descid = descr->id;
- buf = &(descr->descriptor);
- descr->charset_form = outcol->charset_form;
- /* descr->charset_id = outcol->charset_id; */
+ dynamic = OCI_DYNAMIC_FETCH;
break;
case SQLT_LNG:
@@ -588,7 +642,8 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
outcol->storage_size4 *= 3;
dynamic = OCI_DEFAULT;
- buf = outcol->data = (text *) ecalloc(1, outcol->storage_size4);
+ buf = outcol->data = (text *) safe_emalloc(1, outcol->storage_size4, 0);
+ memset(buf, 0, outcol->storage_size4);
break;
}
@@ -635,6 +690,26 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 0;
}
+
+ /* additional OCIDefineDynamic() call */
+ switch (outcol->data_type) {
+ case SQLT_RSET:
+ case SQLT_RDD:
+ case SQLT_BLOB:
+ case SQLT_CLOB:
+ case SQLT_BFILE:
+ PHP_OCI_CALL_RETURN(statement->errcode,
+ OCIDefineDynamic,
+ (
+ outcol->oci_define,
+ statement->err,
+ (dvoid *)outcol,
+ php_oci_define_callback
+ )
+ );
+
+ break;
+ }
}
}
@@ -694,6 +769,8 @@ void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC)
zend_list_delete(statement->connection->rsrc_id);
efree(statement);
+
+ OCI_G(num_statements)--;
} /* }}} */
/* {{{ php_oci_bind_pre_exec()
@@ -818,7 +895,9 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
Bind zval to the given placeholder */
int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long maxlength, long type TSRMLS_DC)
{
+#ifdef PHP_OCI8_HAVE_COLLECTIONS
php_oci_collection *bind_collection = NULL;
+#endif
php_oci_descriptor *bind_descriptor = NULL;
php_oci_statement *bind_statement = NULL;
dvoid *oci_desc = NULL;
@@ -1085,7 +1164,17 @@ sb4 php_oci_bind_out_callback(
return retval;
}
- if ((Z_TYPE_P(val) == IS_OBJECT) || (Z_TYPE_P(val) == IS_RESOURCE)) {
+ if (Z_TYPE_P(val) == IS_RESOURCE) {
+ retval = OCI_CONTINUE;
+ } else if (Z_TYPE_P(val) == IS_OBJECT) {
+ if (!phpbind->descriptor) {
+ return OCI_ERROR;
+ }
+ *alenpp = &phpbind->dummy_len;
+ *bufpp = phpbind->descriptor;
+ *piecep = OCI_ONE_PIECE;
+ *rcodepp = &phpbind->retcode;
+ *indpp = &phpbind->indicator;
retval = OCI_CONTINUE;
} else {
convert_to_string(val);
@@ -1111,11 +1200,11 @@ sb4 php_oci_bind_out_callback(
Helper function to get column by name and index */
php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data)
{
- zval *z_statement, **column_index;
+ zval *z_statement, *column_index;
php_oci_statement *statement;
php_oci_out_column *column;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rZ", &z_statement, &column_index) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &z_statement, &column_index) == FAILURE) {
return NULL;
}
@@ -1129,19 +1218,25 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME
return NULL;
}
- if (Z_TYPE_PP(column_index) == IS_STRING) {
- column = php_oci_statement_get_column(statement, -1, Z_STRVAL_PP(column_index), Z_STRLEN_PP(column_index) TSRMLS_CC);
+ if (Z_TYPE_P(column_index) == IS_STRING) {
+ column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRLEN_P(column_index) TSRMLS_CC);
if (!column) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%s\"", Z_STRVAL_PP(column_index));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%s\"", Z_STRVAL_P(column_index));
return NULL;
}
} else {
- convert_to_long_ex(column_index);
- column = php_oci_statement_get_column(statement, Z_LVAL_PP(column_index), NULL, 0 TSRMLS_CC);
+ zval tmp;
+ /* NB: for PHP4 compat only, it should be using 'Z' instead */
+ tmp = *column_index;
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ column = php_oci_statement_get_column(statement, Z_LVAL(tmp), NULL, 0 TSRMLS_CC);
if (!column) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%ld\"", Z_LVAL_PP(column_index));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%ld\"", Z_LVAL(tmp));
+ zval_dtor(&tmp);
return NULL;
}
+ zval_dtor(&tmp);
}
return column;
} /* }}} */
@@ -1264,7 +1359,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam
(dvoid *) bindp->array.elements,
(sb4) bind->array.max_length,
type,
- (dvoid *)0, /* bindp->array.indicators, */
+ (dvoid *)bindp->array.indicators,
(ub2 *)bind->array.element_lengths,
(ub2 *)0, /* bindp->array.retcodes, */
(ub4) max_table_length,
@@ -1307,11 +1402,15 @@ php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length,
}
bind = emalloc(sizeof(php_oci_bind));
- bind->array.elements = (text *)ecalloc(1, max_table_length * sizeof(text) * (maxlength + 1));
+ bind->array.elements = (text *)safe_emalloc(max_table_length * (maxlength + 1), sizeof(text), 0);
+ memset(bind->array.elements, 0, max_table_length * (maxlength + 1) * sizeof(text));
bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var));
bind->array.old_length = bind->array.current_length;
bind->array.max_length = maxlength;
- bind->array.element_lengths = ecalloc(1, max_table_length * sizeof(ub2));
+ bind->array.element_lengths = safe_emalloc(max_table_length, sizeof(ub2), 0);
+ memset(bind->array.element_lengths, 0, max_table_length*sizeof(ub2));
+ bind->array.indicators = safe_emalloc(max_table_length, sizeof(sb2), 0);
+ memset(bind->array.indicators, 0, max_table_length*sizeof(sb2));
zend_hash_internal_pointer_reset(hash);
@@ -1319,6 +1418,9 @@ php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length,
if (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) {
convert_to_string_ex(entry);
bind->array.element_lengths[i] = Z_STRLEN_PP(entry);
+ if (Z_STRLEN_PP(entry) == 0) {
+ bind->array.indicators[i] = -1;
+ }
zend_hash_move_forward(hash);
} else {
break;
@@ -1358,11 +1460,13 @@ php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length
hash = HASH_OF(var);
bind = emalloc(sizeof(php_oci_bind));
- bind->array.elements = (ub4 *)emalloc(max_table_length * sizeof(ub4));
+ bind->array.elements = (ub4 *)safe_emalloc(max_table_length, sizeof(ub4), 0);
bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var));
bind->array.old_length = bind->array.current_length;
bind->array.max_length = sizeof(ub4);
- bind->array.element_lengths = ecalloc(1, max_table_length * sizeof(ub2));
+ bind->array.element_lengths = safe_emalloc(max_table_length, sizeof(ub2), 0);
+ memset(bind->array.element_lengths, 0, max_table_length * sizeof(ub2));
+ bind->array.indicators = NULL;
zend_hash_internal_pointer_reset(hash);
for (i = 0; i < max_table_length; i++) {
@@ -1394,11 +1498,13 @@ php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length
hash = HASH_OF(var);
bind = emalloc(sizeof(php_oci_bind));
- bind->array.elements = (double *)emalloc(max_table_length * sizeof(double));
+ bind->array.elements = (double *)safe_emalloc(max_table_length, sizeof(double), 0);
bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var));
bind->array.old_length = bind->array.current_length;
bind->array.max_length = sizeof(double);
- bind->array.element_lengths = ecalloc(1, max_table_length * sizeof(ub2));
+ bind->array.element_lengths = safe_emalloc(max_table_length, sizeof(ub2), 0);
+ memset(bind->array.element_lengths, 0, max_table_length * sizeof(ub2));
+ bind->array.indicators = NULL;
zend_hash_internal_pointer_reset(hash);
for (i = 0; i < max_table_length; i++) {
@@ -1430,11 +1536,13 @@ php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, p
hash = HASH_OF(var);
bind = emalloc(sizeof(php_oci_bind));
- bind->array.elements = (OCIDate *)emalloc(max_table_length * sizeof(OCIDate));
+ bind->array.elements = (OCIDate *)safe_emalloc(max_table_length, sizeof(OCIDate), 0);
bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var));
bind->array.old_length = bind->array.current_length;
bind->array.max_length = sizeof(OCIDate);
- bind->array.element_lengths = ecalloc(1, max_table_length * sizeof(ub2));
+ bind->array.element_lengths = safe_emalloc(max_table_length, sizeof(ub2), 0);
+ memset(bind->array.element_lengths, 0, max_table_length * sizeof(ub2));
+ bind->array.indicators = NULL;
zend_hash_internal_pointer_reset(hash);
for (i = 0; i < max_table_length; i++) {
diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml
index 992b6774a..d449c5899 100644
--- a/ext/oci8/package.xml
+++ b/ext/oci8/package.xml
@@ -30,23 +30,19 @@
<license>PHP</license>
<release>
<state>stable</state>
- <version>1.2.2</version>
- <date>2006-08-24</date>
+ <version>1.2.3</version>
+ <date>2007-01-25</date>
<notes>
- Reimplemented oci_lob_read() utilities using patch from Massimo Squillace (msquillace at sogei dot it), which should fix Unicode LOB problems.
- Fixed bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable)
- Fixed bug #38173 (Freeing nested cursors causes OCI8 to segfault)
- Fixed bug #37886 (oci_connect may crash when charset parameter is given)
- Fixed bug #37931 (possible crash after database restart when using persistent connections)
- Fixed bug #37531 (oci8 persistent connection corruption)
- Fixed bug #37487 (oci_fetch_array() array-type should always default to OCI_BOTH)
- Fixed bug #37392 (Unnecessary call to OCITransRollback() at the end of request)
- Fixed bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
- Fixed bug #34005 (oci_password_change() fails). Patch by pholdaway at technocom-wireless dot com.
- Fixed PECL bug #8112 (Persistent connections misbehave when Apache process times out)
+ Fixed possible segfault in ZTS mode when statements containing sub-statements are destroyed in wrong order.
+ Fixed bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name()).
+ Fixed bug #39988 (type argument of oci_define_by_name() is ignored).
+ Fixed bug #39732 (oci_bind_array_by_name doesn't work on Solaris 64bit).
+ Fixed PECL bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column).
+ Various minor improvements.
</notes>
<deps>
<dep type="php" rel="ge" version="4.3.10"/>
+ <dep type="php" rel="lt" version="6.0.0"/>
</deps>
</release>
<filelist>
@@ -62,10 +58,39 @@
<file role="src" name="oci8_collection.c"/>
<file role="src" name="php_oci8.h"/>
<file role="src" name="php_oci8_int.h"/>
+ <file role="test" name="tests/connect.inc"/>
+ <file role="test" name="tests/create_table.inc"/>
+ <file role="test" name="tests/create_type.inc"/>
+ <file role="test" name="tests/details.inc"/>
+ <file role="test" name="tests/drop_table.inc"/>
+ <file role="test" name="tests/drop_type.inc"/>
+ <file role="test" name="tests/skipif.inc"/>
+ <file role="test" name="tests/array_bind_001.phpt"/>
+ <file role="test" name="tests/array_bind_002.phpt"/>
+ <file role="test" name="tests/array_bind_003.phpt"/>
+ <file role="test" name="tests/array_bind_004.phpt"/>
+ <file role="test" name="tests/array_bind_005.phpt"/>
+ <file role="test" name="tests/array_bind_006.phpt"/>
+ <file role="test" name="tests/array_bind_007.phpt"/>
+ <file role="test" name="tests/array_bind_008.phpt"/>
+ <file role="test" name="tests/array_bind_009.phpt"/>
+ <file role="test" name="tests/array_bind_010.phpt"/>
+ <file role="test" name="tests/array_bind_011.phpt"/>
+ <file role="test" name="tests/array_bind_012.phpt"/>
+ <file role="test" name="tests/array_bind_013.phpt"/>
+ <file role="test" name="tests/array_bind_014.phpt"/>
+ <file role="test" name="tests/array_bind_date1.phpt"/>
+ <file role="test" name="tests/array_bind_date.phpt"/>
+ <file role="test" name="tests/array_bind_float1.phpt"/>
+ <file role="test" name="tests/array_bind_float.phpt"/>
+ <file role="test" name="tests/array_bind_int1.phpt"/>
+ <file role="test" name="tests/array_bind_int.phpt"/>
+ <file role="test" name="tests/array_bind_str1.phpt"/>
+ <file role="test" name="tests/array_bind_str.phpt"/>
<file role="test" name="tests/bind_empty.phpt"/>
<file role="test" name="tests/bind_long.phpt"/>
- <file role="test" name="tests/bind_raw.phpt"/>
<file role="test" name="tests/bind_long_raw.phpt"/>
+ <file role="test" name="tests/bind_raw.phpt"/>
<file role="test" name="tests/bug26133.phpt"/>
<file role="test" name="tests/bug27303_2.phpt"/>
<file role="test" name="tests/bug27303_3.phpt"/>
@@ -73,10 +98,12 @@
<file role="test" name="tests/bug27303.phpt"/>
<file role="test" name="tests/bug32325.phpt"/>
<file role="test" name="tests/bug35973.phpt"/>
+ <file role="test" name="tests/bug36010.phpt"/>
<file role="test" name="tests/bug36096.phpt"/>
<file role="test" name="tests/bug37581.phpt"/>
<file role="test" name="tests/bug38161.phpt"/>
<file role="test" name="tests/bug38173.phpt"/>
+ <file role="test" name="tests/bug40078.phpt"/>
<file role="test" name="tests/close.phpt"/>
<file role="test" name="tests/coll_001.phpt"/>
<file role="test" name="tests/coll_002_func.phpt"/>
@@ -108,32 +135,40 @@
<file role="test" name="tests/coll_016.phpt"/>
<file role="test" name="tests/coll_017_func.phpt"/>
<file role="test" name="tests/coll_017.phpt"/>
+ <file role="test" name="tests/coll_018.phpt"/>
+ <file role="test" name="tests/coll_019.phpt"/>
<file role="test" name="tests/commit_old.phpt"/>
<file role="test" name="tests/commit.phpt"/>
<file role="test" name="tests/connect_1_old.phpt"/>
<file role="test" name="tests/connect_1.phpt"/>
- <file role="test" name="tests/connect.inc"/>
<file role="test" name="tests/connect_old.phpt"/>
<file role="test" name="tests/connect.phpt"/>
<file role="test" name="tests/connect_with_charset_001.phpt"/>
<file role="test" name="tests/connect_without_oracle_home_old.phpt"/>
<file role="test" name="tests/connect_without_oracle_home.phpt"/>
- <file role="test" name="tests/create_table.inc"/>
- <file role="test" name="tests/create_type.inc"/>
<file role="test" name="tests/cursor_bind_err.phpt"/>
+ <file role="test" name="tests/cursor_bind.phpt"/>
<file role="test" name="tests/cursors_old.phpt"/>
<file role="test" name="tests/cursors.phpt"/>
<file role="test" name="tests/debug.phpt"/>
<file role="test" name="tests/default_prefetch1.phpt"/>
<file role="test" name="tests/default_prefetch2.phpt"/>
<file role="test" name="tests/default_prefetch.phpt"/>
+ <file role="test" name="tests/define1.phpt"/>
+ <file role="test" name="tests/define2.phpt"/>
+ <file role="test" name="tests/define3.phpt"/>
+ <file role="test" name="tests/define4.phpt"/>
+ <file role="test" name="tests/define5.phpt"/>
<file role="test" name="tests/define_old.phpt"/>
<file role="test" name="tests/define.phpt"/>
- <file role="test" name="tests/drop_table.inc"/>
- <file role="test" name="tests/drop_type.inc"/>
+ <file role="test" name="tests/descriptors.phpt"/>
+ <file role="test" name="tests/error1.phpt"/>
+ <file role="test" name="tests/error2.phpt"/>
<file role="test" name="tests/error_old.phpt"/>
<file role="test" name="tests/error.phpt"/>
<file role="test" name="tests/exec_fetch.phpt"/>
+ <file role="test" name="tests/execute_mode.phpt"/>
+ <file role="test" name="tests/fetch_all2.phpt"/>
<file role="test" name="tests/fetch_all.phpt"/>
<file role="test" name="tests/fetch_array.phpt"/>
<file role="test" name="tests/fetch_assoc.phpt"/>
@@ -143,8 +178,10 @@
<file role="test" name="tests/fetch_object.phpt"/>
<file role="test" name="tests/fetch.phpt"/>
<file role="test" name="tests/fetch_row.phpt"/>
+ <file role="test" name="tests/field_funcs1.phpt"/>
<file role="test" name="tests/field_funcs_old.phpt"/>
<file role="test" name="tests/field_funcs.phpt"/>
+ <file role="test" name="tests/function_aliases.phpt"/>
<file role="test" name="tests/lob_001.phpt"/>
<file role="test" name="tests/lob_002.phpt"/>
<file role="test" name="tests/lob_003.phpt"/>
@@ -154,7 +191,6 @@
<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"/>
@@ -166,7 +202,23 @@
<file role="test" name="tests/lob_018.phpt"/>
<file role="test" name="tests/lob_019.phpt"/>
<file role="test" name="tests/lob_020.phpt"/>
- <file role="test" name="tests/test.gif"/>
+ <file role="test" name="tests/lob_021.phpt"/>
+ <file role="test" name="tests/lob_022.phpt"/>
+ <file role="test" name="tests/lob_023.phpt"/>
+ <file role="test" name="tests/lob_024.phpt"/>
+ <file role="test" name="tests/lob_025.phpt"/>
+ <file role="test" name="tests/lob_026.phpt"/>
+ <file role="test" name="tests/lob_027.phpt"/>
+ <file role="test" name="tests/lob_028.phpt"/>
+ <file role="test" name="tests/lob_029.phpt"/>
+ <file role="test" name="tests/lob_030.phpt"/>
+ <file role="test" name="tests/lob_031.phpt"/>
+ <file role="test" name="tests/lob_032.phpt"/>
+ <file role="test" name="tests/lob_033.phpt"/>
+ <file role="test" name="tests/lob_034.phpt"/>
+ <file role="test" name="tests/lob_035.phpt"/>
+ <file role="test" name="tests/lob_036.phpt"/>
+ <file role="test" name="tests/lob_aliases.phpt"/>
<file role="test" name="tests/lob_temp1.phpt"/>
<file role="test" name="tests/lob_temp.phpt"/>
<file role="test" name="tests/num.phpt"/>
@@ -176,13 +228,14 @@
<file role="test" name="tests/password_new.phpt"/>
<file role="test" name="tests/password_old.phpt"/>
<file role="test" name="tests/password.phpt"/>
+ <file role="test" name="tests/pecl_bug8816.phpt"/>
<file role="test" name="tests/persistent.phpt"/>
<file role="test" name="tests/prefetch_old.phpt"/>
<file role="test" name="tests/prefetch.phpt"/>
<file role="test" name="tests/privileged_connect1.phpt"/>
<file role="test" name="tests/privileged_connect.phpt"/>
+ <file role="test" name="tests/select_null.phpt"/>
<file role="test" name="tests/serverversion.phpt"/>
- <file role="test" name="tests/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"/>
@@ -194,6 +247,27 @@
<changelog>
<release>
<state>stable</state>
+ <version>1.2.2</version>
+ <date>2006-08-24</date>
+ <notes>
+ Reimplemented oci_lob_read() utilities using patch from Massimo Squillace (msquillace at sogei dot it), which should fix Unicode LOB problems.
+ Fixed bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable)
+ Fixed bug #38173 (Freeing nested cursors causes OCI8 to segfault)
+ Fixed bug #37886 (oci_connect may crash when charset parameter is given)
+ Fixed bug #37931 (possible crash after database restart when using persistent connections)
+ Fixed bug #37531 (oci8 persistent connection corruption)
+ Fixed bug #37487 (oci_fetch_array() array-type should always default to OCI_BOTH)
+ Fixed bug #37392 (Unnecessary call to OCITransRollback() at the end of request)
+ Fixed bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
+ Fixed bug #34005 (oci_password_change() fails). Patch by pholdaway at technocom-wireless dot com.
+ Fixed PECL bug #8112 (Persistent connections misbehave when Apache process times out)
+ </notes>
+ <deps>
+ <dep type="php" rel="ge" version="4.3.10"/>
+ </deps>
+ </release>
+ <release>
+ <state>stable</state>
<version>1.2.1</version>
<date>2006-05-02</date>
<notes>
diff --git a/ext/oci8/package2.xml b/ext/oci8/package2.xml
new file mode 100644
index 000000000..30225cf31
--- /dev/null
+++ b/ext/oci8/package2.xml
@@ -0,0 +1,375 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package packagerversion="1.4.11" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd">
+ <name>oci8</name>
+ <channel>pecl.php.net</channel>
+ <summary>OCI8 functions</summary>
+ <description>These functions allow you to access Oracle database servers using
+the Oracle Call Interface (OCI8).
+ </description>
+ <lead>
+ <name>Antony Dovgal</name>
+ <user>tony2001</user>
+ <email>tony2001@php.net</email>
+ <active>yes</active>
+ </lead>
+ <lead>
+ <name>Wez Furlong</name>
+ <user>wez</user>
+ <email>wez@php.net</email>
+ <active>yes</active>
+ </lead>
+ <lead>
+ <name>Andi Gutmans</name>
+ <user>andi</user>
+ <email>andi@zend.com</email>
+ <active>yes</active>
+ </lead>
+ <date>2007-01-25</date>
+ <time>19:52:26</time>
+ <version>
+ <release>1.2.3</release>
+ <api>1.2.3</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>Fixed possible segfault in ZTS mode when statements containing sub-statements are destroyed in wrong order.
+Fixed bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name()).
+Fixed bug #39988 (type argument of oci_define_by_name() is ignored).
+Fixed bug #39732 (oci_bind_array_by_name doesn&apos;t work on Solaris 64bit).
+Fixed PECL bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column).
+Various minor improvements.
+ </notes>
+ <contents>
+ <dir name="/">
+ <dir name="tests">
+ <file name="array_bind_001.phpt" role="test" />
+ <file name="array_bind_002.phpt" role="test" />
+ <file name="array_bind_003.phpt" role="test" />
+ <file name="array_bind_004.phpt" role="test" />
+ <file name="array_bind_005.phpt" role="test" />
+ <file name="array_bind_006.phpt" role="test" />
+ <file name="array_bind_007.phpt" role="test" />
+ <file name="array_bind_008.phpt" role="test" />
+ <file name="array_bind_009.phpt" role="test" />
+ <file name="array_bind_010.phpt" role="test" />
+ <file name="array_bind_011.phpt" role="test" />
+ <file name="array_bind_012.phpt" role="test" />
+ <file name="array_bind_013.phpt" role="test" />
+ <file name="array_bind_014.phpt" role="test" />
+ <file name="array_bind_date.phpt" role="test" />
+ <file name="array_bind_date1.phpt" role="test" />
+ <file name="array_bind_float.phpt" role="test" />
+ <file name="array_bind_float1.phpt" role="test" />
+ <file name="array_bind_int.phpt" role="test" />
+ <file name="array_bind_int1.phpt" role="test" />
+ <file name="array_bind_str.phpt" role="test" />
+ <file name="array_bind_str1.phpt" role="test" />
+ <file name="bind_empty.phpt" role="test" />
+ <file name="bind_long.phpt" role="test" />
+ <file name="bind_long_raw.phpt" role="test" />
+ <file name="bind_raw.phpt" role="test" />
+ <file name="bug26133.phpt" role="test" />
+ <file name="bug27303.phpt" role="test" />
+ <file name="bug27303_2.phpt" role="test" />
+ <file name="bug27303_3.phpt" role="test" />
+ <file name="bug27303_4.phpt" role="test" />
+ <file name="bug32325.phpt" role="test" />
+ <file name="bug35973.phpt" role="test" />
+ <file name="bug36010.phpt" role="test" />
+ <file name="bug36096.phpt" role="test" />
+ <file name="bug37581.phpt" role="test" />
+ <file name="bug38161.phpt" role="test" />
+ <file name="bug38173.phpt" role="test" />
+ <file name="bug40078.phpt" role="test" />
+ <file name="close.phpt" role="test" />
+ <file name="coll_001.phpt" role="test" />
+ <file name="coll_002.phpt" role="test" />
+ <file name="coll_002_func.phpt" role="test" />
+ <file name="coll_003.phpt" role="test" />
+ <file name="coll_003_func.phpt" role="test" />
+ <file name="coll_004.phpt" role="test" />
+ <file name="coll_004_func.phpt" role="test" />
+ <file name="coll_005.phpt" role="test" />
+ <file name="coll_006.phpt" role="test" />
+ <file name="coll_006_func.phpt" role="test" />
+ <file name="coll_007.phpt" role="test" />
+ <file name="coll_008.phpt" role="test" />
+ <file name="coll_009.phpt" role="test" />
+ <file name="coll_009_func.phpt" role="test" />
+ <file name="coll_010.phpt" role="test" />
+ <file name="coll_010_func.phpt" role="test" />
+ <file name="coll_011.phpt" role="test" />
+ <file name="coll_011_func.phpt" role="test" />
+ <file name="coll_012.phpt" role="test" />
+ <file name="coll_012_func.phpt" role="test" />
+ <file name="coll_013.phpt" role="test" />
+ <file name="coll_013_func.phpt" role="test" />
+ <file name="coll_014.phpt" role="test" />
+ <file name="coll_014_func.phpt" role="test" />
+ <file name="coll_015.phpt" role="test" />
+ <file name="coll_015_func.phpt" role="test" />
+ <file name="coll_016.phpt" role="test" />
+ <file name="coll_016_func.phpt" role="test" />
+ <file name="coll_017.phpt" role="test" />
+ <file name="coll_017_func.phpt" role="test" />
+ <file name="coll_018.phpt" role="test" />
+ <file name="coll_019.phpt" role="test" />
+ <file name="commit.phpt" role="test" />
+ <file name="commit_old.phpt" role="test" />
+ <file name="connect.inc" role="test" />
+ <file name="connect.phpt" role="test" />
+ <file name="connect_1.phpt" role="test" />
+ <file name="connect_1_old.phpt" role="test" />
+ <file name="connect_old.phpt" role="test" />
+ <file name="connect_without_oracle_home.phpt" role="test" />
+ <file name="connect_without_oracle_home_old.phpt" role="test" />
+ <file name="connect_with_charset_001.phpt" role="test" />
+ <file name="create_table.inc" role="test" />
+ <file name="create_type.inc" role="test" />
+ <file name="cursors.phpt" role="test" />
+ <file name="cursors_old.phpt" role="test" />
+ <file name="cursor_bind.phpt" role="test" />
+ <file name="cursor_bind_err.phpt" role="test" />
+ <file name="debug.phpt" role="test" />
+ <file name="default_prefetch.phpt" role="test" />
+ <file name="default_prefetch1.phpt" role="test" />
+ <file name="default_prefetch2.phpt" role="test" />
+ <file name="define.phpt" role="test" />
+ <file name="define1.phpt" role="test" />
+ <file name="define2.phpt" role="test" />
+ <file name="define3.phpt" role="test" />
+ <file name="define4.phpt" role="test" />
+ <file name="define5.phpt" role="test" />
+ <file name="define_old.phpt" role="test" />
+ <file name="descriptors.phpt" role="test" />
+ <file name="details.inc" role="test" />
+ <file name="drop_table.inc" role="test" />
+ <file name="drop_type.inc" role="test" />
+ <file name="error.phpt" role="test" />
+ <file name="error1.phpt" role="test" />
+ <file name="error2.phpt" role="test" />
+ <file name="error_old.phpt" role="test" />
+ <file name="execute_mode.phpt" role="test" />
+ <file name="exec_fetch.phpt" role="test" />
+ <file name="fetch.phpt" role="test" />
+ <file name="fetch_all.phpt" role="test" />
+ <file name="fetch_all2.phpt" role="test" />
+ <file name="fetch_array.phpt" role="test" />
+ <file name="fetch_assoc.phpt" role="test" />
+ <file name="fetch_into.phpt" role="test" />
+ <file name="fetch_into1.phpt" role="test" />
+ <file name="fetch_into2.phpt" role="test" />
+ <file name="fetch_object.phpt" role="test" />
+ <file name="fetch_row.phpt" role="test" />
+ <file name="field_funcs.phpt" role="test" />
+ <file name="field_funcs1.phpt" role="test" />
+ <file name="field_funcs_old.phpt" role="test" />
+ <file name="function_aliases.phpt" role="test" />
+ <file name="lob_001.phpt" role="test" />
+ <file name="lob_002.phpt" role="test" />
+ <file name="lob_003.phpt" role="test" />
+ <file name="lob_004.phpt" role="test" />
+ <file name="lob_005.phpt" role="test" />
+ <file name="lob_006.phpt" role="test" />
+ <file name="lob_007.phpt" role="test" />
+ <file name="lob_008.phpt" role="test" />
+ <file name="lob_009.phpt" role="test" />
+ <file name="lob_010.phpt" role="test" />
+ <file name="lob_011.phpt" role="test" />
+ <file name="lob_012.phpt" role="test" />
+ <file name="lob_013.phpt" role="test" />
+ <file name="lob_014.phpt" role="test" />
+ <file name="lob_015.phpt" role="test" />
+ <file name="lob_016.phpt" role="test" />
+ <file name="lob_017.phpt" role="test" />
+ <file name="lob_018.phpt" role="test" />
+ <file name="lob_019.phpt" role="test" />
+ <file name="lob_020.phpt" role="test" />
+ <file name="lob_021.phpt" role="test" />
+ <file name="lob_022.phpt" role="test" />
+ <file name="lob_023.phpt" role="test" />
+ <file name="lob_024.phpt" role="test" />
+ <file name="lob_025.phpt" role="test" />
+ <file name="lob_026.phpt" role="test" />
+ <file name="lob_027.phpt" role="test" />
+ <file name="lob_028.phpt" role="test" />
+ <file name="lob_029.phpt" role="test" />
+ <file name="lob_030.phpt" role="test" />
+ <file name="lob_031.phpt" role="test" />
+ <file name="lob_032.phpt" role="test" />
+ <file name="lob_033.phpt" role="test" />
+ <file name="lob_034.phpt" role="test" />
+ <file name="lob_035.phpt" role="test" />
+ <file name="lob_036.phpt" role="test" />
+ <file name="lob_aliases.phpt" role="test" />
+ <file name="lob_temp.phpt" role="test" />
+ <file name="lob_temp1.phpt" role="test" />
+ <file name="num.phpt" role="test" />
+ <file name="oci_execute_segfault.phpt" role="test" />
+ <file name="old_oci_close.phpt" role="test" />
+ <file name="old_oci_close1.phpt" role="test" />
+ <file name="password.phpt" role="test" />
+ <file name="password_new.phpt" role="test" />
+ <file name="password_old.phpt" role="test" />
+ <file name="pecl_bug8816.phpt" role="test" />
+ <file name="persistent.phpt" role="test" />
+ <file name="prefetch.phpt" role="test" />
+ <file name="prefetch_old.phpt" role="test" />
+ <file name="privileged_connect.phpt" role="test" />
+ <file name="privileged_connect1.phpt" role="test" />
+ <file name="select_null.phpt" role="test" />
+ <file name="serverversion.phpt" role="test" />
+ <file name="skipif.inc" role="test" />
+ <file name="statement_cache.phpt" role="test" />
+ <file name="statement_type.phpt" role="test" />
+ <file name="statement_type_old.phpt" role="test" />
+ <file name="uncommitted.phpt" role="test" />
+ </dir> <!-- //tests -->
+ <file name="config.m4" role="src" />
+ <file name="config.w32" role="src" />
+ <file name="CREDITS" role="doc" />
+ <file name="oci8.c" role="src" />
+ <file name="oci8.dsp" role="src" />
+ <file name="oci8_collection.c" role="src" />
+ <file name="oci8_interface.c" role="src" />
+ <file name="oci8_lob.c" role="src" />
+ <file name="oci8_statement.c" role="src" />
+ <file name="php_oci8.h" role="src" />
+ <file name="php_oci8_int.h" role="src" />
+ <file name="README" role="doc" />
+ </dir> <!-- / -->
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>4.3.10</min>
+ <max>6.0.0</max>
+ <exclude>6.0.0</exclude>
+ </php>
+ <pearinstaller>
+ <min>1.4.0b1</min>
+ </pearinstaller>
+ </required>
+ </dependencies>
+ <providesextension>oci8</providesextension>
+ <extsrcrelease>
+ <configureoption default="autodetect" name="with-oci8" prompt="Please provide the path to ORACLE_HOME dir. Use &apos;instantclient,/path/to/instant/client/lib&apos; if you&apos;re compiling against Oracle Instant Client" />
+ </extsrcrelease>
+ <changelog>
+ <release>
+ <version>
+ <release>1.2.2</release>
+ <api>1.2.2</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
+ <date>2006-08-24</date>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>Reimplemented oci_lob_read() utilities using patch from Massimo Squillace (msquillace at sogei dot it), which should fix Unicode LOB problems.
+Fixed bug #38161 (oci_bind_by_name() returns garbage when Oracle didn&apos;t set the variable)
+Fixed bug #38173 (Freeing nested cursors causes OCI8 to segfault)
+Fixed bug #37886 (oci_connect may crash when charset parameter is given)
+Fixed bug #37931 (possible crash after database restart when using persistent connections)
+Fixed bug #37531 (oci8 persistent connection corruption)
+Fixed bug #37487 (oci_fetch_array() array-type should always default to OCI_BOTH)
+Fixed bug #37392 (Unnecessary call to OCITransRollback() at the end of request)
+Fixed bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
+Fixed bug #34005 (oci_password_change() fails). Patch by pholdaway at technocom-wireless dot com.
+Fixed PECL bug #8112 (Persistent connections misbehave when Apache process times out)
+ </notes>
+ </release>
+ <release>
+ <version>
+ <release>1.2.1</release>
+ <api>1.2.1</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
+ <date>2006-05-02</date>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>Added support for BINARY_DOUBLE and BINARY_FLOAT (see #36764)
+Changed oci_field_type() to return VARCHAR2 instead of VARCHAR (according to feature request #36800)
+Fixed bug #37059 (oci_bind_by_name() doesn&apos;t support RAW and LONG RAW fields)
+Fixed bug #37055 (incorrect reference counting for persistent OCI8 connections)
+Fixed bug #36934 (OCILob-&gt;read() doesn&apos;t move internal pointer when reading 0&apos;s)
+Fixed bug #36851 (Documentation and code discrepancies for NULL data)
+Fixed bug #36820 (Privileged connection with an Oracle password file fails)
+ </notes>
+ </release>
+ <release>
+ <version>
+ <release>1.2.0</release>
+ <api>1.2.0</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
+ <date>2006-03-16</date>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>Changed OCI8 code to use OCIServerVersion() instead of OCIPing(), which may crash Oracle server of version &lt; 10.2
+Fixed bug #36235 (ocicolumnname returns false before a succesfull fetch)
+Fixed bug #36096 (oci_result() returns garbage after oci_fetch() failed)
+Fixed bug #36055 (possible OCI8 crash in multithreaded environment)
+Fixed bug #36010 (Segfault when re-creating and re-executing statements with bound parameters)
+Fixed PECL bug #5571 (oci_new_connect() not closed by oci_close())
+Fixed bug #33383 (crash when retrieving empty BLOBs)
+ </notes>
+ </release>
+ <release>
+ <version>
+ <release>1.1.1</release>
+ <api>1.1.1</api>
+ </version>
+ <stability>
+ <release>beta</release>
+ <api>beta</api>
+ </stability>
+ <date>2005-09-22</date>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>Fixed segfault when binding empty values.
+Fixed problem with oci_error() without arguments.
+ </notes>
+ </release>
+ <release>
+ <version>
+ <release>1.1</release>
+ <api>1.1</api>
+ </version>
+ <stability>
+ <release>beta</release>
+ <api>beta</api>
+ </stability>
+ <date>2005-09-07</date>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>This release fixes a huge amount of bugs and adds support of
+statement caching, external credentials etc.
+See official announce for details.
+ </notes>
+ </release>
+ <release>
+ <version>
+ <release>1.0</release>
+ <api>1.0</api>
+ </version>
+ <stability>
+ <release>beta</release>
+ <api>beta</api>
+ </stability>
+ <date>2004-03-19</date>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>package.xml added to support installation using pear installer
+ </notes>
+ </release>
+ </changelog>
+</package>
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index 1e7cb6275..08bd51fba 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_oci8.h,v 1.36.2.2 2006/01/01 12:50:10 sniper Exp $ */
+/* $Id: php_oci8.h,v 1.36.2.2.2.1 2007/01/01 09:36:03 sebastian Exp $ */
#if HAVE_OCI8
# ifndef PHP_OCI8_H
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index d4ab23443..664fc4f6e 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_oci8_int.h,v 1.11.2.6.2.7 2006/08/22 11:09:12 tony2001 Exp $ */
+/* $Id: php_oci8_int.h,v 1.11.2.6.2.18 2007/03/29 09:33:03 tony2001 Exp $ */
#if HAVE_OCI8
# ifndef PHP_OCI8_INT_H
@@ -134,6 +134,7 @@ typedef struct { /* php_oci_descriptor {{{ */
typedef struct { /* php_oci_lob_ctx {{{ */
char **lob_data; /* address of pointer to LOB data */
ub4 *lob_len; /* address of LOB length variable (bytes) */
+ ub4 alloc_len;
} php_oci_lob_ctx; /* }}} */
typedef struct { /* php_oci_collection {{{ */
@@ -180,20 +181,22 @@ typedef struct { /* php_oci_bind {{{ */
php_oci_statement *parent_statement; /* pointer to the parent statement */
struct {
void *elements;
-/* ub2 *indicators; */
+ sb2 *indicators;
ub2 *element_lengths;
/* ub2 *retcodes; */
- long current_length;
- long old_length;
- long max_length;
+ ub4 current_length;
+ ub4 old_length;
+ ub4 max_length;
long type;
} array;
sb2 indicator; /* -1 means NULL */
ub2 retcode; /* */
+ ub4 dummy_len; /* a dummy var to store alenpp value in bind OUT callback */
} php_oci_bind; /* }}} */
typedef struct { /* php_oci_out_column {{{ */
- php_oci_statement *statement; /* statement handle. used when fetching REFCURSORS */
+ php_oci_statement *statement; /* statement handle. used when fetching REFCURSORS */
+ php_oci_statement *nested_statement; /* statement handle. used when fetching REFCURSORS */
OCIDefine *oci_define; /* define handle */
char *name; /* column name */
ub4 name_len; /* column name length */
@@ -221,41 +224,47 @@ typedef struct { /* php_oci_out_column {{{ */
/* {{{ macros */
#define PHP_OCI_CALL(func, params) \
- OCI_G(in_call) = 1; \
- func params; \
- OCI_G(in_call) = 0; \
- if (OCI_G(debug_mode)) { \
- php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
- }
+ do { \
+ if (OCI_G(debug_mode)) { \
+ php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
+ } \
+ OCI_G(in_call) = 1; \
+ func params; \
+ OCI_G(in_call) = 0; \
+ } while (0)
#define PHP_OCI_CALL_RETURN(__retval, func, params) \
- OCI_G(in_call) = 1; \
- __retval = func params; \
- OCI_G(in_call) = 0; \
- if (OCI_G(debug_mode)) { \
- php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
- }
+ do { \
+ if (OCI_G(debug_mode)) { \
+ php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
+ } \
+ OCI_G(in_call) = 1; \
+ __retval = func params; \
+ OCI_G(in_call) = 0; \
+ } while (0)
#define PHP_OCI_HANDLE_ERROR(connection, errcode) \
-{ \
- switch (errcode) { \
- case 1013: \
- zend_bailout(); \
+ do { \
+ switch (errcode) { \
+ case 1013: \
+ zend_bailout(); \
break; \
- case 22: \
- case 1012: \
- case 3113: \
- case 604: \
- case 1041: \
- case 3114: \
- connection->is_open = 0; \
+ case 22: \
+ case 1012: \
+ case 3113: \
+ case 604: \
+ case 1041: \
+ case 3114: \
+ connection->is_open = 0; \
break; \
- } \
-} \
+ } \
+ } while (0)
#define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \
- resource->id = ZEND_REGISTER_RESOURCE(NULL, resource, le_resource); \
- zend_list_addref(resource->connection->rsrc_id);
+ do { \
+ resource->id = ZEND_REGISTER_RESOURCE(NULL, resource, le_resource); \
+ zend_list_addref(resource->connection->rsrc_id); \
+ } while (0)
#define PHP_OCI_ZVAL_TO_CONNECTION(zval, connection) \
ZEND_FETCH_RESOURCE2(connection, php_oci_connection *, &zval, -1, "oci8 connection", le_connection, le_pconnection);
@@ -270,10 +279,12 @@ typedef struct { /* php_oci_out_column {{{ */
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; \
- }
+ do { \
+ var = (type) zend_fetch_resource(&zval TSRMLS_CC, -1, name, NULL, 1, resource_type); \
+ if (!var) { \
+ return 1; \
+ } \
+ } while (0)
#define PHP_OCI_ZVAL_TO_CONNECTION_EX(zval, connection) \
PHP_OCI_FETCH_RESOURCE_EX(zval, connection, php_oci_connection *, "oci8 connection", le_connection)
@@ -325,7 +336,7 @@ 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_flush (php_oci_descriptor *, long TSRMLS_DC);
int php_oci_lob_set_buffering (php_oci_descriptor *, int TSRMLS_DC);
int php_oci_lob_get_buffering (php_oci_descriptor *);
int php_oci_lob_copy (php_oci_descriptor *, php_oci_descriptor *, long TSRMLS_DC);
@@ -337,7 +348,7 @@ 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_erase (php_oci_descriptor *, long, ub4, ub4 * TSRMLS_DC);
int php_oci_lob_is_equal (php_oci_descriptor *, php_oci_descriptor *, boolean * TSRMLS_DC);
#if defined(HAVE_OCI_LOB_READ2)
sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp);
@@ -373,7 +384,7 @@ int php_oci_collection_append_string(php_oci_collection *, char *, int TSRMLS_DC
/* statement related prototypes {{{ */
php_oci_statement * php_oci_statement_create (php_oci_connection *, char *, int TSRMLS_DC);
-int php_oci_statement_set_prefetch (php_oci_statement *, ub4 TSRMLS_DC);
+int php_oci_statement_set_prefetch (php_oci_statement *, long TSRMLS_DC);
int php_oci_statement_fetch (php_oci_statement *, ub4 TSRMLS_DC);
php_oci_out_column * php_oci_statement_get_column (php_oci_statement *, long, char*, int TSRMLS_DC);
int php_oci_statement_execute (php_oci_statement *, ub4 TSRMLS_DC);
@@ -411,6 +422,7 @@ ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ */
long max_persistent; /* maximum number of persistent connections per process */
long num_persistent; /* number of existing persistent connections */
long num_links; /* non-persistent + persistent connections */
+ long num_statements; /* number of statements open */
long ping_interval; /* time interval between pings */
long persistent_timeout; /* time period after which idle persistent connection is considered expired */
long statement_cache_size; /* statement cache size. used with 9i+ clients only*/
diff --git a/ext/oci8/tests/array_bind_005.phpt b/ext/oci8/tests/array_bind_005.phpt
index 15278532e..58dadc20c 100644
--- a/ext/oci8/tests/array_bind_005.phpt
+++ b/ext/oci8/tests/array_bind_005.phpt
@@ -59,7 +59,6 @@ var_dump($array);
echo "Done\n";
?>
--EXPECTF--
-Warning: oci_execute(): ORA-01405: fetched column value is NULL in %s on line %d
array(5) {
[0]=>
string(0) ""
diff --git a/ext/oci8/tests/array_bind_013.phpt b/ext/oci8/tests/array_bind_013.phpt
index da8f6fdd1..4da9d8bbe 100644
--- a/ext/oci8/tests/array_bind_013.phpt
+++ b/ext/oci8/tests/array_bind_013.phpt
@@ -16,7 +16,7 @@ var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -10));
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -1));
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, 0));
-oci_execute($statement);
+@oci_execute($statement);
var_dump($array);
diff --git a/ext/oci8/tests/array_bind_014.phpt b/ext/oci8/tests/array_bind_014.phpt
new file mode 100644
index 000000000..bd9fdf133
--- /dev/null
+++ b/ext/oci8/tests/array_bind_014.phpt
@@ -0,0 +1,73 @@
+--TEST--
+oci_bind_array_by_name() and NUMBERs
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$drop = "DROP table bind_test";
+$statement = oci_parse($c, $drop);
+@oci_execute($statement);
+
+$create = "CREATE table bind_test(name NUMBER)";
+$statement = oci_parse($c, $create);
+oci_execute($statement);
+
+$create_pkg = "
+CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
+ TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
+ PROCEDURE iobind(c1 IN OUT ARRTYPE);
+END ARRAYBINDPKG1;";
+$statement = oci_parse($c, $create_pkg);
+oci_execute($statement);
+
+$create_pkg_body = "
+CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
+ CURSOR CUR IS SELECT name FROM bind_test;
+ PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
+ BEGIN
+ IF NOT CUR%ISOPEN THEN
+ OPEN CUR;
+ END IF;
+ FOR i IN REVERSE 1..5 LOOP
+ FETCH CUR INTO c1(i);
+ IF CUR%NOTFOUND THEN
+ CLOSE CUR;
+ EXIT;
+ END IF;
+ END LOOP;
+ END iobind;
+END ARRAYBINDPKG1;";
+$statement = oci_parse($c, $create_pkg_body);
+oci_execute($statement);
+
+for ($i = 1; $i < 6; $i++) {
+ $statement = oci_parse($c, "INSERT INTO bind_test VALUES (".$i.")");
+ oci_execute($statement);
+}
+
+$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
+$array = Array();
+oci_bind_array_by_name($statement, ":c1", $array, 5, -1, SQLT_INT);
+oci_execute($statement);
+
+var_dump($array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(4)
+ [2]=>
+ int(3)
+ [3]=>
+ int(2)
+ [4]=>
+ int(1)
+}
+Done
diff --git a/ext/oci8/tests/array_bind_int1.phpt b/ext/oci8/tests/array_bind_int1.phpt
index eb2072adc..5e06de876 100644
--- a/ext/oci8/tests/array_bind_int1.phpt
+++ b/ext/oci8/tests/array_bind_int1.phpt
@@ -50,7 +50,7 @@ $statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
$array = Array(1,2,3,4,5);
-oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_NUM);
+oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_INT);
oci_execute($statement);
diff --git a/ext/oci8/tests/bind_empty.phpt b/ext/oci8/tests/bind_empty.phpt
index 9c602b32c..ba50f8617 100644
--- a/ext/oci8/tests/bind_empty.phpt
+++ b/ext/oci8/tests/bind_empty.phpt
@@ -4,7 +4,7 @@ binding empty values
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
$drop = "DROP table bind_test";
@@ -16,18 +16,57 @@ $statement = oci_parse($c, $create);
oci_execute($statement);
+echo "Test 1\n";
+
$name = null;
$stmt = oci_parse($c, "UPDATE bind_test SET name=:name");
oci_bind_by_name($stmt, ":name", $name);
-$res = oci_execute($stmt);
+var_dump(oci_execute($stmt));
+
+echo "Test 2\n";
$name = "";
$stmt = oci_parse($c, "UPDATE bind_test SET name=:name");
oci_bind_by_name($stmt, ":name", $name);
+var_dump(oci_execute($stmt));
+
+echo "Test 3\n";
+
+$stmt = oci_parse($c, "INSERT INTO bind_test (NAME) VALUES ('abc')");
$res = oci_execute($stmt);
+$stmt = oci_parse($c, "INSERT INTO bind_test (NAME) VALUES ('def')");
+$res = oci_execute($stmt);
+
+$name = null;
+$stmt = oci_parse($c, "UPDATE bind_test SET name=:name WHERE NAME = 'abc'");
+oci_bind_by_name($stmt, ":name", $name);
+
+var_dump(oci_execute($stmt));
+
+$stid = oci_parse($c, "select * from bind_test order by 1");
+oci_execute($stid);
+oci_fetch_all($stid, $res);
+var_dump($res);
+
+echo "Test 4\n";
+
+$name = "";
+$stmt = oci_parse($c, "UPDATE bind_test SET name=:name WHERE NAME = 'def'");
+oci_bind_by_name($stmt, ":name", $name);
+
+var_dump(oci_execute($stmt));
+
+$stid = oci_parse($c, "select * from bind_test order by 1");
+oci_execute($stid);
+oci_fetch_all($stid, $res);
+var_dump($res);
+
+
+// Clean up
+
$drop = "DROP table bind_test";
$statement = oci_parse($c, $drop);
@oci_execute($statement);
@@ -36,4 +75,30 @@ echo "Done\n";
?>
--EXPECTF--
+Test 1
+bool(true)
+Test 2
+bool(true)
+Test 3
+bool(true)
+array(1) {
+ ["NAME"]=>
+ array(2) {
+ [0]=>
+ string(3) "def"
+ [1]=>
+ NULL
+ }
+}
+Test 4
+bool(true)
+array(1) {
+ ["NAME"]=>
+ array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ }
+}
Done
diff --git a/ext/oci8/tests/bug40078.phpt b/ext/oci8/tests/bug40078.phpt
new file mode 100644
index 000000000..4a234e176
--- /dev/null
+++ b/ext/oci8/tests/bug40078.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name())
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$create_pkg = "
+CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
+ TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
+ PROCEDURE nullbind(c1 OUT ARRTYPE);
+END ARRAYBINDPKG1;";
+$statement = oci_parse($c, $create_pkg);
+oci_execute($statement);
+
+$create_pkg_body = "
+CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
+ PROCEDURE nullbind(c1 OUT ARRTYPE) IS
+ BEGIN
+ c1(1) := 'one';
+ c1(2) := 'two';
+ c1(3) := '';
+ c1(4) := 'four';
+ c1(5) := 'five';
+ END nullbind;
+END ARRAYBINDPKG1;";
+$statement = oci_parse($c, $create_pkg_body);
+oci_execute($statement);
+
+$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.nullbind(:c1); END;");
+
+oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR);
+
+oci_execute($statement);
+
+var_dump($array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(5) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(4) "four"
+ [4]=>
+ string(4) "five"
+}
+Done
diff --git a/ext/oci8/tests/bug40415.phpt b/ext/oci8/tests/bug40415.phpt
new file mode 100644
index 000000000..1ebc249d3
--- /dev/null
+++ b/ext/oci8/tests/bug40415.phpt
@@ -0,0 +1,200 @@
+--TEST--
+Bug #40415 (Using oci_fetchall with nested cursors)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+// Setup
+
+$create_1 = "CREATE TABLE t1 (id1 INTEGER)";
+$create_2 = "CREATE TABLE t2 (id2 INTEGER)";
+$drop_1 = "DROP TABLE t1";
+$drop_2 = "DROP TABLE t2";
+
+$s1 = oci_parse($c, $drop_1);
+$s2 = oci_parse($c, $drop_2);
+@oci_execute($s1);
+@oci_execute($s2);
+
+$s1 = oci_parse($c, $create_1);
+$s2 = oci_parse($c, $create_2);
+oci_execute($s1);
+oci_execute($s2);
+
+for($i=1; $i < 4; $i++) {
+ $insert = "INSERT INTO t1 VALUES(1".$i.")";
+ $s = oci_parse($c, $insert);
+ oci_execute($s);
+}
+
+for($i=1; $i < 4; $i++) {
+ $insert = "INSERT INTO t2 VALUES(2".$i.")";
+ $s = oci_parse($c, $insert);
+ oci_execute($s);
+}
+
+
+function do_assoc($c)
+{
+ $query = "SELECT t1.*, CURSOR( SELECT * FROM t2 ) AS CURSOR FROM t1";
+
+ $stmt = oci_parse($c, $query);
+ oci_execute($stmt);
+
+ while ($row = oci_fetch_assoc($stmt)) {
+ print "Got row \"".$row['ID1']."\". Now getting nested cursor:\n";
+ var_dump(oci_execute($row['CURSOR']));
+ while ($row_n = oci_fetch_assoc($row['CURSOR']) ) {
+ var_dump($row_n);
+ }
+ }
+}
+
+function do_all($c)
+{
+ $query = "SELECT t1.*, CURSOR( SELECT * FROM t2 ) AS CURSOR FROM t1";
+
+ $stmt = oci_parse($c, $query);
+ oci_execute($stmt);
+
+ $rc1 = oci_fetch_all($stmt, $res);
+
+ echo "Rows returned $rc1\n";
+
+ var_dump($res);
+
+ foreach ($res['CURSOR'] as $cv) {
+ echo "Getting nested cursor\n";
+ var_dump(oci_execute($cv));
+ $rc2 = oci_fetch_all($cv, $res2);
+ var_dump($res2);
+ }
+}
+
+
+
+echo "Test 1: Associate fetch of nested cursor\n";
+do_assoc($c);
+
+echo "\nTest 2: fetchall of nested cursor\n";
+do_all($c);
+
+
+// Cleanup
+$s1 = oci_parse($c, $drop_1);
+$s2 = oci_parse($c, $drop_2);
+@oci_execute($s1);
+@oci_execute($s2);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Test 1: Associate fetch of nested cursor
+Got row "11". Now getting nested cursor:
+bool(true)
+array(1) {
+ ["ID2"]=>
+ string(2) "21"
+}
+array(1) {
+ ["ID2"]=>
+ string(2) "22"
+}
+array(1) {
+ ["ID2"]=>
+ string(2) "23"
+}
+Got row "12". Now getting nested cursor:
+bool(true)
+array(1) {
+ ["ID2"]=>
+ string(2) "21"
+}
+array(1) {
+ ["ID2"]=>
+ string(2) "22"
+}
+array(1) {
+ ["ID2"]=>
+ string(2) "23"
+}
+Got row "13". Now getting nested cursor:
+bool(true)
+array(1) {
+ ["ID2"]=>
+ string(2) "21"
+}
+array(1) {
+ ["ID2"]=>
+ string(2) "22"
+}
+array(1) {
+ ["ID2"]=>
+ string(2) "23"
+}
+
+Test 2: fetchall of nested cursor
+Rows returned 3
+array(2) {
+ ["ID1"]=>
+ array(3) {
+ [0]=>
+ string(2) "11"
+ [1]=>
+ string(2) "12"
+ [2]=>
+ string(2) "13"
+ }
+ ["CURSOR"]=>
+ array(3) {
+ [0]=>
+ resource(%d) of type (oci8 statement)
+ [1]=>
+ resource(%d) of type (oci8 statement)
+ [2]=>
+ resource(%d) of type (oci8 statement)
+ }
+}
+Getting nested cursor
+bool(true)
+array(1) {
+ ["ID2"]=>
+ array(3) {
+ [0]=>
+ string(2) "21"
+ [1]=>
+ string(2) "22"
+ [2]=>
+ string(2) "23"
+ }
+}
+Getting nested cursor
+bool(true)
+array(1) {
+ ["ID2"]=>
+ array(3) {
+ [0]=>
+ string(2) "21"
+ [1]=>
+ string(2) "22"
+ [2]=>
+ string(2) "23"
+ }
+}
+Getting nested cursor
+bool(true)
+array(1) {
+ ["ID2"]=>
+ array(3) {
+ [0]=>
+ string(2) "21"
+ [1]=>
+ string(2) "22"
+ [2]=>
+ string(2) "23"
+ }
+}
+Done
diff --git a/ext/oci8/tests/coll_018.phpt b/ext/oci8/tests/coll_018.phpt
new file mode 100644
index 000000000..f97cc49e7
--- /dev/null
+++ b/ext/oci8/tests/coll_018.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Collection trim tests
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+$coll1 = oci_new_collection($c, $type_name);
+
+echo "Test 1.\n";
+var_dump($coll1->trim());
+
+echo "\nTest 2.\n";
+var_dump($coll1->trim(0));
+
+echo "\nTest 3.\n";
+var_dump($coll1->append(1));
+var_dump($coll1->append(2));
+var_dump($coll1->append(3));
+var_dump($coll1->append(4));
+
+var_dump($coll1->getElem(-1)); // check before the beginning
+var_dump($coll1->getElem(0));
+var_dump($coll1->getElem(1));
+var_dump($coll1->getElem(2));
+var_dump($coll1->getElem(3));
+var_dump($coll1->getElem(4)); // check past the end
+
+echo "\nTest 4.\n";
+var_dump($coll1->trim(1));
+var_dump($coll1->getElem(2)); // this should be the last element
+var_dump($coll1->getElem(3)); // this element should have gone
+
+echo "\nTest 5.\n";
+var_dump($coll1->trim(2));
+var_dump($coll1->getElem(0)); // this should be the last element
+var_dump($coll1->getElem(1)); // this element should have gone
+
+echo "\nTest 6.\n";
+var_dump($coll1->trim(0));
+var_dump($coll1->getElem(0)); // this should still be the last element
+
+echo "\nTest 7.\n";
+var_dump($coll1->trim(1));
+var_dump($coll1->getElem(0)); // this should have gone
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+Test 1.
+
+Warning: OCI-Collection::trim() expects exactly 1 parameter, 0 given in %s on line 9
+NULL
+
+Test 2.
+bool(true)
+
+Test 3.
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+float(1)
+float(2)
+float(3)
+float(4)
+bool(false)
+
+Test 4.
+bool(true)
+float(3)
+bool(false)
+
+Test 5.
+bool(true)
+float(1)
+bool(false)
+
+Test 6.
+bool(true)
+float(1)
+
+Test 7.
+bool(true)
+bool(false)
+Done
diff --git a/ext/oci8/tests/coll_019.phpt b/ext/oci8/tests/coll_019.phpt
new file mode 100644
index 000000000..15a673d71
--- /dev/null
+++ b/ext/oci8/tests/coll_019.phpt
@@ -0,0 +1,104 @@
+--TEST--
+Test collection Oracle error handling collections and numbers (2)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE ".$type_name;;
+$statement = oci_parse($c,$ora_sql);
+@oci_execute($statement);
+
+
+echo "Test 0\n";
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF BLOB";
+$statement = oci_parse($c,$ora_sql);
+oci_execute($statement);
+
+$coll1 = oci_new_collection($c, $type_name);
+
+var_dump($coll1->append('a long string')); // invalid type for append
+var_dump($coll1->assignElem(1, 'a long string')); // invalid type for assignelem()
+var_dump($coll1->getElem(0));
+
+require dirname(__FILE__)."/drop_type.inc";
+
+echo "Test 1\n";
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
+$statement = oci_parse($c,$ora_sql);
+oci_execute($statement);
+
+$coll1 = oci_new_collection($c, $type_name);
+
+var_dump($coll1->assignElem(1, null)); // invalid location for null
+var_dump($coll1->getElem(0));
+
+echo "Test 2\n";
+var_dump($coll1->assignElem(1, 1234)); // invalid location for number
+var_dump($coll1->getElem(0));
+
+require dirname(__FILE__)."/drop_type.inc";
+
+echo "Test 3\n";
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR2(1)";
+$statement = oci_parse($c,$ora_sql);
+oci_execute($statement);
+
+$coll1 = oci_new_collection($c, $type_name);
+
+var_dump($coll1->assignElem(1, 'abc')); // invalid location for string
+var_dump($coll1->getElem(0));
+
+require dirname(__FILE__)."/drop_type.inc";
+
+echo "Test 4\n";
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
+$statement = oci_parse($c,$ora_sql);
+oci_execute($statement);
+
+$coll1 = oci_new_collection($c, $type_name);
+
+var_dump($coll1->append(1)); // invalid date format
+var_dump($coll1->assignElem(1, '01-JAN-06')); // invalid location for date
+var_dump($coll1->getElem(0));
+
+require dirname(__FILE__)."/drop_type.inc";
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 0
+
+Notice: OCI-Collection::append(): Unknown or unsupported type of element: 113 in %s on line %d
+bool(false)
+
+Notice: OCI-Collection::assignelem(): Unknown or unsupported type of element: 113 in %s on line %d
+bool(false)
+bool(false)
+Test 1
+
+Warning: OCI-Collection::assignelem(): OCI-22165: given index [1] must be in the range of %s in %s on line %d
+bool(false)
+bool(false)
+Test 2
+
+Warning: OCI-Collection::assignelem(): OCI-22165: given index [1] must be in the range of %s in %s on line %d
+bool(false)
+bool(false)
+Test 3
+
+Warning: OCI-Collection::assignelem(): OCI-22165: given index [1] must be in the range of %s in %s on line %d
+bool(false)
+bool(false)
+Test 4
+
+Warning: OCI-Collection::append(): OCI-01840: input value not long enough for date format in %s on line %d
+bool(false)
+
+Warning: OCI-Collection::assignelem(): OCI-22165: given index [1] must be in the range of %s in %s on line %d
+bool(false)
+bool(false)
+Done
diff --git a/ext/oci8/tests/connect.inc b/ext/oci8/tests/connect.inc
index 887c8fdaa..452976e8f 100644
--- a/ext/oci8/tests/connect.inc
+++ b/ext/oci8/tests/connect.inc
@@ -1,13 +1,6 @@
<?php
-/*
- * Please, change user, password and dbase to match your configuration.
- *
- * */
-
-$user = "system";
-$password = "system";
-$dbase = "oracle";
+include "details.inc";
/*
* You should have privileges to create tables in this schema
diff --git a/ext/oci8/tests/connect_without_oracle_home.phpt b/ext/oci8/tests/connect_without_oracle_home.phpt
index 513d60cef..840693476 100644
--- a/ext/oci8/tests/connect_without_oracle_home.phpt
+++ b/ext/oci8/tests/connect_without_oracle_home.phpt
@@ -1,7 +1,12 @@
--TEST--
oci_connect() without ORACLE_HOME set (OCIServerAttach() segfaults)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+/* disabled for a while */
+die("skip");
+
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/connect_without_oracle_home_old.phpt b/ext/oci8/tests/connect_without_oracle_home_old.phpt
index 68b11de15..171ff45f5 100644
--- a/ext/oci8/tests/connect_without_oracle_home_old.phpt
+++ b/ext/oci8/tests/connect_without_oracle_home_old.phpt
@@ -1,7 +1,11 @@
--TEST--
ocilogon() without ORACLE_HOME set (OCIServerAttach() segfaults)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+/* disabled for a while */
+die("skip");
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/define2.phpt b/ext/oci8/tests/define2.phpt
new file mode 100644
index 000000000..e8c5f8a99
--- /dev/null
+++ b/ext/oci8/tests/define2.phpt
@@ -0,0 +1,87 @@
+--TEST--
+Test oci_define_by_name types
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$stmt = oci_parse($c, "create table phptestrawtable( id number(10), fileimage raw(1000))");
+oci_execute($stmt);
+
+$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)");
+$i=1;
+$fileimage = file_get_contents( dirname(__FILE__)."/test.gif");
+$fileimage = substr($fileimage, 0, 300);
+var_dump(md5($fileimage));
+
+oci_bind_by_name( $stmt, ":id", $i, -1);
+oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_BIN);
+oci_execute($stmt, OCI_DEFAULT);
+oci_commit($c);
+
+echo "Test 1\n";
+$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
+var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi));
+oci_execute($stmt);
+
+while (oci_fetch($stmt)) {
+ var_dump($fi);
+ echo "file md5:" . md5($fi) . "\n";
+}
+
+echo "Test 2\n";
+$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
+var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi));
+oci_execute($stmt);
+
+while (oci_fetch($stmt)) {
+ var_dump($fi);
+ echo "file md5:" . md5($fi) . "\n";
+}
+
+echo "Test 3 - test repeatability\n";
+$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
+var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi, SQLT_STR));
+oci_execute($stmt);
+
+while (oci_fetch($stmt)) {
+ var_dump($fi);
+ echo "file md5:" . md5($fi) . "\n";
+}
+
+echo "Test 4 - wrong type\n";
+$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
+var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi, SQLT_RSET));
+oci_execute($stmt);
+
+while (oci_fetch($stmt)) {
+ var_dump($fi);
+ echo "file md5:" . md5($fi) . "\n";
+}
+
+$stmt = oci_parse($c, "drop table phptestrawtable");
+oci_execute($stmt);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(32) "88b274d7a257ac6f70435b83abd4e26e"
+Test 1
+bool(true)
+string(300) "GIF89%s"
+file md5:88b274d7a257ac6f70435b83abd4e26e
+Test 2
+bool(true)
+string(300) "GIF89%s"
+file md5:88b274d7a257ac6f70435b83abd4e26e
+Test 3 - test repeatability
+bool(true)
+string(600) "47494638396178004300E66A007F82B839374728252ACCCDE2A1A4CBD3D5E7B2B4D44342588386B98283B35252729092C2C2C4DEAAACD04C4B635B5C83DDDEEC3B383C6E71A56A6D9D61638D7579B17B7EB5E5E6F0999CC68C8DC1B9BAD96B6B924E4E6B7174A97A7AA3888BBD7274A37473988E90C15A5B7EE2E3EF7B7DADA4A5D06D70A27276AC9596C8BBBDD97478AE8588BB9295C3D8D9EA9292C46466926B6E9FA5A8CE9496C52E2B2F535168B3B4D76C6A8C5C5B768A8DBF666896686A9A9C9FC8312E39AEB0D39C9CCD5556789EA1CA9699C58182AF6769973F3D50BCBEDA5E60899899C88C8EBF898ABA57587CB6B7D7D5D7E8221E206C6F9ECED0E4BFC0DC777BB47678A75F5E7D9999CC6E6F987377AE221E1FFFFFFF908E8F595657C7C6C7EEEEF5D5D4D5F6F6"
+file md5:80bb3201e2a8bdcb8ab3e1a44a82bb8a
+Test 4 - wrong type
+bool(true)
+
+Warning: oci_fetch(): ORA-00932: inconsistent datatypes%s on line %d
+Done
diff --git a/ext/oci8/tests/define3.phpt b/ext/oci8/tests/define3.phpt
new file mode 100644
index 000000000..d30db637c
--- /dev/null
+++ b/ext/oci8/tests/define3.phpt
@@ -0,0 +1,105 @@
+--TEST--
+Test oci_define_by_name() LOB descriptor
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$stmt = oci_parse($c, "create table phpdefblobtable( id number(10), fileimage blob)");
+oci_execute($stmt);
+
+// Load data
+$stmt = oci_parse ($c, "insert into phpdefblobtable (id, fileimage) values (:id, empty_blob()) returning fileimage into :fileimage");
+$fileimage = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($stmt,":id",$id);
+oci_bind_by_name($stmt,":fileimage",$fileimage,-1,OCI_B_BLOB);
+$id = 1;
+oci_execute($stmt, OCI_DEFAULT);
+$fileimage->savefile(dirname(__FILE__)."/test.gif");
+$data = $fileimage->load();
+var_dump(md5($data)); // original md5
+oci_commit($c);
+
+// New row with different data
+$id = 2;
+$data = strrev($data);
+var_dump(md5($data));
+oci_execute($stmt, OCI_DEFAULT);
+$fileimage->save($data);
+oci_commit($c);
+
+echo "Test 1\n";
+$stmt = oci_parse($c, "SELECT fileimage FROM phpdefblobtable");
+var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $f));
+oci_execute($stmt);
+
+while (oci_fetch($stmt)) {
+ var_dump($f);
+ echo "file md5:" . md5($f->load()) . "\n";
+}
+
+echo "Test 2\n";
+$stmt = oci_parse($c, "SELECT fileimage FROM phpdefblobtable");
+var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $outdata, SQLT_STR));
+oci_execute($stmt);
+
+while (oci_fetch($stmt)) {
+ echo "file md5:" . md5($outdata) . "\n";
+}
+
+echo "Test 3\n";
+$stmt = oci_parse($c, "SELECT fileimage FROM phpdefblobtable");
+var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $outdata, SQLT_BIN));
+oci_execute($stmt);
+
+while (oci_fetch($stmt)) {
+ echo "file md5:" . md5($outdata) . "\n";
+}
+
+echo "Test 4\n";
+$fid = oci_new_descriptor($c,OCI_D_LOB);
+$stmt = oci_parse($c, "SELECT fileimage FROM phpdefblobtable");
+var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fid));
+oci_execute($stmt);
+
+while (oci_fetch($stmt)) {
+ echo "file md5:" . md5($fid->load()) . "\n";
+}
+
+$stmt = oci_parse($c, "drop table phpdefblobtable");
+oci_execute($stmt);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+string(32) "614fcbba1effb7caa27ef0ef25c27fcf"
+string(32) "06d4f219d946c74d748d43932cd9dcb2"
+Test 1
+bool(true)
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+file md5:614fcbba1effb7caa27ef0ef25c27fcf
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+file md5:06d4f219d946c74d748d43932cd9dcb2
+Test 2
+bool(true)
+
+Warning: oci_fetch(): ORA-00932: %s on line %d
+Test 3
+bool(true)
+file md5:614fcbba1effb7caa27ef0ef25c27fcf
+file md5:06d4f219d946c74d748d43932cd9dcb2
+Test 4
+bool(true)
+file md5:614fcbba1effb7caa27ef0ef25c27fcf
+file md5:06d4f219d946c74d748d43932cd9dcb2
+Done
+
diff --git a/ext/oci8/tests/define4.phpt b/ext/oci8/tests/define4.phpt
new file mode 100644
index 000000000..6fd9f5b93
--- /dev/null
+++ b/ext/oci8/tests/define4.phpt
@@ -0,0 +1,67 @@
+--TEST--
+oci_define_by_name() on partial number of columns
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_table.inc";
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (value, string) VALUES (1234, '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 value, string FROM ".$table_name."");
+
+echo "Test 1\n";
+// Only one of the two columns is defined
+var_dump(oci_define_by_name($stmt, "STRING", $string));
+
+oci_execute($stmt);
+
+echo "Test 2\n";
+
+while (oci_fetch($stmt)) {
+ var_dump(oci_result($stmt, 'VALUE'));
+ var_dump($string);
+ var_dump(oci_result($stmt, 'STRING'));
+ var_dump($string);
+ var_dump(oci_result($stmt, 'VALUE'));
+ var_dump(oci_result($stmt, 'STRING'));
+}
+
+echo "Test 3\n";
+var_dump(oci_free_statement($stmt));
+var_dump($string);
+var_dump(oci_result($stmt, 'STRING'));
+
+require dirname(__FILE__)."/drop_table.inc";
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1
+bool(true)
+Test 2
+string(4) "1234"
+string(4) "some"
+string(4) "some"
+string(4) "some"
+string(4) "1234"
+string(4) "some"
+Test 3
+bool(true)
+string(4) "some"
+
+Warning: oci_result(): %d is not a valid oci8 statement resource in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/oci8/tests/define5.phpt b/ext/oci8/tests/define5.phpt
new file mode 100644
index 000000000..c439b1d64
--- /dev/null
+++ b/ext/oci8/tests/define5.phpt
@@ -0,0 +1,64 @@
+--TEST--
+oci_define_by_name() for statement re-execution
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_table.inc";
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, string) VALUES (1, 'some')";
+$s = oci_parse($c, $insert_sql);
+var_dump(oci_execute($s));
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, string) VALUES (2, 'thing')";
+$s = oci_parse($c, $insert_sql);
+var_dump(oci_execute($s));
+
+echo "Test 1 - must do define before execute\n";
+$stmt = oci_parse($c, "SELECT string FROM ".$table_name." where id = 1");
+oci_execute($stmt);
+var_dump(oci_define_by_name($stmt, "STRING", $string));
+while (oci_fetch($stmt)) {
+ var_dump($string); // gives NULL
+ var_dump(oci_result($stmt, 'STRING'));
+}
+
+echo "Test 2 - normal define order\n";
+$stmt = oci_parse($c, "SELECT string FROM ".$table_name." where id = 1");
+var_dump(oci_define_by_name($stmt, "STRING", $string));
+oci_execute($stmt);
+
+while (oci_fetch($stmt)) {
+ var_dump($string);
+}
+
+echo "Test 3 - no new define done\n";
+$stmt = oci_parse($c, "SELECT string FROM ".$table_name." where id = 2");
+oci_execute($stmt);
+while (oci_fetch($stmt)) {
+ var_dump($string); // not updated with new value
+ var_dump(oci_result($stmt, 'STRING'));
+}
+
+require dirname(__FILE__)."/drop_table.inc";
+
+echo "Done\n";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+Test 1 - must do define before execute
+bool(true)
+NULL
+string(4) "some"
+Test 2 - normal define order
+bool(true)
+string(4) "some"
+Test 3 - no new define done
+string(4) "some"
+string(5) "thing"
+Done
+
diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc
new file mode 100644
index 000000000..6cf13ac72
--- /dev/null
+++ b/ext/oci8/tests/details.inc
@@ -0,0 +1,16 @@
+<?php
+
+/*
+* Please, change user, password and dbase to match your configuration.
+*
+* */
+
+$user = "system";
+$password = "system";
+$dbase = "oracle";
+
+/* Set this variable to TRUE if Oracle is installed @ localhost */
+
+$oracle_on_localhost = FALSE;
+
+?>
diff --git a/ext/oci8/tests/error2.phpt b/ext/oci8/tests/error2.phpt
new file mode 100644
index 000000000..13ea6cebe
--- /dev/null
+++ b/ext/oci8/tests/error2.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Exercise error code for SUCCESS_WITH_INFO
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+ini_set('error_reporting', E_ALL);
+
+$s = oci_parse($c, "create or replace procedure myproc as begin bogus end;");
+$e = @oci_execute($s);
+if (!$e) {
+ $es = oci_error($s);
+ echo $es['message']."\n";
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+ORA-24344: success with compilation error
+Done
diff --git a/ext/oci8/tests/fetch_all2.phpt b/ext/oci8/tests/fetch_all2.phpt
new file mode 100644
index 000000000..ff44cac70
--- /dev/null
+++ b/ext/oci8/tests/fetch_all2.phpt
@@ -0,0 +1,242 @@
+--TEST--
+oci_fetch_all() - 2
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+
+$s = oci_parse($c, $insert_sql);
+
+for ($i = 0; $i<3; $i++) {
+ oci_execute($s);
+}
+
+oci_commit($c);
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+$s = oci_parse($c, $select_sql);
+
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all));
+var_dump($all);
+
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, 10, OCI_FETCHSTATEMENT_BY_ROW));
+var_dump($all);
+
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, -1, -1, OCI_FETCHSTATEMENT_BY_ROW));
+var_dump($all);
+
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, 2, OCI_FETCHSTATEMENT_BY_ROW+OCI_NUM));
+var_dump($all);
+
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, 2, OCI_NUM));
+var_dump($all);
+
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, 1, OCI_BOTH));
+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(3) {
+ [0]=>
+ array(5) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+ ["BLOB"]=>
+ NULL
+ ["CLOB"]=>
+ NULL
+ ["STRING"]=>
+ NULL
+ }
+ [1]=>
+ array(5) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+ ["BLOB"]=>
+ NULL
+ ["CLOB"]=>
+ NULL
+ ["STRING"]=>
+ NULL
+ }
+ [2]=>
+ array(5) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+ ["BLOB"]=>
+ NULL
+ ["CLOB"]=>
+ NULL
+ ["STRING"]=>
+ NULL
+ }
+}
+int(0)
+array(0) {
+}
+int(2)
+array(2) {
+ [0]=>
+ array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+ }
+ [1]=>
+ array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+ }
+}
+int(2)
+array(5) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ }
+ [4]=>
+ array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ }
+}
+int(1)
+array(5) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [4]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+Done
diff --git a/ext/oci8/tests/fetch_all3.phpt b/ext/oci8/tests/fetch_all3.phpt
new file mode 100644
index 000000000..503e5dd88
--- /dev/null
+++ b/ext/oci8/tests/fetch_all3.phpt
@@ -0,0 +1,577 @@
+--TEST--
+oci_fetch_all() - all combinations of flags
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (:idbv,:vbv)";
+
+$s = oci_parse($c, $insert_sql);
+oci_bind_by_name($s, ":idbv", $idbv, SQLT_INT);
+oci_bind_by_name($s, ":vbv", $vbv, SQLT_INT);
+
+for ($i = 1; $i <= 4; $i++) {
+ $idbv = $i;
+ $vbv = -$i;
+ oci_execute($s, OCI_DEFAULT);
+}
+
+oci_commit($c);
+
+$select_sql = "SELECT ID, VALUE FROM ".$schema."".$table_name." order by id";
+
+$s = oci_parse($c, $select_sql);
+
+echo "None\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1));
+var_dump($all);
+
+echo "OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_COLUMN\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_COLUMN));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM|OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_NUM\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_NUM));
+var_dump($all);
+
+echo "OCI_NUM|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_NUM|OCI_ASSOC));
+var_dump($all);
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+None
+int(4)
+array(2) {
+ ["ID"]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ ["VALUE"]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_ASSOC
+int(4)
+array(2) {
+ ["ID"]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ ["VALUE"]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_COLUMN
+int(4)
+array(2) {
+ ["ID"]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ ["VALUE"]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC
+int(4)
+array(2) {
+ ["ID"]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ ["VALUE"]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM
+int(4)
+array(2) {
+ [0]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC
+int(4)
+array(2) {
+ [0]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "2"
+ ["VALUE"]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "3"
+ ["VALUE"]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "4"
+ ["VALUE"]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_ASSOC
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "2"
+ ["VALUE"]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "3"
+ ["VALUE"]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "4"
+ ["VALUE"]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "2"
+ ["VALUE"]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "3"
+ ["VALUE"]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "4"
+ ["VALUE"]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "2"
+ ["VALUE"]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "3"
+ ["VALUE"]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "4"
+ ["VALUE"]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ string(1) "4"
+ [1]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ string(1) "4"
+ [1]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ string(1) "4"
+ [1]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM|OCI_ASSOC
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ string(1) "4"
+ [1]=>
+ string(2) "-4"
+ }
+}
+OCI_NUM
+int(4)
+array(2) {
+ [0]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_NUM|OCI_ASSOC
+int(4)
+array(2) {
+ [0]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+Done
diff --git a/ext/oci8/tests/function_aliases.phpt b/ext/oci8/tests/function_aliases.phpt
new file mode 100644
index 000000000..4c6ce8375
--- /dev/null
+++ b/ext/oci8/tests/function_aliases.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Existence of old function aliases
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+var_dump(oci_free_cursor());
+var_dump(ocifreecursor());
+var_dump(ocibindbyname());
+var_dump(ocidefinebyname());
+var_dump(ocicolumnisnull());
+var_dump(ocicolumnname());
+var_dump(ocicolumnsize());
+var_dump(ocicolumnscale());
+var_dump(ocicolumnprecision());
+var_dump(ocicolumntype());
+var_dump(ocicolumntyperaw());
+var_dump(ociexecute());
+var_dump(ocicancel());
+var_dump(ocifetch());
+var_dump(ocifetchstatement());
+var_dump(ocifreestatement());
+var_dump(ociinternaldebug());
+var_dump(ocinumcols());
+var_dump(ociparse());
+var_dump(ocinewcursor());
+var_dump(ociresult());
+var_dump(ociserverversion());
+var_dump(ocistatementtype());
+var_dump(ocirowcount());
+var_dump(ocilogoff());
+var_dump(ocilogon());
+var_dump(ocinlogon());
+var_dump(ociplogon());
+var_dump(ocierror());
+var_dump(ocifreedesc());
+var_dump(ocisavelob());
+var_dump(ocisavelobfile());
+var_dump(ociwritelobtofile());
+var_dump(ociloadlob());
+var_dump(ocicommit());
+var_dump(ocirollback());
+var_dump(ocinewdescriptor());
+var_dump(ocisetprefetch());
+var_dump(ocipasswordchange());
+var_dump(ocifreecollection());
+var_dump(ocinewcollection());
+var_dump(ocicollappend());
+var_dump(ocicollgetelem());
+var_dump(ocicollassignelem());
+var_dump(ocicollsize());
+var_dump(ocicollmax());
+var_dump(ocicolltrim());
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Warning: oci_free_cursor() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocifreecursor() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocibindbyname() expects at least 3 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocidefinebyname() expects at least 3 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocicolumnisnull() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ocicolumnname() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ocicolumnsize() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ocicolumnscale() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ocicolumnprecision() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ocicolumntype() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ocicolumntyperaw() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ociexecute() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocicancel() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocifetch() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocifetchstatement() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocifreestatement() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ociinternaldebug() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocinumcols() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ociparse() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocinewcursor() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ociresult() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ociserverversion() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocistatementtype() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocirowcount() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocilogoff() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocilogon() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocinlogon() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ociplogon() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+bool(false)
+
+Warning: ocifreedesc() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocisavelob() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocisavelobfile() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ociwritelobtofile() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ociloadlob() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocicommit() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocirollback() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocinewdescriptor() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocisetprefetch() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: Wrong parameter count for ocipasswordchange() in %s on line %d
+NULL
+
+Warning: ocifreecollection() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocinewcollection() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocicollappend() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocicollgetelem() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocicollassignelem() expects exactly 3 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocicollsize() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocicollmax() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocicolltrim() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+Done
diff --git a/ext/oci8/tests/lob_020.phpt b/ext/oci8/tests/lob_020.phpt
index edd0f0249..6564dede9 100644
--- a/ext/oci8/tests/lob_020.phpt
+++ b/ext/oci8/tests/lob_020.phpt
Binary files differ
diff --git a/ext/oci8/tests/lob_027.phpt b/ext/oci8/tests/lob_027.phpt
new file mode 100644
index 000000000..8b49b1ac5
--- /dev/null
+++ b/ext/oci8/tests/lob_027.phpt
@@ -0,0 +1,103 @@
+--TEST--
+oci_lob_truncate()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob);
+
+$str = "this is a biiiig faaat test string. why are you reading it, I wonder? =)";
+var_dump($blob->write($str));
+
+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));
+oci_commit($c);
+
+for ($i = 5; $i >= 0; $i--) {
+
+ $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['BLOB']->load());
+ var_dump($row['BLOB']->truncate(($i-1)*10));
+
+ 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['BLOB']->load());
+var_dump($row['BLOB']->truncate(-1));
+var_dump($row['BLOB']->truncate(0));
+
+oci_commit($c);
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+int(72)
+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(72) "this is a biiiig faaat test string. why are you reading it, I wonder? =)"
+bool(true)
+string(40) "this is a biiiig faaat test string. why "
+bool(true)
+string(30) "this is a biiiig faaat test st"
+bool(true)
+string(20) "this is a biiiig faa"
+bool(true)
+string(10) "this is a "
+bool(true)
+string(0) ""
+
+Warning: OCI-Lob::truncate(): Length must be greater than or equal to zero in %s on line %d
+bool(false)
+string(0) ""
+
+Warning: OCI-Lob::truncate(): Length must be greater than or equal to zero in %s on line %d
+bool(false)
+bool(true)
+Done
diff --git a/ext/oci8/tests/lob_028.phpt b/ext/oci8/tests/lob_028.phpt
new file mode 100644
index 000000000..f049abdba
--- /dev/null
+++ b/ext/oci8/tests/lob_028.phpt
@@ -0,0 +1,84 @@
+--TEST--
+Test descriptor types for oci_new_descriptor()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Successful statements
+
+$d = oci_new_descriptor($c, OCI_D_FILE);
+var_dump($d);
+
+$d = oci_new_descriptor($c, OCI_DTYPE_FILE);
+var_dump($d);
+
+$d = oci_new_descriptor($c, OCI_D_LOB);
+var_dump($d);
+
+$d = oci_new_descriptor($c, OCI_DTYPE_LOB);
+var_dump($d);
+
+$d = oci_new_descriptor($c, OCI_D_ROWID);
+var_dump($d);
+
+$d = oci_new_descriptor($c, OCI_DTYPE_ROWID);
+var_dump($d);
+
+// Unsuccessful statements
+
+$d = oci_new_descriptor($c, OCI_B_CLOB);
+var_dump($d);
+
+$d = oci_new_descriptor($c, OCI_B_CLOB);
+var_dump($d);
+
+$d = oci_new_descriptor($c, OCI_DEFAULT);
+var_dump($d);
+
+$d = oci_new_descriptor($c, 1);
+var_dump($d);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+
+Warning: oci_new_descriptor(): Unknown descriptor type %d. in %s on line %d
+NULL
+
+Warning: oci_new_descriptor(): Unknown descriptor type %d. in %s on line %d
+NULL
+
+Warning: oci_new_descriptor(): Unknown descriptor type %d. in %s on line %d
+NULL
+
+Warning: oci_new_descriptor(): Unknown descriptor type %d. in %s on line %d
+NULL
+Done
diff --git a/ext/oci8/tests/lob_029.phpt b/ext/oci8/tests/lob_029.phpt
new file mode 100644
index 000000000..6c310981b
--- /dev/null
+++ b/ext/oci8/tests/lob_029.phpt
@@ -0,0 +1,119 @@
+--TEST--
+reading/writing BFILE LOBs
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
+include "details.inc";
+if (empty($oracle_on_localhost)) die("skip this test won't work with remote Oracle");
+?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$realdirname = dirname(__FILE__);
+$realfilename1 = "oci8bfiletest1.txt";
+$fullname1 = $realdirname."/".$realfilename1;
+$realfilename2 = "oci8bfiletest2.txt";
+$fullname2 = $realdirname."/".$realfilename2;
+$realfilename3 = "oci8bfiletest3.txt";
+$fullname3 = $realdirname."/".$realfilename3;
+
+// Setup
+$s = oci_parse($c, "create directory TestDir as '$realdirname'");
+oci_execute($s);
+
+file_put_contents($fullname1, 'Some text in the bfile 1');
+file_put_contents($fullname2, 'Some text in the bfile 2');
+file_put_contents($fullname3, 'Some text in the bfile 3');
+
+$s = oci_parse($c, "create table FileTest (FileNum number, FileDesc varchar2(30), Image bfile)");
+oci_execute($s);
+
+$s = oci_parse($c, "insert into FileTest (FileNum, FileDesc, Image) values (1, 'Description 1', bfilename('TESTDIR', '$realfilename1'))");
+oci_execute($s);
+
+$s = oci_parse($c, "insert into FileTest (FileNum, FileDesc, Image) values (2, 'Description 2', bfilename('TESTDIR', '$realfilename2'))");
+oci_execute($s);
+
+$s = oci_parse($c, "insert into FileTest (FileNum, FileDesc, Image) values (3, 'Description 3', bfilename('TESTDIR', '$realfilename3'))");
+oci_execute($s);
+
+// Run tests
+
+echo "Test 1. Check how many rows in the table\n";
+
+$s = oci_parse($c, "select count(*) numrows from FileTest");
+oci_execute($s);
+oci_fetch_all($s, $res);
+var_dump($res);
+
+echo "Test 2\n";
+$s = oci_parse($c, "select * from FileTest order by FileNum");
+oci_execute($s);
+oci_fetch_all($s, $res);
+var_dump($res);
+
+echo "Test 3\n";
+$d = oci_new_descriptor($c, OCI_D_FILE);
+
+$s = oci_parse($c, "insert into FileTest (FileNum, FileDesc, Image) values (2, 'Description 2', bfilename('TESTDIR', '$realfilename1')) returning Image into :im");
+oci_bind_by_name($s, ":im", $d, -1, OCI_B_BFILE);
+oci_execute($s);
+
+$r = $d->read(40);
+var_dump($r);
+
+unlink($fullname1);
+unlink($fullname2);
+unlink($fullname3);
+
+$s = oci_parse($c, "drop table FileTest");
+oci_execute($s);
+
+$s = oci_parse($c, "drop directory TestDir");
+oci_execute($s);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Test 1. Check how many rows in the table
+array(1) {
+ ["NUMROWS"]=>
+ array(1) {
+ [0]=>
+ string(1) "3"
+ }
+}
+Test 2
+array(3) {
+ ["FILENUM"]=>
+ array(3) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ }
+ ["FILEDESC"]=>
+ array(3) {
+ [0]=>
+ string(13) "Description 1"
+ [1]=>
+ string(13) "Description 2"
+ [2]=>
+ string(13) "Description 3"
+ }
+ ["IMAGE"]=>
+ array(3) {
+ [0]=>
+ string(24) "Some text in the bfile 1"
+ [1]=>
+ string(24) "Some text in the bfile 2"
+ [2]=>
+ string(24) "Some text in the bfile 3"
+ }
+}
+Test 3
+string(24) "Some text in the bfile 1"
+Done \ No newline at end of file
diff --git a/ext/oci8/tests/lob_030.phpt b/ext/oci8/tests/lob_030.phpt
new file mode 100644
index 000000000..86b2956a5
--- /dev/null
+++ b/ext/oci8/tests/lob_030.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Test piecewise fetch of CLOBs equal to, and larger than PHP_OCI_LOB_BUFFER_SIZE
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+function insert_verify($c, $tn, $id, $length)
+{
+ // Insert the data
+ $ora_sql = "INSERT INTO
+ ".$tn." (id, clob)
+ VALUES (".$id.", empty_clob())
+ RETURNING
+ clob
+ INTO :v_clob ";
+
+ $statement = oci_parse($c,$ora_sql);
+ $clob = oci_new_descriptor($c,OCI_D_LOB);
+ oci_bind_by_name($statement,":v_clob", $clob, -1, OCI_B_CLOB);
+ oci_execute($statement, OCI_DEFAULT);
+
+ $data = str_pad("x", $length, "x");
+ $clob->write($data);
+
+ // Verify the data
+ $select_sql = "SELECT clob FROM ".$tn." where id = ".$id;
+ $s = oci_parse($c, $select_sql);
+ oci_execute($s);
+
+ $row = oci_fetch_array($s, OCI_RETURN_LOBS);
+
+ var_dump(strlen($row[0]));
+}
+
+echo "Test 1: A CLOB with an even number of bytes\n";
+insert_verify($c, $schema.$table_name, 1, 1050000);
+
+echo "Test 2: A CLOB with an odd number of bytes\n";
+insert_verify($c, $schema.$table_name, 2, 1050001);
+
+echo "Test 3: A CLOB of 1048576 bytes (== size of PHP_OCI_LOB_BUFFER_SIZE at time of test creation)\n";
+insert_verify($c, $schema.$table_name, 3, 1048576);
+
+echo "Test 4: A CLOB of 1049028 bytes (the value used for chunks in the code)\n";
+insert_verify($c, $schema.$table_name, 4, 1049028);
+
+echo "Test 5: A CLOB of 1049028-1 bytes\n";
+insert_verify($c, $schema.$table_name, 5, 1049028-1);
+
+echo "Test 6: A CLOB of 1049028+1 bytes\n";
+insert_verify($c, $schema.$table_name, 6, 1049028+1);
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1: A CLOB with an even number of bytes
+int(1050000)
+Test 2: A CLOB with an odd number of bytes
+int(1050001)
+Test 3: A CLOB of 1048576 bytes (== size of PHP_OCI_LOB_BUFFER_SIZE at time of test creation)
+int(1048576)
+Test 4: A CLOB of 1049028 bytes (the value used for chunks in the code)
+int(1049028)
+Test 5: A CLOB of 1049028-1 bytes
+int(1049027)
+Test 6: A CLOB of 1049028+1 bytes
+int(1049029)
+Done
diff --git a/ext/oci8/tests/lob_031.phpt b/ext/oci8/tests/lob_031.phpt
new file mode 100644
index 000000000..a27d53bb3
--- /dev/null
+++ b/ext/oci8/tests/lob_031.phpt
@@ -0,0 +1,107 @@
+--TEST--
+Test LOB->read(), LOB->seek() and LOB->tell() with nul bytes in data
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+$blob->write("test");
+$blob->tell();
+$blob->seek(10, OCI_SEEK_CUR);
+$blob->write("string");
+$blob->flush();
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name;
+$s = oci_parse($c, $select_sql);
+oci_execute($s);
+$row = oci_fetch_array($s);
+
+$row[0]->read(3);
+echo " 1. ".$row[0]->tell(). "\n";
+
+$row[0]->read(3);
+echo " 2. ".$row[0]->tell(). "\n";
+
+$row[0]->read(3);
+echo " 3. ".$row[0]->tell(). "\n";
+
+$row[0]->read(6);
+echo " 4. ".$row[0]->tell(). "\n";
+
+$row[0]->read(4);
+echo " 5. ".$row[0]->tell(). "\n";
+
+// Read past end
+$row[0]->read(5);
+echo " 6. ".$row[0]->tell(). "\n";
+
+$row[0]->read(1);
+echo " 8. ".$row[0]->tell(). "\n";
+
+// Now seek
+$row[0]->seek(1);
+echo " 9. ".$row[0]->tell(). "\n";
+
+$row[0]->seek(8);
+echo "10. ".$row[0]->tell(). "\n";
+
+$row[0]->seek(20);
+echo "11. ".$row[0]->tell(). "\n";
+
+// Seek past end
+$row[0]->seek(25);
+echo "12. ".$row[0]->tell(). "\n";
+
+// Seek past end
+$row[0]->seek(2, OCI_SEEK_SET);
+echo "13. ".$row[0]->tell(). "\n";
+
+// Move on 2 more
+$row[0]->seek(2, OCI_SEEK_CUR);
+echo "14. ".$row[0]->tell(). "\n";
+
+// Move 3 past the end
+$row[0]->seek(3, OCI_SEEK_END);
+echo "15. ".$row[0]->tell(). "\n";
+
+// Move 4 before the end
+$row[0]->seek(-4, OCI_SEEK_END);
+echo "16. ".$row[0]->tell(). "\n";
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+ 1. 3
+ 2. 6
+ 3. 9
+ 4. 15
+ 5. 19
+ 6. 20
+ 8. 20
+ 9. 1
+10. 8
+11. 20
+12. 25
+13. 2
+14. 4
+15. 23
+16. 16
+Done
diff --git a/ext/oci8/tests/lob_032.phpt b/ext/oci8/tests/lob_032.phpt
new file mode 100644
index 000000000..5d6ff6ec9
--- /dev/null
+++ b/ext/oci8/tests/lob_032.phpt
@@ -0,0 +1,33 @@
+--TEST--
+oci_lob_write() and friends
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (id, clob)
+ VALUES (2, empty_clob())
+ RETURNING
+ clob
+ INTO :v_clob ";
+
+$statement = oci_parse($c,$ora_sql);
+$clob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_clob", $clob,-1,OCI_B_CLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+oci_commit($c); // This will cause subsequent ->write() to fail
+$clob->write("data");
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Warning: OCI-Lob::write(): ORA-22990: %s in %s on line 19
+Done
diff --git a/ext/oci8/tests/lob_033.phpt b/ext/oci8/tests/lob_033.phpt
new file mode 100644
index 000000000..5647cd9a4
--- /dev/null
+++ b/ext/oci8/tests/lob_033.phpt
@@ -0,0 +1,38 @@
+--TEST--
+various oci_lob_write() error messages
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (id, blob)
+ VALUES (2, empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+
+$blob->save("");
+
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob->save(""));
+var_dump($blob->save("data", 100));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Warning: OCI-Lob::save(): OCI_INVALID_HANDLE in %s on line %d
+bool(true)
+bool(true)
+Done
diff --git a/ext/oci8/tests/lob_034.phpt b/ext/oci8/tests/lob_034.phpt
new file mode 100644
index 000000000..6bf4058e7
--- /dev/null
+++ b/ext/oci8/tests/lob_034.phpt
@@ -0,0 +1,50 @@
+--TEST--
+lob buffering - 2
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob->getBuffering());
+var_dump($blob->setBuffering(false));
+var_dump($blob->setBuffering(false));
+var_dump($blob->setBuffering(true));
+var_dump($blob->setBuffering(true));
+var_dump($blob->flush());
+var_dump($blob->flush(0));
+var_dump($blob->flush(-1));
+
+oci_commit($c);
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: OCI-Lob::flush(): Invalid flag value: -1 in %s on line %d
+bool(false)
+Done
diff --git a/ext/oci8/tests/lob_035.phpt b/ext/oci8/tests/lob_035.phpt
new file mode 100644
index 000000000..6e1f5a735
--- /dev/null
+++ b/ext/oci8/tests/lob_035.phpt
@@ -0,0 +1,108 @@
+--TEST--
+oci_lob_copy() - 2
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (id, blob)
+ VALUES (1, empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob->write("some string here. string, I said"));
+oci_commit($c);
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (id, blob)
+ VALUES (2, empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 1";
+$s = oci_parse($c, $select_sql);
+oci_execute($s);
+
+$row1 = oci_fetch_array($s);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 2 FOR UPDATE";
+$s = oci_parse($c, $select_sql);
+oci_execute($s, OCI_DEFAULT);
+
+$row2 = oci_fetch_array($s);
+
+$dummy = oci_new_descriptor($c, OCI_D_LOB);
+
+var_dump(oci_lob_copy($dummy, $row1[0]));
+var_dump(oci_lob_copy($row2[0], $dummy));
+
+var_dump(oci_lob_copy($row2[0], $row1[0], 0));
+var_dump(oci_lob_copy($row2[0], $row1[0], -1));
+var_dump(oci_lob_copy($row2[0], $row1[0], 100000));
+
+var_dump(oci_lob_size());
+var_dump(oci_lob_size($row2[0]));
+unset($dummy->descriptor);
+var_dump(oci_lob_size($dummy));
+
+oci_rollback($c);
+oci_rollback($c);
+oci_commit($c);
+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";
+
+?>
+--EXPECTF--
+int(32)
+
+Warning: oci_lob_copy(): OCI_INVALID_HANDLE in %s on line %d
+bool(false)
+
+Warning: oci_lob_copy(): OCI_INVALID_HANDLE in %s on line %d
+bool(false)
+bool(false)
+
+Warning: oci_lob_copy(): Length parameter must be greater than 0 in %s on line %d
+bool(false)
+bool(true)
+
+Warning: oci_lob_size() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+int(0)
+
+Warning: oci_lob_size(): Unable to find descriptor property in %s on line %d
+bool(false)
+array(2) {
+ [0]=>
+ string(0) ""
+ ["BLOB"]=>
+ string(0) ""
+}
+Done
diff --git a/ext/oci8/tests/lob_036.phpt b/ext/oci8/tests/lob_036.phpt
new file mode 100644
index 000000000..e72c1cf08
--- /dev/null
+++ b/ext/oci8/tests/lob_036.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Exercise cleanup code when LOB buffering is on
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$s = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_DTYPE_LOB);
+
+
+oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($blob->write("test"));
+var_dump($blob->setBuffering(true));
+var_dump($blob->write("test"));
+
+$blob = null;
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+int(4)
+bool(true)
+int(4)
+Done
diff --git a/ext/oci8/tests/lob_037.phpt b/ext/oci8/tests/lob_037.phpt
new file mode 100644
index 000000000..228f5e812
--- /dev/null
+++ b/ext/oci8/tests/lob_037.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Fetching two different lobs and using them after fetch
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+/* insert the first LOB */
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$s = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_DTYPE_LOB);
+
+oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($blob->write("first lob data"));
+oci_commit($c);
+
+/* insert the second LOB */
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$s = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_DTYPE_LOB);
+
+oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($blob->write("second lob data"));
+oci_commit($c);
+
+/* select both */
+
+$ora_sql = "SELECT blob FROM ".$schema.$table_name;
+$s = oci_parse($c,$ora_sql);
+oci_execute($s, OCI_DEFAULT);
+
+$rows = array();
+$rows[0] = oci_fetch_assoc($s);
+$rows[1] = oci_fetch_assoc($s);
+
+var_dump($rows[0]['BLOB']->read(1000));
+var_dump($rows[1]['BLOB']->read(1000));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+int(14)
+int(15)
+string(14) "first lob data"
+string(15) "second lob data"
+Done
diff --git a/ext/oci8/tests/lob_038.phpt b/ext/oci8/tests/lob_038.phpt
new file mode 100644
index 000000000..91dac66c0
--- /dev/null
+++ b/ext/oci8/tests/lob_038.phpt
@@ -0,0 +1,189 @@
+--TEST--
+Array fetch CLOB and BLOB
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+echo "Test 1: CLOB\n";
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (clob)
+ VALUES (empty_clob())
+ RETURNING
+ clob
+ INTO :v_clob ";
+
+$s = oci_parse($c,$ora_sql);
+$clob = oci_new_descriptor($c,OCI_DTYPE_LOB);
+
+
+oci_bind_by_name($s,":v_clob", $clob,-1,OCI_B_CLOB);
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($clob->save("clob test 1"));
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($clob->save("clob test 2"));
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($clob->save("clob test 3"));
+
+
+$s = oci_parse($c,"select clob from ".$schema.$table_name);
+var_dump(oci_execute($s));
+
+oci_fetch_all($s, $res);
+
+var_dump($res);
+
+
+echo "Test 1b\n";
+
+$s = oci_parse($c, "select clob from ".$schema.$table_name);
+var_dump(oci_execute($s, OCI_DEFAULT));
+while ($row = oci_fetch_array($s, OCI_ASSOC)) {
+ var_dump($row);
+ $result = $row['CLOB']->load();
+ var_dump($result);
+}
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Test 2: BLOB\n";
+
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$s = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_DTYPE_LOB);
+
+
+oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($blob->save("blob test 1"));
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($blob->save("blob test 2"));
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($blob->save("blob test 3"));
+
+$s = oci_parse($c, "select blob from ".$schema.$table_name);
+var_dump(oci_execute($s));
+oci_fetch_all($s, $res);
+var_dump($res);
+
+echo "Test 2b\n";
+
+$s = oci_parse($c, "select blob from ".$schema.$table_name);
+var_dump(oci_execute($s, OCI_DEFAULT));
+while ($row = oci_fetch_array($s, OCI_ASSOC)) {
+ var_dump($row);
+ $result = $row['BLOB']->load();
+ var_dump($result);
+}
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1: CLOB
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+array(1) {
+ ["CLOB"]=>
+ array(3) {
+ [0]=>
+ string(11) "clob test 1"
+ [1]=>
+ string(11) "clob test 2"
+ [2]=>
+ string(11) "clob test 3"
+ }
+}
+Test 1b
+bool(true)
+array(1) {
+ ["CLOB"]=>
+ object(OCI-Lob)#2 (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(11) "clob test 1"
+array(1) {
+ ["CLOB"]=>
+ object(OCI-Lob)#3 (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(11) "clob test 2"
+array(1) {
+ ["CLOB"]=>
+ object(OCI-Lob)#2 (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(11) "clob test 3"
+Test 2: BLOB
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+array(1) {
+ ["BLOB"]=>
+ array(3) {
+ [0]=>
+ string(11) "blob test 1"
+ [1]=>
+ string(11) "blob test 2"
+ [2]=>
+ string(11) "blob test 3"
+ }
+}
+Test 2b
+bool(true)
+array(1) {
+ ["BLOB"]=>
+ object(OCI-Lob)#3 (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(11) "blob test 1"
+array(1) {
+ ["BLOB"]=>
+ object(OCI-Lob)#4 (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(11) "blob test 2"
+array(1) {
+ ["BLOB"]=>
+ object(OCI-Lob)#3 (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(11) "blob test 3"
+Done \ No newline at end of file
diff --git a/ext/oci8/tests/lob_039.phpt b/ext/oci8/tests/lob_039.phpt
new file mode 100644
index 000000000..93251c8d8
--- /dev/null
+++ b/ext/oci8/tests/lob_039.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test CLOB->write() for multiple inserts
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+echo "Test 1: CLOB\n";
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (clob)
+ VALUES (empty_clob())
+ RETURNING
+ clob
+ INTO :v_clob ";
+
+$s = oci_parse($c,$ora_sql);
+$clob = oci_new_descriptor($c,OCI_DTYPE_LOB);
+
+
+oci_bind_by_name($s,":v_clob", $clob,-1,OCI_B_CLOB);
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($clob->write("clob test 1"));
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($clob->write("clob test 2"));
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($clob->write("clob test 3"));
+
+$s = oci_parse($c,"select clob from ".$schema.$table_name);
+var_dump(oci_execute($s));
+
+oci_fetch_all($s, $res);
+
+var_dump($res);
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Test 1: CLOB
+int(11)
+int(11)
+int(11)
+bool(true)
+array(1) {
+ ["CLOB"]=>
+ array(3) {
+ [0]=>
+ string(11) "clob test 1"
+ [1]=>
+ string(11) "clob test 2"
+ [2]=>
+ string(11) "clob test 3"
+ }
+}
+Done
diff --git a/ext/oci8/tests/lob_aliases.phpt b/ext/oci8/tests/lob_aliases.phpt
new file mode 100644
index 000000000..faa59bf12
--- /dev/null
+++ b/ext/oci8/tests/lob_aliases.phpt
@@ -0,0 +1,99 @@
+--TEST--
+LOB method aliases
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+// Function existence
+echo "Test 1\n";
+var_dump(oci_lob_load());
+var_dump(oci_lob_tell());
+var_dump(oci_lob_truncate());
+var_dump(oci_lob_erase());
+var_dump(oci_lob_flush());
+var_dump(ocisetbufferinglob());
+var_dump(ocigetbufferinglob());
+var_dump(oci_lob_rewind());
+var_dump(oci_lob_read());
+var_dump(oci_lob_eof());
+var_dump(oci_lob_seek());
+var_dump(oci_lob_write());
+var_dump(oci_lob_append());
+var_dump(oci_lob_size());
+var_dump(oci_lob_export());
+var_dump(oci_lob_export());
+var_dump(oci_lob_import());
+// No PHP_FE for oci_lob_write_temporary() or oci_lob_close()
+//var_dump(oci_lob_write_temporary());
+//var_dump(oci_lob_close());
+var_dump(oci_lob_save());
+var_dump(oci_lob_import());
+var_dump(oci_free_descriptor());
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1
+
+Warning: oci_lob_load() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_tell() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_truncate() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_erase() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_flush() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocisetbufferinglob() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocigetbufferinglob() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_rewind() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_read() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_eof() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_seek() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_write() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_append() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_size() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_export() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_export() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_import() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_save() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_import() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_free_descriptor() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+Done
diff --git a/ext/oci8/tests/num.phpt b/ext/oci8/tests/num.phpt
index 3c333b4e3..458e3774f 100644
--- a/ext/oci8/tests/num.phpt
+++ b/ext/oci8/tests/num.phpt
@@ -8,32 +8,117 @@ oci_num_*() family
require dirname(__FILE__)."/connect.inc";
require dirname(__FILE__).'/create_table.inc';
+echo "Test 1\n";
+var_dump(ocirowcount());
+var_dump(oci_num_rows());
+var_dump(ocinumcols());
+var_dump(oci_num_fields());
+
$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");
+ die("oci_parse(insert) failed!\n");
}
+echo "Test 2\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
- }
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
}
+echo "Test 3\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+ die("oci_commit() failed!\n");
}
+echo "Test 4\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
+// All rows
$select_sql = "SELECT * FROM ".$schema.$table_name."";
if (!($s = oci_parse($c, $select_sql))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
+}
+
+echo "Test 5a\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+echo "Test 5b\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
+
+if (oci_fetch_all($s,$r) === false) {
+ die("oci_fetch_all(select) failed!\n");
+}
+
+echo "Test 5c\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
+// One row
+$select_sql = "SELECT id, value FROM ".$schema.$table_name." WHERE ROWNUM < 2";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+if (oci_fetch_all($s,$r) === false) {
+ die("oci_fetch_all(select) failed!\n");
+}
+
+echo "Test 6\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
+// No rows
+$select_sql = "SELECT id FROM ".$schema.$table_name." WHERE 1=0";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
+}
+
+if (oci_fetch_all($s,$r) === false) {
+ die("oci_fetch_all(select) failed!\n");
}
+echo "Test 7\n";
var_dump(ocirowcount($s));
var_dump(oci_num_rows($s));
var_dump(ocinumcols($s));
@@ -48,19 +133,89 @@ if (!($s = oci_parse($c, $delete_sql))) {
if (!oci_execute($s)) {
die("oci_execute(delete) failed!\n");
}
+
+echo "Test 8a\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
+
oci_commit($c);
+echo "Test 8b\n";
+var_dump(ocirowcount($s));
var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
require dirname(__FILE__).'/drop_table.inc';
echo "Done\n";
?>
---EXPECT--
+--EXPECTF--
+Test 1
+
+Warning: ocirowcount() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_num_rows() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocinumcols() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_num_fields() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+Test 2
+int(0)
int(0)
int(0)
+int(0)
+Test 3
+int(1)
+int(1)
+int(0)
+int(0)
+Test 4
+int(1)
+int(1)
+int(0)
+int(0)
+Test 5a
+int(0)
+int(0)
+int(0)
+int(0)
+Test 5b
+int(0)
+int(0)
+int(5)
+int(5)
+Test 5c
+int(3)
+int(3)
int(5)
int(5)
+Test 6
+int(1)
+int(1)
+int(2)
+int(2)
+Test 7
+int(0)
+int(0)
+int(1)
+int(1)
+Test 8a
+int(3)
int(3)
+int(0)
+int(0)
+Test 8b
+int(3)
+int(3)
+int(0)
+int(0)
Done
diff --git a/ext/oci8/tests/oci_execute_segfault.phpt b/ext/oci8/tests/oci_execute_segfault.phpt
index 3859f4ffe..9ba7d770f 100644
--- a/ext/oci8/tests/oci_execute_segfault.phpt
+++ b/ext/oci8/tests/oci_execute_segfault.phpt
@@ -1,30 +1,48 @@
--TEST--
-oci_execute() segfault after repeated bind
+oci_execute() segfault after repeated bind of LOB descriptor
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
<?php
-
+
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';
$ora_sql = "INSERT INTO
- ".$table_name." (blob, clob)
+ ".$schema.$table_name." (blob, clob)
VALUES (empty_blob(), empty_clob())
RETURNING
blob
INTO :v_blob ";
-$s = oci_parse($c,$ora_sql);
-$blob = oci_new_descriptor($c,OCI_D_LOB);
-oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
-oci_execute($s);
+$s = oci_parse($c, $ora_sql);
+$blob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s, ":v_blob", $blob, -1, OCI_B_BLOB);
+oci_execute($s, OCI_DEFAULT);
+var_dump($blob->save("some binary data"));
+
+oci_bind_by_name($s, ":v_blob", $blob, -1, OCI_B_BLOB);
+oci_execute($s, OCI_DEFAULT);
+var_dump($blob->save("some more binary data"));
+
+$query = 'SELECT blob, DBMS_LOB.GETLENGTH(blob) FROM '.$schema.$table_name.' ORDER BY 2';
+
+$s = oci_parse ($c, $query);
+oci_execute($s, OCI_DEFAULT);
+
+while ($arr = oci_fetch_assoc($s)) {
+ $result = $arr['BLOB']->load();
+ var_dump($result);
+}
-oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
-oci_execute($s);
+require dirname(__FILE__).'/drop_table.inc';
echo "Done\n";
?>
--EXPECT--
+bool(true)
+bool(true)
+string(16) "some binary data"
+string(21) "some more binary data"
Done
diff --git a/ext/oci8/tests/pecl_bug10194.phpt b/ext/oci8/tests/pecl_bug10194.phpt
new file mode 100644
index 000000000..1b937c490
--- /dev/null
+++ b/ext/oci8/tests/pecl_bug10194.phpt
@@ -0,0 +1,47 @@
+--TEST--
+PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+memory_limit=10M
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (clob)
+ VALUES (empty_clob())
+ ";
+
+$statement = oci_parse($c,$ora_sql);
+oci_execute($statement);
+
+$ora_sql = "SELECT clob FROM ".$schema.$table_name." FOR UPDATE";
+$statement = oci_parse($c,$ora_sql);
+oci_execute($statement, OCI_DEFAULT);
+
+$row = oci_fetch_assoc($statement);
+
+$string = str_repeat("test", 32768*4*4);
+
+for ($i = 0; $i < 8; $i++) {
+ $row['CLOB']->write($string);
+}
+
+oci_commit($c);
+
+$ora_sql = "SELECT clob FROM ".$schema.$table_name."";
+$statement = oci_parse($c,$ora_sql);
+oci_execute($statement);
+
+$row = oci_fetch_assoc($statement);
+var_dump(strlen($row['CLOB']->load())); /* here it should fail */
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECTF--
+Fatal error: Allowed memory size of 10485760 bytes exhausted at %s:%d (tried to allocate %d bytes) in %s on line %d
diff --git a/ext/oci8/tests/pecl_bug10194_blob.phpt b/ext/oci8/tests/pecl_bug10194_blob.phpt
new file mode 100644
index 000000000..4e7be26c7
--- /dev/null
+++ b/ext/oci8/tests/pecl_bug10194_blob.phpt
@@ -0,0 +1,47 @@
+--TEST--
+PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+memory_limit=10M
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ ";
+
+$statement = oci_parse($c,$ora_sql);
+oci_execute($statement);
+
+$ora_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
+$statement = oci_parse($c,$ora_sql);
+oci_execute($statement, OCI_DEFAULT);
+
+$row = oci_fetch_assoc($statement);
+
+$string = str_repeat("test", 32768*4*4);
+
+for ($i = 0; $i < 8; $i++) {
+ $row['BLOB']->write($string);
+}
+
+oci_commit($c);
+
+$ora_sql = "SELECT blob FROM ".$schema.$table_name."";
+$statement = oci_parse($c,$ora_sql);
+oci_execute($statement);
+
+$row = oci_fetch_assoc($statement);
+var_dump(strlen($row['BLOB']->load())); /* here it should fail */
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECTF--
+Fatal error: Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes) in %s on line %d
diff --git a/ext/oci8/tests/privileged_connect1.phpt b/ext/oci8/tests/privileged_connect1.phpt
index a05a21093..44bb2f60a 100644
--- a/ext/oci8/tests/privileged_connect1.phpt
+++ b/ext/oci8/tests/privileged_connect1.phpt
@@ -17,9 +17,9 @@ oci_connect("", "", "", false, "qwe");
echo "Done\n";
?>
--EXPECTF--
-Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_connect(): ORA-%d: %s in %s on line %d
-Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_connect(): ORA-%d: %s in %s on line %d
Warning: oci_connect(): Invalid session mode specified (-1) in %s on line %d
diff --git a/ext/oci8/tests/statement_type.phpt b/ext/oci8/tests/statement_type.phpt
index 45221a6c7..29cdd9440 100644
--- a/ext/oci8/tests/statement_type.phpt
+++ b/ext/oci8/tests/statement_type.phpt
@@ -7,22 +7,20 @@ oci_statement_type()
require dirname(__FILE__)."/connect.inc";
-if (!empty($dbase)) {
- var_dump($c = oci_connect($user, $password, $dbase));
-}
-else {
- var_dump($c = oci_connect($user, $password));
-}
-
$sqls = Array(
- "SELECT * FROM table",
- "DELETE FROM table WHERE id = 1",
- "INSERT INTO table VALUES(1)",
- "UPDATE table SET id = 1",
+ "SELECT * FROM table",
+ "DELETE FROM table WHERE id = 1",
+ "INSERT INTO table VALUES(1)",
+ "UPDATE table SET id = 1",
"DROP TABLE table",
- "CREATE TABLE table (id NUMBER)",
- "WRONG SYNTAX",
- ""
+ "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;",
+ "CREATE TABLE table (id NUMBER)",
+ "ALTER TABLE table ADD (col1 NUMBER)",
+ "BEGIN NULL; END;",
+ "DECLARE myn NUMBER BEGIN myn := 1; END;",
+ "CALL myproc(1)",
+ "WRONG SYNTAX",
+ ""
);
foreach ($sqls as $sql) {
@@ -34,13 +32,17 @@ echo "Done\n";
?>
--EXPECTF--
-resource(%d) of type (oci8 connection)
string(6) "SELECT"
string(6) "DELETE"
string(6) "INSERT"
string(6) "UPDATE"
string(4) "DROP"
string(6) "CREATE"
+string(6) "CREATE"
+string(5) "ALTER"
+string(5) "BEGIN"
+string(7) "DECLARE"
+string(4) "CALL"
string(7) "UNKNOWN"
string(7) "UNKNOWN"
Done
diff --git a/ext/oci8/tests/statement_type_old.phpt b/ext/oci8/tests/statement_type_old.phpt
index 13da41bf7..2626d6203 100644
--- a/ext/oci8/tests/statement_type_old.phpt
+++ b/ext/oci8/tests/statement_type_old.phpt
@@ -15,14 +15,19 @@ else {
}
$sqls = Array(
- "SELECT * FROM table",
- "DELETE FROM table WHERE id = 1",
- "INSERT INTO table VALUES(1)",
- "UPDATE table SET id = 1",
+ "SELECT * FROM table",
+ "DELETE FROM table WHERE id = 1",
+ "INSERT INTO table VALUES(1)",
+ "UPDATE table SET id = 1",
"DROP TABLE table",
- "CREATE TABLE table (id NUMBER)",
- "WRONG SYNTAX",
- ""
+ "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;",
+ "CREATE TABLE table (id NUMBER)",
+ "ALTER TABLE table ADD (col1 NUMBER)",
+ "BEGIN NULL; END;",
+ "DECLARE myn NUMBER BEGIN myn := 1; END;",
+ "CALL myproc(1)",
+ "WRONG SYNTAX",
+ ""
);
foreach ($sqls as $sql) {
@@ -41,6 +46,11 @@ string(6) "INSERT"
string(6) "UPDATE"
string(4) "DROP"
string(6) "CREATE"
+string(6) "CREATE"
+string(5) "ALTER"
+string(5) "BEGIN"
+string(7) "DECLARE"
+string(4) "CALL"
string(7) "UNKNOWN"
string(7) "UNKNOWN"
Done