diff options
Diffstat (limited to 'ext/oci8')
30 files changed, 541 insertions, 106 deletions
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4 index 6b87a775b..3d084d7d3 100644 --- a/ext/oci8/config.m4 +++ b/ext/oci8/config.m4 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.55.2.1 2005/12/01 13:39:42 tony2001 Exp $ +dnl $Id: config.m4,v 1.55.2.3 2006/04/05 14:06:00 tony2001 Exp $ dnl if test -z "$SED"; then @@ -69,7 +69,7 @@ AC_DEFUN([AC_OCI8IC_VERSION],[ AC_DEFUN([AC_OCI8_VERSION],[ AC_MSG_CHECKING([Oracle version]) if test -s "$OCI8_DIR/orainst/unix.rgs"; then - OCI8_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | $PHP_OCI_SED 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4` + OCI8_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | $PHP_OCI8_SED 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4` test -z "$OCI8_VERSION" && OCI8_VERSION=7.3 elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then OCI8_VERSION=10.1 @@ -232,6 +232,13 @@ if test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then ], [], [ -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD ]) + + PHP_CHECK_LIBRARY(clntsh, OCILobRead2, + [ + AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ]) + ], [], [ + -L$OCI8_DIR/$OCI8_LIB_DIR $OCI8_SHARED_LIBADD + ]) ;; @@ -242,6 +249,7 @@ if test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then AC_DEFINE(HAVE_OCI_ENV_NLS_CREATE,1,[ ]) AC_DEFINE(HAVE_OCI_ENV_CREATE,1,[ ]) AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ]) + AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ]) AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ]) AC_DEFINE(PHP_OCI8_HAVE_COLLECTIONS,1,[ ]) ;; @@ -332,7 +340,7 @@ dnl Header directory for manual installation AC_MSG_ERROR([Oracle Instant Client SDK header files not found]) fi - OCISYSLIBLIST=`echo "$OCI8INCDIR" | $PHP_OCI_SED -e 's!\(.*\)/include$!\1/demo/sysliblist!'` + OCISYSLIBLIST=`echo "$OCI8INCDIR" | $PHP_OCI8_SED -e 's!\(.*\)/include$!\1/demo/sysliblist!'` if test -f "$OCISYSLIBLIST"; then PHP_EVAL_LIBLINE(`cat $OCISYSLIBLIST`, OCI8_SYSLIB) fi @@ -354,6 +362,7 @@ dnl Header directory for manual installation AC_DEFINE(HAVE_OCI_ENV_NLS_CREATE,1,[ ]) AC_DEFINE(HAVE_OCI_ENV_CREATE,1,[ ]) AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ]) + AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ]) AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ]) AC_DEFINE(PHP_OCI8_HAVE_COLLECTIONS,1,[ ]) diff --git a/ext/oci8/config.w32 b/ext/oci8/config.w32 index 90e1995e3..a8a1a3da8 100644 --- a/ext/oci8/config.w32 +++ b/ext/oci8/config.w32 @@ -1,4 +1,4 @@ -// $Id: config.w32,v 1.3.4.1 2005/12/01 13:39:42 tony2001 Exp $ +// $Id: config.w32,v 1.3.4.4 2006/05/22 04:18:05 tony2001 Exp $ // vim:ft=javascript ARG_WITH("oci8", "OCI8 support", "no"); @@ -11,9 +11,14 @@ if (PHP_OCI8 != "no") { ) { EXTENSION('oci8', 'oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c'); - AC_DEFINE('HAVE_OCI8_TEMP_LOB', 1); AC_DEFINE('HAVE_OCI8', 1); + AC_DEFINE('HAVE_OCI_INSTANT_CLIENT', 1); AC_DEFINE('HAVE_OCI8_ATTR_STATEMENT', 1); + AC_DEFINE('HAVE_OCI_ENV_NLS_CREATE', 1); + AC_DEFINE('HAVE_OCI_ENV_CREATE', 1); + AC_DEFINE('HAVE_OCI_STMT_PREPARE2', 1); + AC_DEFINE('HAVE_OCI_LOB_READ2', 1); + AC_DEFINE('HAVE_OCI8_TEMP_LOB', 1); AC_DEFINE('PHP_OCI8_HAVE_COLLECTIONS', 1); } else { diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 3508f143d..78e26cb97 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -26,7 +26,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: oci8.c,v 1.269.2.8 2006/01/10 08:34:28 tony2001 Exp $ */ +/* $Id: oci8.c,v 1.269.2.18 2006/05/18 13:21:45 tony2001 Exp $ */ /* TODO * * file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty() with OCI_ATTR_LOBEMPTY @@ -89,7 +89,7 @@ static void php_oci_collection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC); static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC); #ifdef ZTS -static int php_oci_regular_helper(zend_rsrc_list_entry *le TSRMLS_DC); +static int php_oci_list_helper(zend_rsrc_list_entry *le, void *le_type TSRMLS_DC); #endif static int php_oci_connection_ping(php_oci_connection * TSRMLS_DC); static int php_oci_connection_status(php_oci_connection * TSRMLS_DC); @@ -541,6 +541,8 @@ PHP_MINIT_FUNCTION(oci) REGISTER_LONG_CONSTANT("SQLT_FLT",SQLT_FLT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SQLT_UIN",SQLT_UIN, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SQLT_LNG",SQLT_LNG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_LBI",SQLT_LBI, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SQLT_ODT",SQLT_ODT, CONST_CS | CONST_PERSISTENT); #if defined(HAVE_OCI_INSTANT_CLIENT) || (defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION > 10) REGISTER_LONG_CONSTANT("SQLT_BDOUBLE",SQLT_BDOUBLE, CONST_CS | CONST_PERSISTENT); @@ -622,11 +624,17 @@ PHP_MSHUTDOWN_FUNCTION(oci) PHP_RSHUTDOWN_FUNCTION(oci) { +#ifdef ZTS + zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_descriptor TSRMLS_CC); + zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_collection TSRMLS_CC); + zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_statement TSRMLS_CC); +#endif + /* check persistent connections and do the necessary actions if needed */ zend_hash_apply(&EG(persistent_list), (apply_func_t) php_oci_persistent_helper TSRMLS_CC); #ifdef ZTS - zend_hash_apply(&EG(regular_list), (apply_func_t) php_oci_regular_helper TSRMLS_CC); + zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_connection TSRMLS_CC); php_oci_cleanup_global_handles(TSRMLS_C); #endif @@ -639,7 +647,7 @@ PHP_MINFO_FUNCTION(oci) php_info_print_table_start(); php_info_print_table_row(2, "OCI8 Support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.8 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.18 $"); sprintf(buf, "%ld", OCI_G(num_persistent)); php_info_print_table_row(2, "Active Persistent Connections", buf); @@ -982,7 +990,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char smart_str_appends_ex(&hashed_details, charset, 1); } else { - size_t rsize; + size_t rsize = 0; PHP_OCI_CALL(OCINlsEnvironmentVariableGet, (&charsetid, 2, OCI_NLS_CHARSET_ID, 0, &rsize)); smart_str_append_unsigned_ex(&hashed_details, charsetid, 0); @@ -1050,7 +1058,9 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char /* okay, the connection is open and the server is still alive */ connection->used_this_request = 1; smart_str_free_ex(&hashed_details, 0); - connection->rsrc_id = zend_list_insert(connection, le_pconnection); + if (zend_list_addref(connection->rsrc_id) == FAILURE) { + connection->rsrc_id = zend_list_insert(connection, le_pconnection); + } return connection; } } @@ -1280,7 +1290,11 @@ open: case OCI_SYSDBA: case OCI_SYSOPER: default: - OCI_G(errcode) = PHP_OCI_CALL(OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_EXT, (ub4) session_mode)); + if (username_len == 1 && username[0] == '/' && password_len == 0) { + OCI_G(errcode) = PHP_OCI_CALL(OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_EXT, (ub4) session_mode)); + } else { + OCI_G(errcode) = PHP_OCI_CALL(OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) session_mode)); + } break; } @@ -1341,8 +1355,8 @@ open: * Ping connection. Uses OCIPing() or OCIServerVersion() depending on the Oracle Client version */ static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC) { -#if OCI_MAJOR_VERSION >= 10 && OCI_MINOR_VERSION >= 2 - /* OCIPing() is usable only in 10.2 */ + /* OCIPing() crashes Oracle servers older than 10.2 */ +#if 0 OCI_G(errcode) = PHP_OCI_CALL(OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT)); #else char version[256]; @@ -1629,6 +1643,16 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg fetch_mode = mode; } + if (!(fetch_mode & PHP_OCI_NUM) && !(fetch_mode & PHP_OCI_ASSOC)) { + /* none of the modes present, use the default one */ + if (mode & PHP_OCI_ASSOC) { + fetch_mode |= PHP_OCI_ASSOC; + } + if (mode & PHP_OCI_NUM) { + fetch_mode |= PHP_OCI_NUM; + } + } + PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) { @@ -1704,7 +1728,9 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC) connection->descriptors = NULL; } - php_oci_connection_rollback(connection TSRMLS_CC); + if (connection->needs_commit) { + php_oci_connection_rollback(connection TSRMLS_CC); + } if (OCI_G(persistent_timeout) > 0) { connection->idle_expiry = timestamp + OCI_G(persistent_timeout); @@ -1731,15 +1757,14 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC) } /* }}} */ #ifdef ZTS -/* {{{ php_oci_regular_helper() - Helper function to close non-persistent connections at the end of request in ZTS mode */ -static int php_oci_regular_helper(zend_rsrc_list_entry *le TSRMLS_DC) +/* {{{ php_oci_list_helper() + Helper function to destroy data on thread shutdown in ZTS mode */ +static int php_oci_list_helper(zend_rsrc_list_entry *le, void *le_type TSRMLS_DC) { - php_oci_connection *connection; - - if (le->type == le_connection) { - connection = (php_oci_connection *)le->ptr; - if (connection) { + int type = (int) le_type; + + if (le->type == type) { + if (le->ptr != NULL) { return 1; } } diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 49c5190f3..a5f7d00f9 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -25,7 +25,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: oci8_interface.c,v 1.8.2.4 2006/01/05 13:42:35 tony2001 Exp $ */ +/* $Id: oci8_interface.c,v 1.8.2.7 2006/03/28 09:12:18 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1102,7 +1102,7 @@ PHP_FUNCTION(oci_field_name) { php_oci_out_column *column; - if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU) ) ) { + if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { RETURN_STRINGL(column->name, column->name_len, 1); } RETURN_FALSE; @@ -1115,7 +1115,7 @@ PHP_FUNCTION(oci_field_size) { php_oci_out_column *column; - if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU) ) ) { + if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { /* Handle data type of LONG */ if (column->data_type == SQLT_LNG){ RETURN_LONG(column->storage_size4); @@ -1132,7 +1132,7 @@ PHP_FUNCTION(oci_field_scale) { php_oci_out_column *column; - if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU) ) ) { + if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { RETURN_LONG(column->scale); } RETURN_FALSE; @@ -1145,7 +1145,7 @@ PHP_FUNCTION(oci_field_precision) { php_oci_out_column *column; - if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU) ) ) { + if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { RETURN_LONG(column->precision); } RETURN_FALSE; @@ -1158,7 +1158,7 @@ PHP_FUNCTION(oci_field_type) { php_oci_out_column *column; - column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU); + column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); if (!column) { RETURN_FALSE; @@ -1191,7 +1191,7 @@ PHP_FUNCTION(oci_field_type) RETVAL_STRING("LONG RAW",1); break; case SQLT_CHR: - RETVAL_STRING("VARCHAR",1); + RETVAL_STRING("VARCHAR2",1); break; case SQLT_RSET: RETVAL_STRING("REFCURSOR",1); @@ -1223,7 +1223,7 @@ PHP_FUNCTION(oci_field_type_raw) { php_oci_out_column *column; - column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU); + column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); if (column) { RETURN_LONG(column->data_type); } @@ -1237,7 +1237,7 @@ PHP_FUNCTION(oci_field_is_null) { php_oci_out_column *column; - if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU) ) ) { + if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { if (column->indicator == -1) { RETURN_TRUE; } @@ -1439,7 +1439,7 @@ PHP_FUNCTION(oci_fetch_all) Fetch a result row as an object */ PHP_FUNCTION(oci_fetch_object) { - php_oci_fetch_row(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_OCI_ASSOC, 2); + php_oci_fetch_row(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_OCI_ASSOC | PHP_OCI_RETURN_NULLS, 2); if (Z_TYPE_P(return_value) == IS_ARRAY) { object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value)); @@ -1451,7 +1451,7 @@ PHP_FUNCTION(oci_fetch_object) Fetch a result row as an enumerated array */ PHP_FUNCTION(oci_fetch_row) { - php_oci_fetch_row(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_OCI_NUM, 1); + php_oci_fetch_row(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_OCI_NUM | PHP_OCI_RETURN_NULLS, 1); } /* }}} */ @@ -1459,7 +1459,7 @@ PHP_FUNCTION(oci_fetch_row) Fetch a result row as an associative array */ PHP_FUNCTION(oci_fetch_assoc) { - php_oci_fetch_row(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_OCI_ASSOC, 1); + php_oci_fetch_row(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_OCI_ASSOC | PHP_OCI_RETURN_NULLS, 1); } /* }}} */ @@ -1467,7 +1467,7 @@ PHP_FUNCTION(oci_fetch_assoc) Fetch a result row as an array */ PHP_FUNCTION(oci_fetch_array) { - php_oci_fetch_row(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_OCI_BOTH, 2); + php_oci_fetch_row(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_OCI_BOTH | PHP_OCI_RETURN_NULLS, 2); } /* }}} */ @@ -1521,7 +1521,7 @@ PHP_FUNCTION(oci_new_connect) } /* }}} */ -/* {{{ proto resource oci_connect(string user, string pass [, string db]) +/* {{{ proto resource oci_connect(string user, string pass [, string db [, string charset [, int session_mode ]]) Connect to an Oracle database and log on. Returns a new session. */ PHP_FUNCTION(oci_connect) { @@ -1529,7 +1529,7 @@ PHP_FUNCTION(oci_connect) } /* }}} */ -/* {{{ proto resource oci_pconnect(string user, string pass [, string db]) +/* {{{ proto resource oci_pconnect(string user, string pass [, string db [, string charset ]]) Connect to an Oracle database using a persistent connection and log on. Returns a new session. */ PHP_FUNCTION(oci_pconnect) { @@ -1734,7 +1734,7 @@ PHP_FUNCTION(oci_result) { php_oci_out_column *column; - column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU); + column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); if(column) { php_oci_column_to_zval(column, return_value, 0 TSRMLS_CC); } diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c index 6729b0511..023fbfaaf 100644 --- a/ext/oci8/oci8_lob.c +++ b/ext/oci8/oci8_lob.c @@ -25,7 +25,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: oci8_lob.c,v 1.7.2.4 2006/01/05 13:42:35 tony2001 Exp $ */ +/* $Id: oci8_lob.c,v 1.7.2.6 2006/04/05 14:06:00 tony2001 Exp $ */ @@ -150,9 +150,11 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini { php_oci_connection *connection = descriptor->connection; ub4 length = 0; - ub4 block_length = PHP_OCI_LOB_BUFFER_SIZE; - int bytes_read, bytes_total = 0, offset = 0, data_len_chars = 0; + int bytes_read, bytes_total = 0, offset = 0; int requested_len = read_length; /* this is by default */ +#if defined(HAVE_OCI_LOB_READ2) + int chars_read = 0, is_clob = 0; +#endif *data_len = 0; *data = NULL; @@ -178,14 +180,10 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini requested_len = length - initial_offset; } - if (requested_len == 0) { + if (requested_len <= 0) { return 0; } - if (requested_len < block_length) { - block_length = requested_len; - } - if (descriptor->type == OCI_DTYPE_FILE) { connection->errcode = PHP_OCI_CALL(OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); @@ -195,11 +193,71 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini return 1; } } +#ifdef HAVE_OCI_LOB_READ2 + else { + ub2 charset_id = 0; + + connection->errcode = PHP_OCI_CALL(OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id)); + + if (connection->errcode != OCI_SUCCESS) { + php_oci_error(connection->err, connection->errcode TSRMLS_CC); + PHP_OCI_HANDLE_ERROR(connection, connection->errcode); + return 1; + } + + if (charset_id > 0) { /* charset_id is always > 0 for [N]CLOBs */ + is_clob = 1; + } + } +#endif - *data = (char *)emalloc(block_length + 1); - bytes_read = block_length; + *data = (char *)emalloc(requested_len + 1); + bytes_read = requested_len; offset = initial_offset; + + /* TODO + * We need to make sure this function works with Unicode LOBs + * */ + +#if defined(HAVE_OCI_LOB_READ2) + + do { + chars_read = 0; + connection->errcode = PHP_OCI_CALL(OCILobRead2, + ( + connection->svc, + connection->err, + descriptor->descriptor, + (oraub8 *)&bytes_read, /* IN/OUT bytes toread/read */ + (oraub8 *)&chars_read, + (oraub8) offset + 1, /* offset (starts with 1) */ + (dvoid *) ((char *) *data + *data_len), + (oraub8) requested_len, /* size of buffer */ + 0, + NULL, + (OCICallbackLobRead2) 0, /* callback... */ + (ub2) connection->charset, /* The character set ID of the buffer data. */ + (ub1) SQLCS_IMPLICIT /* The character set form of the buffer data. */ + ) + ); + + bytes_total += bytes_read; + if (is_clob) { + offset += chars_read; + } else { + offset += bytes_read; + } + *data_len += bytes_read; + + if (connection->errcode != OCI_NEED_DATA) { + break; + } + *data = erealloc(*data, *data_len + PHP_OCI_LOB_BUFFER_SIZE + 1); + } while (connection->errcode == OCI_NEED_DATA); + +#else + do { connection->errcode = PHP_OCI_CALL(OCILobRead, ( @@ -209,7 +267,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini &bytes_read, /* IN/OUT bytes toread/read */ offset + 1, /* offset (starts with 1) */ (dvoid *) ((char *) *data + *data_len), - block_length, /* size of buffer */ + requested_len, /* size of buffer */ (dvoid *)0, (OCICallbackLobRead) 0, /* callback... */ (ub2) connection->charset, /* The character set ID of the buffer data. */ @@ -218,14 +276,9 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini ); bytes_total += bytes_read; - /* - * Oracle doesn't tell use how many CHARS were read, - * so we have to count them to get the correct offset for CLOBS */ - data_len_chars = OCIMultiByteStrnDisplayLength(connection->env, *data, bytes_total); - offset = initial_offset + data_len_chars; + offset += bytes_read; *data_len += bytes_read; - block_length = PHP_OCI_LOB_BUFFER_SIZE; if (connection->errcode != OCI_NEED_DATA) { break; @@ -233,6 +286,8 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini *data = erealloc(*data, *data_len + PHP_OCI_LOB_BUFFER_SIZE + 1); } while (connection->errcode == OCI_NEED_DATA); +#endif + if (connection->errcode != OCI_SUCCESS) { php_oci_error(connection->err, connection->errcode TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); @@ -241,7 +296,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini return 1; } - descriptor->lob_current_position += data_len_chars; + descriptor->lob_current_position = offset; if (descriptor->type == OCI_DTYPE_FILE) { connection->errcode = PHP_OCI_CALL(OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index b0543d736..dcc33bd4e 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -25,7 +25,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: oci8_statement.c,v 1.7.2.8 2006/01/01 12:50:10 sniper Exp $ */ +/* $Id: oci8_statement.c,v 1.7.2.14 2006/04/12 19:21:35 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H @@ -70,7 +70,7 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha php_oci_error(connection->err, connection->errcode TSRMLS_CC); #if HAVE_OCI_STMT_PREPARE2 - PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_DEFAULT)); + PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_STRLS_CACHE_DELETE)); PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR)); #else PHP_OCI_CALL(OCIHandleFree,(statement->stmt, OCI_HTYPE_STMT)); @@ -165,7 +165,6 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) /* this is exactly what we requested */ return 0; } - return 1; } @@ -283,8 +282,9 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) switch (mode) { case OCI_COMMIT_ON_SUCCESS: + case OCI_DESCRIBE_ONLY: case OCI_DEFAULT: - /* only these two are allowed */ + /* only these are allowed */ break; default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid execute mode given: %d", mode); @@ -493,6 +493,9 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) case SQLT_BIN: default: define_type = SQLT_CHR; + if (outcol->data_type == SQLT_BIN) { + define_type = SQLT_BIN; + } if ((outcol->data_type == SQLT_DAT) || (outcol->data_type == SQLT_NUM) #ifdef SQLT_TIMESTAMP || (outcol->data_type == SQLT_TIMESTAMP) @@ -502,6 +505,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) #endif ) { outcol->storage_size4 = 512; /* XXX this should fit "most" NLS date-formats and Numbers */ +#if defined(SQLT_IBFLOAT) && defined(SQLT_IBDOUBLE) + } else if (outcol->data_type == SQLT_IBFLOAT || outcol->data_type == SQLT_IBDOUBLE) { + outcol->storage_size4 = 1024; +#endif } else { outcol->storage_size4++; /* add one for string terminator */ } @@ -509,7 +516,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) outcol->storage_size4 *= 3; dynamic = OCI_DEFAULT; - buf = outcol->data = (text *) emalloc(outcol->storage_size4); + buf = outcol->data = (text *) ecalloc(1, outcol->storage_size4); break; } @@ -579,7 +586,7 @@ void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC) if (statement->stmt) { #if HAVE_OCI_STMT_PREPARE2 if (statement->last_query_len) { /* FIXME: magical */ - PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_DEFAULT)); + PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_STRLS_CACHE_DELETE)); } else { PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT)); @@ -809,6 +816,9 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, mode = OCI_DEFAULT; break; + case SQLT_LBI: + case SQLT_BIN: + case SQLT_LNG: case SQLT_CHR: /* this is the default case when type was not specified */ convert_to_string(var); @@ -1005,7 +1015,7 @@ sb4 php_oci_bind_out_callback( /* {{{ php_oci_statement_get_column_helper() Helper function to get column by name and index */ -php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS) +php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data) { zval *z_statement, *column_index; php_oci_statement *statement; @@ -1020,6 +1030,10 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME if (!statement) { return NULL; } + + if (need_data && !statement->has_data) { + return NULL; + } 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); diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h index 4f70fd920..0e872a335 100644 --- a/ext/oci8/php_oci8_int.h +++ b/ext/oci8/php_oci8_int.h @@ -25,7 +25,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_oci8_int.h,v 1.11.2.4 2006/01/05 13:42:35 tony2001 Exp $ */ +/* $Id: php_oci8_int.h,v 1.11.2.6 2006/04/05 14:06:00 tony2001 Exp $ */ #if HAVE_OCI8 # ifndef PHP_OCI8_INT_H @@ -78,7 +78,7 @@ extern zend_class_entry *oci_coll_class_entry_ptr; #define PHP_OCI_MAX_NAME_LEN 64 #define PHP_OCI_MAX_DATA_SIZE INT_MAX #define PHP_OCI_PIECE_SIZE (64*1024)-1 -#define PHP_OCI_LOB_BUFFER_SIZE 1048576l +#define PHP_OCI_LOB_BUFFER_SIZE 32768 #define PHP_OCI_ASSOC 1<<0 #define PHP_OCI_NUM 1<<1 @@ -358,7 +358,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC); int php_oci_bind_by_name(php_oci_statement *, char *, int, zval*, long, long TSRMLS_DC); sb4 php_oci_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **); sb4 php_oci_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **); -php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS); +php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data); int php_oci_statement_get_type(php_oci_statement *, ub2 * TSRMLS_DC); int php_oci_statement_get_numrows(php_oci_statement *, ub4 * TSRMLS_DC); diff --git a/ext/oci8/tests/bind_empty.phpt b/ext/oci8/tests/bind_empty.phpt index dc993016a..9c602b32c 100644 --- a/ext/oci8/tests/bind_empty.phpt +++ b/ext/oci8/tests/bind_empty.phpt @@ -18,13 +18,13 @@ oci_execute($statement); $name = null; $stmt = oci_parse($c, "UPDATE bind_test SET name=:name"); -oci_bind_by_name($stmt, ":name", &$name); +oci_bind_by_name($stmt, ":name", $name); $res = oci_execute($stmt); $name = ""; $stmt = oci_parse($c, "UPDATE bind_test SET name=:name"); -oci_bind_by_name($stmt, ":name", &$name); +oci_bind_by_name($stmt, ":name", $name); $res = oci_execute($stmt); diff --git a/ext/oci8/tests/bind_long.phpt b/ext/oci8/tests/bind_long.phpt new file mode 100644 index 000000000..58590f145 --- /dev/null +++ b/ext/oci8/tests/bind_long.phpt @@ -0,0 +1,38 @@ +--TEST-- +bind LONG field +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +require dirname(__FILE__)."/connect.inc"; + +$stmt = oci_parse($c, "create table phptestlng( id number(10), fileimage long)"); +oci_execute($stmt); + +$stmt = oci_parse ($c, "insert into phptestlng (id, fileimage) values (:id, :fileimage)"); +$i=1; +$fileimage = file_get_contents( dirname(__FILE__)."/test.gif"); + +oci_bind_by_name( $stmt, ":id", $i, -1); +oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_LNG); +oci_execute($stmt, OCI_DEFAULT); +oci_commit($c); + +$stmt = oci_parse($c, "SELECT fileimage FROM phptestlng"); +oci_execute($stmt); + +$row = oci_fetch_row($stmt); +var_dump(md5($row[0])); +var_dump(strlen($row[0])); + +$stmt = oci_parse($c, "drop table phptestlng"); +oci_execute($stmt); + +echo "Done\n"; + +?> +--EXPECT-- +string(32) "d04e7036e2f4221abc88fd14e960a45b" +int(2523) +Done diff --git a/ext/oci8/tests/bind_long_raw.phpt b/ext/oci8/tests/bind_long_raw.phpt new file mode 100644 index 000000000..2a9962eac --- /dev/null +++ b/ext/oci8/tests/bind_long_raw.phpt @@ -0,0 +1,38 @@ +--TEST-- +bind LONG RAW field +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +require dirname(__FILE__)."/connect.inc"; + +$stmt = oci_parse($c, "create table phptestlngraw( id number(10), fileimage long raw)"); +oci_execute($stmt); + +$stmt = oci_parse ($c, "insert into phptestlngraw (id, fileimage) values (:id, :fileimage)"); +$i=1; +$fileimage = file_get_contents( dirname(__FILE__)."/test.gif"); + +oci_bind_by_name( $stmt, ":id", $i, -1); +oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_LBI); +oci_execute($stmt, OCI_DEFAULT); +oci_commit($c); + +$stmt = oci_parse($c, "SELECT fileimage FROM phptestlngraw"); +oci_execute($stmt); + +$row = oci_fetch_row($stmt); +var_dump(md5($row[0])); +var_dump(strlen($row[0])); + +$stmt = oci_parse($c, "drop table phptestlngraw"); +oci_execute($stmt); + +echo "Done\n"; + +?> +--EXPECT-- +string(32) "614fcbba1effb7caa27ef0ef25c27fcf" +int(2523) +Done diff --git a/ext/oci8/tests/bind_raw.phpt b/ext/oci8/tests/bind_raw.phpt new file mode 100644 index 000000000..c9087e552 --- /dev/null +++ b/ext/oci8/tests/bind_raw.phpt @@ -0,0 +1,39 @@ +--TEST-- +bind RAW field +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +require dirname(__FILE__)."/connect.inc"; + +$stmt = oci_parse($c, "create table phptestrawtable( id number(10), fileimage raw(1000))"); +oci_execute($stmt); + +$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)"); +$i=1; +$fileimage = file_get_contents( dirname(__FILE__)."/test.gif"); +$fileimage = substr($fileimage, 0, 300); + +oci_bind_by_name( $stmt, ":id", $i, -1); +oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_BIN); +oci_execute($stmt, OCI_DEFAULT); +oci_commit($c); + +$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable"); +oci_execute($stmt); + +$row = oci_fetch_row($stmt); +var_dump(md5($row[0])); +var_dump(strlen($row[0])); + +$stmt = oci_parse($c, "drop table phptestrawtable"); +oci_execute($stmt); + +echo "Done\n"; + +?> +--EXPECT-- +string(32) "88b274d7a257ac6f70435b83abd4e26e" +int(300) +Done diff --git a/ext/oci8/tests/bug36010.phpt b/ext/oci8/tests/bug36010.phpt new file mode 100644 index 000000000..ef435496a --- /dev/null +++ b/ext/oci8/tests/bug36010.phpt @@ -0,0 +1,26 @@ +--TEST-- +bug #36010 (Crash when executing SQL statment with lob parameter twice) +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +require dirname(__FILE__).'/connect.inc'; + +function f($conn) +{ + $sql = "begin :p_clob := 'lob string'; end;"; + $stid = oci_parse($conn, $sql); + $clob = oci_new_descriptor($conn, OCI_D_LOB); + oci_bind_by_name($stid, ":p_clob", $clob, -1, OCI_B_CLOB); + $r = oci_execute($stid, OCI_DEFAULT); +} + +f($c); +f($c); + +echo "Done\n"; + +?> +--EXPECT-- +Done diff --git a/ext/oci8/tests/bug36096.phpt b/ext/oci8/tests/bug36096.phpt new file mode 100644 index 000000000..44b3a6ddc --- /dev/null +++ b/ext/oci8/tests/bug36096.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #36096 (oci_result() returns garbage after oci_fetch() failed) +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +require dirname(__FILE__)."/connect.inc"; + +$sql = "SELECT 'ABC' FROM DUAL WHERE 1<>1"; +$stmt = oci_parse($c, $sql); + +if(oci_execute($stmt, OCI_COMMIT_ON_SUCCESS)){ + var_dump(oci_fetch($stmt)); + var_dump(oci_result($stmt, 1)); + var_dump(oci_field_name($stmt, 1)); + var_dump(oci_field_type($stmt, 1)); +} + +echo "Done\n"; + +?> +--EXPECT-- +bool(false) +bool(false) +string(5) "'ABC'" +string(4) "CHAR" +Done diff --git a/ext/oci8/tests/cursors.phpt b/ext/oci8/tests/cursors.phpt index 6c92a2b91..22c89c9c5 100644 --- a/ext/oci8/tests/cursors.phpt +++ b/ext/oci8/tests/cursors.phpt @@ -45,15 +45,21 @@ echo "Done\n"; ?> --EXPECTF-- -array(2) { +array(5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } bool(true) -Warning: oci_fetch_assoc()%sORA-01002: fetch out of sequence in %scursors.php on line %d +Warning: oci_fetch_assoc(): ORA-01002: fetch out of sequence in %s on line %d bool(false) bool(true) Done diff --git a/ext/oci8/tests/debug.phpt b/ext/oci8/tests/debug.phpt index a3e393240..cc771d531 100644 --- a/ext/oci8/tests/debug.phpt +++ b/ext/oci8/tests/debug.phpt @@ -20,12 +20,14 @@ echo "Done\n"; ?> --EXPECTF-- -OCI8 DEBUG: OCINlsEnvironmentVariableGet in php_oci_do_connect_ex() (%s/oci8.c:%d) +OCI8 DEBUG: OCINlsEnvironmentVariableGet at (%s:%d) Done -OCI8 DEBUG: OCISessionEnd in php_oci_connection_close() (%s/oci8.c:%d) -OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d) -OCI8 DEBUG: OCIServerDetach in php_oci_connection_close() (%s/oci8.c:%d) -OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d) -OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d) -OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d) -OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d) +OCI8 DEBUG: OCISessionEnd at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) +OCI8 DEBUG: OCIServerDetach at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) diff --git a/ext/oci8/tests/error1.phpt b/ext/oci8/tests/error1.phpt index 28408f9c9..8b358b612 100644 --- a/ext/oci8/tests/error1.phpt +++ b/ext/oci8/tests/error1.phpt @@ -12,7 +12,16 @@ echo "Done\n"; ?> --EXPECTF-- -Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d -bool(false) +Warning: oci_connect(): ORA-12154: TNS:could not resolve service name in %s on line %d bool(false) +array(4) { + ["code"]=> + int(12154) + ["message"]=> + string(45) "ORA-12154: TNS:could not resolve service name" + ["offset"]=> + int(0) + ["sqltext"]=> + string(0) "" +} Done diff --git a/ext/oci8/tests/exec_fetch.phpt b/ext/oci8/tests/exec_fetch.phpt index 6734f6169..83aae69f7 100644 --- a/ext/oci8/tests/exec_fetch.phpt +++ b/ext/oci8/tests/exec_fetch.phpt @@ -16,4 +16,9 @@ var_dump(oci_fetch_array($stmt)); echo "Done\n"; ?> --EXPECTF-- +Warning: oci_execute(): ORA-00942: table or view does not exist in %s on line %d +bool(false) + +Warning: oci_fetch_array(): ORA-24374: define not done before fetch or execute and fetch in %s on line %d +bool(false) Done diff --git a/ext/oci8/tests/fetch_array.phpt b/ext/oci8/tests/fetch_array.phpt index bfffd4e7d..e2f32483d 100644 --- a/ext/oci8/tests/fetch_array.phpt +++ b/ext/oci8/tests/fetch_array.phpt @@ -77,7 +77,7 @@ require dirname(__FILE__).'/drop_table.inc'; echo "Done\n"; ?> --EXPECT-- -array(4) { +array(10) { [0]=> string(1) "1" ["ID"]=> @@ -86,8 +86,20 @@ array(4) { string(1) "1" ["VALUE"]=> string(1) "1" + [2]=> + NULL + ["BLOB"]=> + NULL + [3]=> + NULL + ["CLOB"]=> + NULL + [4]=> + NULL + ["STRING"]=> + NULL } -array(4) { +array(10) { [0]=> string(1) "1" ["ID"]=> @@ -96,8 +108,20 @@ array(4) { string(1) "1" ["VALUE"]=> string(1) "1" + [2]=> + NULL + ["BLOB"]=> + NULL + [3]=> + NULL + ["CLOB"]=> + NULL + [4]=> + NULL + ["STRING"]=> + NULL } -array(4) { +array(10) { [0]=> string(1) "1" ["ID"]=> @@ -106,6 +130,18 @@ array(4) { string(1) "1" ["VALUE"]=> string(1) "1" + [2]=> + NULL + ["BLOB"]=> + NULL + [3]=> + NULL + ["CLOB"]=> + NULL + [4]=> + NULL + ["STRING"]=> + NULL } array(2) { [0]=> @@ -173,58 +209,100 @@ array(4) { ["VALUE"]=> string(1) "1" } -array(2) { +array(4) { [0]=> string(1) "1" + ["ID"]=> + string(1) "1" [1]=> string(1) "1" + ["VALUE"]=> + string(1) "1" } -array(2) { +array(4) { [0]=> string(1) "1" + ["ID"]=> + string(1) "1" [1]=> string(1) "1" + ["VALUE"]=> + string(1) "1" } -array(2) { +array(4) { [0]=> string(1) "1" + ["ID"]=> + string(1) "1" [1]=> string(1) "1" + ["VALUE"]=> + string(1) "1" } -array(5) { +array(10) { [0]=> string(1) "1" + ["ID"]=> + string(1) "1" [1]=> string(1) "1" + ["VALUE"]=> + string(1) "1" [2]=> NULL + ["BLOB"]=> + NULL [3]=> NULL + ["CLOB"]=> + NULL [4]=> NULL + ["STRING"]=> + NULL } -array(5) { +array(10) { [0]=> string(1) "1" + ["ID"]=> + string(1) "1" [1]=> string(1) "1" + ["VALUE"]=> + string(1) "1" [2]=> NULL + ["BLOB"]=> + NULL [3]=> NULL + ["CLOB"]=> + NULL [4]=> NULL + ["STRING"]=> + NULL } -array(5) { +array(10) { [0]=> string(1) "1" + ["ID"]=> + string(1) "1" [1]=> string(1) "1" + ["VALUE"]=> + string(1) "1" [2]=> NULL + ["BLOB"]=> + NULL [3]=> NULL + ["CLOB"]=> + NULL [4]=> NULL + ["STRING"]=> + NULL } Done diff --git a/ext/oci8/tests/fetch_assoc.phpt b/ext/oci8/tests/fetch_assoc.phpt index 2c9590db5..7dacf2e5b 100644 --- a/ext/oci8/tests/fetch_assoc.phpt +++ b/ext/oci8/tests/fetch_assoc.phpt @@ -43,22 +43,40 @@ echo "Done\n"; ?> --EXPECT-- -array(2) { +array(5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } -array(2) { +array(5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } -array(2) { +array(5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } Done diff --git a/ext/oci8/tests/fetch_object.phpt b/ext/oci8/tests/fetch_object.phpt index d6b2714b9..57b7fc03d 100644 --- a/ext/oci8/tests/fetch_object.phpt +++ b/ext/oci8/tests/fetch_object.phpt @@ -42,23 +42,41 @@ require dirname(__FILE__).'/drop_table.inc'; echo "Done\n"; ?> ---EXPECT-- -object(stdClass)#1 (2) { +--EXPECTF-- +object(stdClass)#%d (5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } -object(stdClass)#2 (2) { +object(stdClass)#%d (5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } -object(stdClass)#1 (2) { +object(stdClass)#%d (5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } Done diff --git a/ext/oci8/tests/fetch_row.phpt b/ext/oci8/tests/fetch_row.phpt index d8a68cabb..a637ecc6f 100644 --- a/ext/oci8/tests/fetch_row.phpt +++ b/ext/oci8/tests/fetch_row.phpt @@ -43,22 +43,40 @@ echo "Done\n"; ?> --EXPECT-- -array(2) { +array(5) { [0]=> string(1) "1" [1]=> string(1) "1" + [2]=> + NULL + [3]=> + NULL + [4]=> + NULL } -array(2) { +array(5) { [0]=> string(1) "1" [1]=> string(1) "1" + [2]=> + NULL + [3]=> + NULL + [4]=> + NULL } -array(2) { +array(5) { [0]=> string(1) "1" [1]=> string(1) "1" + [2]=> + NULL + [3]=> + NULL + [4]=> + NULL } Done diff --git a/ext/oci8/tests/field_funcs.phpt b/ext/oci8/tests/field_funcs.phpt index 2f1dbd710..988e5f7a1 100644 --- a/ext/oci8/tests/field_funcs.phpt +++ b/ext/oci8/tests/field_funcs.phpt @@ -34,7 +34,7 @@ if (!oci_execute($s)) { die("oci_execute(select) failed!\n"); } -$row = oci_fetch_array($s, OCI_RETURN_NULLS + OCI_RETURN_LOBS); +$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS); var_dump($row); foreach ($row as $num => $field) { @@ -97,7 +97,7 @@ int(0) int(4000) bool(true) string(6) "STRING" -string(7) "VARCHAR" +string(8) "VARCHAR2" int(1) int(0) int(0) diff --git a/ext/oci8/tests/field_funcs1.phpt b/ext/oci8/tests/field_funcs1.phpt index 68986e051..b41e743e4 100644 --- a/ext/oci8/tests/field_funcs1.phpt +++ b/ext/oci8/tests/field_funcs1.phpt @@ -34,7 +34,7 @@ if (!oci_execute($s)) { die("oci_execute(select) failed!\n"); } -$row = oci_fetch_array($s, OCI_RETURN_NULLS + OCI_RETURN_LOBS); +$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS); var_dump($row); var_dump(oci_field_is_null($s, -1)); diff --git a/ext/oci8/tests/field_funcs_old.phpt b/ext/oci8/tests/field_funcs_old.phpt index 8627f6a78..34af09429 100644 --- a/ext/oci8/tests/field_funcs_old.phpt +++ b/ext/oci8/tests/field_funcs_old.phpt @@ -97,7 +97,7 @@ int(0) int(4000) bool(true) string(6) "STRING" -string(7) "VARCHAR" +string(8) "VARCHAR2" int(1) int(0) int(0) diff --git a/ext/oci8/tests/lob_001.phpt b/ext/oci8/tests/lob_001.phpt Binary files differindex 029888469..cbcb92e7e 100644 --- a/ext/oci8/tests/lob_001.phpt +++ b/ext/oci8/tests/lob_001.phpt diff --git a/ext/oci8/tests/lob_011.phpt b/ext/oci8/tests/lob_011.phpt index 2dd78985f..b074e1730 100644 --- a/ext/oci8/tests/lob_011.phpt +++ b/ext/oci8/tests/lob_011.phpt @@ -69,8 +69,10 @@ echo "Done\n"; int(32) bool(true) string(32) "some string here. string, I said" -array(1) { +array(2) { [0]=> string(32) "some string here. string, I said" + ["BLOB"]=> + string(32) "some string here. string, I said" } Done diff --git a/ext/oci8/tests/lob_019.phpt b/ext/oci8/tests/lob_019.phpt Binary files differnew file mode 100644 index 000000000..fb9a3c818 --- /dev/null +++ b/ext/oci8/tests/lob_019.phpt diff --git a/ext/oci8/tests/lob_020.phpt b/ext/oci8/tests/lob_020.phpt Binary files differnew file mode 100644 index 000000000..edd0f0249 --- /dev/null +++ b/ext/oci8/tests/lob_020.phpt diff --git a/ext/oci8/tests/select_null.phpt b/ext/oci8/tests/select_null.phpt index 20307b3e2..87c5b815f 100644 --- a/ext/oci8/tests/select_null.phpt +++ b/ext/oci8/tests/select_null.phpt @@ -16,8 +16,10 @@ var_dump(oci_fetch_array($stmt, OCI_RETURN_NULLS)); echo "Done\n"; ?> --EXPECT-- -array(1) { +array(2) { [0]=> NULL + ["NULL"]=> + NULL } Done diff --git a/ext/oci8/tests/test.gif b/ext/oci8/tests/test.gif Binary files differnew file mode 100644 index 000000000..f352c7308 --- /dev/null +++ b/ext/oci8/tests/test.gif |
