diff options
author | Gabriel Caruso <carusogabriel34@gmail.com> | 2017-12-31 05:35:25 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2018-01-03 14:38:00 +0100 |
commit | 64002648562362b97fcb78b68366b1b2118ffd5b (patch) | |
tree | bd764caf78ed4982cb4ceeb216755cd9eb9952df /ext/oci8 | |
parent | a76eeea73608e2d4d088a1c00ec985907e327d24 (diff) | |
download | php-git-64002648562362b97fcb78b68366b1b2118ffd5b.tar.gz |
Trailing whitespaces
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
Diffstat (limited to 'ext/oci8')
-rw-r--r-- | ext/oci8/oci8.c | 2 | ||||
-rw-r--r-- | ext/oci8/oci8_collection.c | 58 | ||||
-rw-r--r-- | ext/oci8/oci8_failover.c | 4 | ||||
-rw-r--r-- | ext/oci8/oci8_interface.c | 286 | ||||
-rw-r--r-- | ext/oci8/oci8_lob.c | 96 | ||||
-rw-r--r-- | ext/oci8/oci8_statement.c | 150 |
6 files changed, 298 insertions, 298 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index b49778ef68..f09feac061 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1872,7 +1872,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char if ((tmp_val != NULL) && (Z_TYPE_P(tmp_val) == IS_RESOURCE)) { tmp = Z_RES_VAL_P(tmp_val); } - + if ((tmp_val != NULL) && (tmp != NULL) && (ZSTR_LEN(tmp->hash_key) == ZSTR_LEN(hashed_details.s)) && (memcmp(ZSTR_VAL(tmp->hash_key), ZSTR_VAL(hashed_details.s), diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index a1550e3400..0837761a4f 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -41,13 +41,13 @@ /* {{{ php_oci_collection_create() Create and return connection handle */ php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len) -{ +{ dvoid *dschp1 = NULL; dvoid *parmp1; dvoid *parmp2; php_oci_collection *collection; sword errstatus; - + collection = emalloc(sizeof(php_oci_collection)); collection->connection = connection; @@ -195,7 +195,7 @@ php_oci_collection *php_oci_collection_create(php_oci_connection *connection, ch default: php_error_docref(NULL, E_WARNING, "unknown collection type %d", collection->coll_typecode); break; - } + } /* Create object to hold return table */ PHP_OCI_CALL_RETURN(errstatus, OCIObjectNew, @@ -221,7 +221,7 @@ php_oci_collection *php_oci_collection_create(php_oci_connection *connection, ch PHP_OCI_REGISTER_RESOURCE(collection, le_collection); connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return collection; - + CLEANUP: if (dschp1) { @@ -230,7 +230,7 @@ CLEANUP: } connection->errcode = php_oci_error(connection->err, errstatus); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - php_oci_collection_close(collection); + php_oci_collection_close(collection); return NULL; } /* }}} */ @@ -241,7 +241,7 @@ int php_oci_collection_size(php_oci_collection *collection, sb4 *size) { php_oci_connection *connection = collection->connection; sword errstatus; - + PHP_OCI_CALL_RETURN(errstatus, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size)); if (errstatus != OCI_SUCCESS) { @@ -259,7 +259,7 @@ int php_oci_collection_size(php_oci_collection *collection, sb4 *size) int php_oci_collection_max(php_oci_collection *collection, zend_long *max) { php_oci_connection *connection = collection->connection; - + PHP_OCI_CALL_RETURN(*max, OCICollMax, (connection->env, collection->collection)); /* error handling is not necessary here? */ @@ -296,7 +296,7 @@ int php_oci_collection_append_null(php_oci_collection *collection) /* append NULL element */ PHP_OCI_CALL_RETURN(errstatus, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection)); - + if (errstatus != OCI_SUCCESS) { errstatus = php_oci_error(connection->err, errstatus); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); @@ -341,7 +341,7 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } @@ -358,7 +358,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe sword errstatus; element_double = zend_strtod(number, NULL); - + PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); if (errstatus != OCI_SUCCESS) { @@ -396,7 +396,7 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme OCIString *ocistr = (OCIString *)0; php_oci_connection *connection = collection->connection; sword errstatus; - + PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); if (errstatus != OCI_SUCCESS) { @@ -433,12 +433,12 @@ int php_oci_collection_append(php_oci_collection *collection, char *element, int if (element_len == 0) { return php_oci_collection_append_null(collection); } - + switch(collection->element_typecode) { case OCI_TYPECODE_DATE: return php_oci_collection_append_date(collection, element, element_len); break; - + case OCI_TYPECODE_VARCHAR2 : return php_oci_collection_append_string(collection, element, element_len); break; @@ -478,7 +478,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind oratext buff[1024]; ub4 buff_len = 1024; sword errstatus; - + ZVAL_NULL(result_element); connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ @@ -500,7 +500,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - + if (exists == 0) { /* element doesn't exist */ return 1; @@ -514,7 +514,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind switch (collection->element_typecode) { case OCI_TYPECODE_DATE: PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff)); - + if (errstatus != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, errstatus); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); @@ -523,7 +523,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind ZVAL_STRINGL(result_element, (char *)buff, buff_len); Z_STRVAL_P(result_element)[buff_len] = '\0'; - + return 0; break; @@ -531,9 +531,9 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind { OCIString *oci_string = *(OCIString **)element; text *str; - + PHP_OCI_CALL_RETURN(str, OCIStringPtr, (connection->env, oci_string)); - + if (str) { ZVAL_STRING(result_element, (char *)str); } @@ -554,7 +554,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind case OCI_TYPECODE_SMALLINT: /* SMALLINT */ { double double_number; - + PHP_OCI_CALL_RETURN(errstatus, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number)); if (errstatus != OCI_SUCCESS) { @@ -562,7 +562,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - + ZVAL_DOUBLE(result_element, double_number); return 0; @@ -588,7 +588,7 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, zend_lon /* set NULL element */ PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection)); - + if (errstatus != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, errstatus); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); @@ -634,7 +634,7 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, zend_lon PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } @@ -651,7 +651,7 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, zend_l sword errstatus; element_double = zend_strtod(number, NULL); - + PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); if (errstatus != OCI_SUCCESS) { @@ -690,7 +690,7 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, zend_l OCIString *ocistr = (OCIString *)0; php_oci_connection *connection = collection->connection; sword errstatus; - + PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); if (errstatus != OCI_SUCCESS) { @@ -728,12 +728,12 @@ int php_oci_collection_element_set(php_oci_collection *collection, zend_long ind if (value_len == 0) { return php_oci_collection_element_set_null(collection, index); } - + switch(collection->element_typecode) { case OCI_TYPECODE_DATE: return php_oci_collection_element_set_date(collection, index, value, value_len); break; - + case OCI_TYPECODE_VARCHAR2 : return php_oci_collection_element_set_string(collection, index, value, value_len); break; @@ -768,7 +768,7 @@ int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_colle { php_oci_connection *connection = collection_dest->connection; sword errstatus; - + PHP_OCI_CALL_RETURN(errstatus, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection)); if (errstatus != OCI_SUCCESS) { @@ -798,7 +798,7 @@ void php_oci_collection_close(php_oci_collection *collection) connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } } - + zend_list_delete(collection->connection->id); efree(collection); return; diff --git a/ext/oci8/oci8_failover.c b/ext/oci8/oci8_failover.c index 68a46bc4db..106945ece7 100644 --- a/ext/oci8/oci8_failover.c +++ b/ext/oci8/oci8_failover.c @@ -40,7 +40,7 @@ #include "php_oci8.h" #include "php_oci8_int.h" -/* {{{ callback_fn() +/* {{{ callback_fn() OCI TAF callback function, calling userspace function */ sb4 callback_fn(void *svchp, void *envhp, void *fo_ctx, ub4 fo_type, ub4 fo_event) { @@ -106,7 +106,7 @@ int php_oci_register_taf_callback(php_oci_connection *connection, zval *callback if (!callback) { /* Unregister callback */ if (Z_ISUNDEF(connection->taf_callback) || Z_ISNULL(connection->taf_callback)) { - return 0; // Nothing to unregister + return 0; // Nothing to unregister } registered = 1; diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index d7ae82d69c..cd17386b5f 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -56,7 +56,7 @@ PHP_FUNCTION(oci_register_taf_callback) } if (callback) { -#if PHP_MAJOR_VERSION > 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION >= 2) +#if PHP_MAJOR_VERSION > 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION >= 2) if (!zend_is_callable(callback, 0, 0)) { callback_name = zend_get_callable_name(callback); php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name)); @@ -172,7 +172,7 @@ PHP_FUNCTION(oci_bind_by_name) zval *z_statement; zval *bind_var = NULL; php_oci_statement *statement; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz|ll", &z_statement, &name, &name_len, &bind_var, &maxlen, &type) == FAILURE) { return; } @@ -180,7 +180,7 @@ PHP_FUNCTION(oci_bind_by_name) if (type) { bind_type = (ub2) type; } - + PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); if (php_oci_bind_by_name(statement, name, name_len, bind_var, maxlen, bind_type)) { @@ -202,7 +202,7 @@ PHP_FUNCTION(oci_bind_array_by_name) zval *z_statement; zval *bind_var = NULL; php_oci_statement *statement; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rszl|ll", &z_statement, &name, &name_len, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) { return; } @@ -212,12 +212,12 @@ PHP_FUNCTION(oci_bind_array_by_name) if (ZEND_NUM_ARGS() == 5 && max_item_len <= 0) { max_item_len = -1; } - + if (max_array_len <= 0) { php_error_docref(NULL, E_WARNING, "Maximum array length must be greater than zero"); RETURN_FALSE; } - + if (php_oci_bind_array_by_name(statement, name, (sb4) name_len, bind_var, max_array_len, max_item_len, type)) { RETURN_FALSE; } @@ -237,7 +237,7 @@ PHP_FUNCTION(oci_free_descriptor) return; } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; @@ -271,7 +271,7 @@ PHP_FUNCTION(oci_lob_save) return; } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; @@ -283,7 +283,7 @@ PHP_FUNCTION(oci_lob_save) php_error_docref(NULL, E_WARNING, "Offset parameter must be greater than or equal to 0"); RETURN_FALSE; } - + if (php_oci_lob_write(descriptor, (ub4) offset, data, (ub4) data_len, &bytes_written)) { RETURN_FALSE; } @@ -308,7 +308,7 @@ PHP_FUNCTION(oci_lob_import) else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "Op", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { return; - } + } } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { @@ -337,14 +337,14 @@ PHP_FUNCTION(oci_lob_load) if (!getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); if (php_oci_lob_read(descriptor, -1, 0, &buffer, &buffer_len)) { @@ -380,24 +380,24 @@ PHP_FUNCTION(oci_lob_read) else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &z_descriptor, oci_lob_class_entry_ptr, &length) == FAILURE) { return; - } + } } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); if (length <= 0) { php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0"); RETURN_FALSE; } - + if (php_oci_lob_read(descriptor, length, descriptor->lob_current_position, &buffer, &buffer_len)) { RETURN_FALSE; - } + } if (buffer_len > 0) { zend_string *ret = zend_string_init(buffer, buffer_len, 0); efree(buffer); @@ -416,20 +416,20 @@ PHP_FUNCTION(oci_lob_eof) zval *tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; ub4 lob_length; - + if (!getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); - + if (!php_oci_lob_get_length(descriptor, &lob_length)) { if (lob_length == descriptor->lob_current_position) { RETURN_TRUE; @@ -445,21 +445,21 @@ PHP_FUNCTION(oci_lob_tell) { zval *tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - + if (!getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); - - RETURN_LONG(descriptor->lob_current_position); + + RETURN_LONG(descriptor->lob_current_position); } /* }}} */ @@ -469,20 +469,20 @@ PHP_FUNCTION(oci_lob_rewind) { zval *tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - + if (!getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); - + descriptor->lob_current_position = 0; RETURN_TRUE; @@ -497,7 +497,7 @@ PHP_FUNCTION(oci_lob_seek) php_oci_descriptor *descriptor; zend_long offset, whence = PHP_OCI_SEEK_SET; ub4 lob_length; - + if (getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &offset, &whence) == FAILURE) { return; @@ -506,14 +506,14 @@ PHP_FUNCTION(oci_lob_seek) else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol|l", &z_descriptor, oci_lob_class_entry_ptr, &offset, &whence) == FAILURE) { return; - } + } } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); if (php_oci_lob_get_length(descriptor, &lob_length)) { @@ -536,7 +536,7 @@ PHP_FUNCTION(oci_lob_seek) default: descriptor->lob_current_position = (offset > 0) ? (ub4) offset : 0; break; - } + } if (descriptor->lob_current_position > UB4MAXVAL) { php_error_docref(NULL, E_WARNING, "Invalid offset or LOB position"); RETURN_FALSE; @@ -552,20 +552,20 @@ PHP_FUNCTION(oci_lob_size) zval *tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; ub4 lob_length; - + if (!getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); - + if (php_oci_lob_get_length(descriptor, &lob_length)) { RETURN_FALSE; } @@ -583,12 +583,12 @@ PHP_FUNCTION(oci_lob_write) zend_long write_len = 0; ub4 bytes_written; char *data; - + if (getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &data, &data_len, &write_len) == FAILURE) { return; } - + if (ZEND_NUM_ARGS() == 2) { data_len = MIN((zend_long) data_len, write_len); } @@ -602,18 +602,18 @@ PHP_FUNCTION(oci_lob_write) data_len = MIN((zend_long) data_len, write_len); } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); - + if (data_len <= 0) { RETURN_LONG(0); } - + if (php_oci_lob_write(descriptor, descriptor->lob_current_position, data, (ub4) data_len, &bytes_written)) { RETURN_FALSE; } @@ -627,7 +627,7 @@ PHP_FUNCTION(oci_lob_append) { zval *tmp_dest, *tmp_from, *z_descriptor_dest = getThis(), *z_descriptor_from; php_oci_descriptor *descriptor_dest, *descriptor_from; - + if (getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor_from, oci_lob_class_entry_ptr) == FAILURE) { return; @@ -636,22 +636,22 @@ PHP_FUNCTION(oci_lob_append) else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr) == FAILURE) { return; - } + } } - + if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object"); RETURN_FALSE; } - + if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_dest, descriptor_dest); PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_from, descriptor_from); - + if (php_oci_lob_append(descriptor_dest, descriptor_from)) { RETURN_FALSE; } @@ -668,7 +668,7 @@ PHP_FUNCTION(oci_lob_truncate) php_oci_descriptor *descriptor; zend_long trim_length = 0; ub4 ub_trim_length; - + if (getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &trim_length) == FAILURE) { return; @@ -677,9 +677,9 @@ PHP_FUNCTION(oci_lob_truncate) else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|l", &z_descriptor, oci_lob_class_entry_ptr, &trim_length) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; @@ -692,7 +692,7 @@ PHP_FUNCTION(oci_lob_truncate) ub_trim_length = (ub4) trim_length; PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); - + if (php_oci_lob_truncate(descriptor, ub_trim_length)) { RETURN_FALSE; } @@ -708,7 +708,7 @@ PHP_FUNCTION(oci_lob_erase) php_oci_descriptor *descriptor; ub4 bytes_erased; zend_long offset = -1, length = -1; - + if (getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &offset, &length) == FAILURE) { return; @@ -733,7 +733,7 @@ PHP_FUNCTION(oci_lob_erase) php_error_docref(NULL, E_WARNING, "Offset must be greater than or equal to 0"); RETURN_FALSE; } - + if (ZEND_NUM_ARGS() > 2 && length < 0) { php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to 0"); RETURN_FALSE; @@ -761,7 +761,7 @@ PHP_FUNCTION(oci_lob_flush) zval *tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; zend_long flush_flag = 0; - + if (getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flush_flag) == FAILURE) { return; @@ -772,14 +772,14 @@ PHP_FUNCTION(oci_lob_flush) return; } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); - + if (descriptor->buffering == PHP_OCI_LOB_BUFFER_DISABLED) { /* buffering wasn't enabled, there is nothing to flush */ RETURN_FALSE; @@ -799,7 +799,7 @@ PHP_FUNCTION(ocisetbufferinglob) zval *tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; zend_bool flag; - + if (getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &flag) == FAILURE) { return; @@ -808,16 +808,16 @@ PHP_FUNCTION(ocisetbufferinglob) else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &z_descriptor, oci_lob_class_entry_ptr, &flag) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); - + if (php_oci_lob_set_buffering(descriptor, flag)) { RETURN_FALSE; } @@ -831,20 +831,20 @@ PHP_FUNCTION(ocigetbufferinglob) { zval *tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - + if (!getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { return; - } + } } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); - + if (descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) { RETURN_TRUE; } @@ -859,29 +859,29 @@ PHP_FUNCTION(oci_lob_copy) zval *tmp_dest, *tmp_from, *z_descriptor_dest, *z_descriptor_from; php_oci_descriptor *descriptor_dest, *descriptor_from; zend_long length = 0; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO|l", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr, &length) == FAILURE) { return; } - + if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object"); RETURN_FALSE; } - + if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_dest, descriptor_dest); PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_from, descriptor_from); - + if (ZEND_NUM_ARGS() == 3 && length < 0) { php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0"); RETURN_FALSE; } - + if (ZEND_NUM_ARGS() == 2) { /* indicate that we want to copy from the current position to the end of the LOB */ length = -1; @@ -901,28 +901,28 @@ PHP_FUNCTION(oci_lob_is_equal) zval *tmp_first, *tmp_second, *z_descriptor_first, *z_descriptor_second; php_oci_descriptor *descriptor_first, *descriptor_second; boolean is_equal; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &z_descriptor_first, oci_lob_class_entry_ptr, &z_descriptor_second, oci_lob_class_entry_ptr) == FAILURE) { return; } - + if ((tmp_first = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_first), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object"); RETURN_FALSE; } - + if ((tmp_second = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_second), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_first, descriptor_first); PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_second, descriptor_second); if (php_oci_lob_is_equal(descriptor_first, descriptor_second, &is_equal)) { RETURN_FALSE; } - + if (is_equal == TRUE) { RETURN_TRUE; } @@ -933,7 +933,7 @@ PHP_FUNCTION(oci_lob_is_equal) /* {{{ proto bool oci_lob_export([string filename [, int start [, int length]]]) Writes a large object into a file */ PHP_FUNCTION(oci_lob_export) -{ +{ zval *tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; char *filename; @@ -947,7 +947,7 @@ PHP_FUNCTION(oci_lob_export) if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|ll", &filename, &filename_len, &start, &length) == FAILURE) { return; } - + if (ZEND_NUM_ARGS() > 1 && start < 0) { php_error_docref(NULL, E_WARNING, "Start parameter must be greater than or equal to 0"); RETURN_FALSE; @@ -961,7 +961,7 @@ PHP_FUNCTION(oci_lob_export) if (zend_parse_parameters(ZEND_NUM_ARGS(), "Op|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) { return; } - + if (ZEND_NUM_ARGS() > 2 && start < 0) { php_error_docref(NULL, E_WARNING, "Start parameter must be greater than or equal to 0"); RETURN_FALSE; @@ -976,13 +976,13 @@ PHP_FUNCTION(oci_lob_export) php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); - + if (php_oci_lob_get_length(descriptor, &lob_length)) { RETURN_FALSE; - } - + } + if (start == -1) { start = 0; } @@ -1026,7 +1026,7 @@ PHP_FUNCTION(oci_lob_export) if (buffer) { efree(buffer); } - + length -= tmp_bytes_read; descriptor->lob_current_position += tmp_bytes_read; start += tmp_bytes_read; @@ -1059,14 +1059,14 @@ PHP_FUNCTION(oci_lob_write_temporary) else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &type) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); if (php_oci_lob_write_tmp(descriptor, type, data, (int) data_len)) { @@ -1082,18 +1082,18 @@ PHP_FUNCTION(oci_lob_close) { zval *tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - + if (!getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor); if (php_oci_lob_close(descriptor)) { @@ -1119,8 +1119,8 @@ PHP_FUNCTION(oci_new_descriptor) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); /* php_oci_lob_create() checks type */ - descriptor = php_oci_lob_create(connection, type); - + descriptor = php_oci_lob_create(connection, type); + if (!descriptor) { RETURN_NULL(); } @@ -1170,7 +1170,7 @@ PHP_FUNCTION(oci_commit) if (connection->descriptors) { php_oci_connection_descriptors_free(connection); } - + if (php_oci_connection_commit(connection)) { RETURN_FALSE; } @@ -1245,7 +1245,7 @@ PHP_FUNCTION(oci_field_type) if (!column) { RETURN_FALSE; } - + switch (column->data_type) { #ifdef SQLT_TIMESTAMP case SQLT_TIMESTAMP: @@ -1460,7 +1460,7 @@ PHP_FUNCTION(oci_fetch_all) while (!php_oci_statement_fetch(statement, nrows)) { zval row; - + array_init_size(&row, statement->ncolumns); for (i = 0; i < statement->ncolumns; i++) { @@ -1491,11 +1491,11 @@ PHP_FUNCTION(oci_fetch_all) array_init_size(array, statement->ncolumns); columns = safe_emalloc(statement->ncolumns, sizeof(php_oci_out_column *), 0); outarrs = safe_emalloc(statement->ncolumns, sizeof(zval*), 0); - + if (flags & PHP_OCI_NUM) { for (i = 0; i < statement->ncolumns; i++) { columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0); - + array_init(&tmp); outarrs[ i ] = zend_hash_next_index_insert(Z_ARRVAL_P(array), &tmp); } @@ -1503,7 +1503,7 @@ PHP_FUNCTION(oci_fetch_all) for (i = 0; i < statement->ncolumns; i++) { zend_string *zvtmp; columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0); - + array_init(&tmp); zvtmp = zend_string_init(columns[ i ]->name, columns[ i ]->name_len, 0); outarrs[ i ] = zend_symtable_update(Z_ARRVAL_P(array), zvtmp, &tmp); @@ -1524,7 +1524,7 @@ PHP_FUNCTION(oci_fetch_all) break; } } - + efree(columns); efree(outarrs); } @@ -1605,7 +1605,7 @@ PHP_FUNCTION(oci_close) /* do nothing to keep BC */ return; } - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_connection) == FAILURE) { return; } @@ -1622,7 +1622,7 @@ PHP_FUNCTION(oci_close) } /* ZVAL_NULL(z_connection); */ - + RETURN_TRUE; } /* }}} */ @@ -2071,7 +2071,7 @@ PHP_FUNCTION(oci_new_cursor) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); statement = php_oci_statement_create(connection, NULL, 0); - + if (statement) { RETURN_RES(statement->id); } @@ -2084,7 +2084,7 @@ PHP_FUNCTION(oci_new_cursor) PHP_FUNCTION(oci_result) { php_oci_out_column *column; - + column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); if(column) { php_oci_column_to_zval(column, return_value, 0); @@ -2124,7 +2124,7 @@ PHP_FUNCTION(oci_server_version) if (php_oci_server_get_version(connection, version, sizeof(version))) { RETURN_FALSE; } - + ret = zend_string_init(version, strlen(version), 0); RETURN_STR(ret); } @@ -2216,14 +2216,14 @@ PHP_FUNCTION(oci_free_collection) if (!getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find collection property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection); zend_list_close(collection->id); @@ -2248,14 +2248,14 @@ PHP_FUNCTION(oci_collection_append) else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os", &z_collection, oci_coll_class_entry_ptr, &value, &value_len) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find collection property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection); if (php_oci_collection_append(collection, value, (int) value_len)) { @@ -2282,20 +2282,20 @@ PHP_FUNCTION(oci_collection_element_get) else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &z_collection, oci_coll_class_entry_ptr, &element_index) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find collection property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection); if (php_oci_collection_element_get(collection, element_index, &value)) { RETURN_FALSE; } - + RETURN_ZVAL(&value, 1, 1); } /* }}} */ @@ -2315,9 +2315,9 @@ PHP_FUNCTION(oci_collection_assign) else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &z_collection_dest, oci_coll_class_entry_ptr, &z_collection_from, oci_coll_class_entry_ptr) == FAILURE) { return; - } + } } - + if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_collection_dest), "collection", sizeof("collection")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find collection property. The first argument should be valid collection object"); RETURN_FALSE; @@ -2356,14 +2356,14 @@ PHP_FUNCTION(oci_collection_element_assign) else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ols", &z_collection, oci_coll_class_entry_ptr, &element_index, &value, &value_len) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find collection property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection); if (php_oci_collection_element_set(collection, element_index, value, (int) value_len)) { @@ -2380,18 +2380,18 @@ PHP_FUNCTION(oci_collection_size) zval *tmp, *z_collection = getThis(); php_oci_collection *collection; sb4 size = 0; - + if (!getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find collection property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection); if (php_oci_collection_size(collection, &size)) { @@ -2408,18 +2408,18 @@ PHP_FUNCTION(oci_collection_max) zval *tmp, *z_collection = getThis(); php_oci_collection *collection; zend_long max; - + if (!getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find collection property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection); if (php_oci_collection_max(collection, &max)) { @@ -2445,20 +2445,20 @@ PHP_FUNCTION(oci_collection_trim) else { if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &z_collection, oci_coll_class_entry_ptr, &trim_size) == FAILURE) { return; - } + } } - + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find collection property"); RETURN_FALSE; } - + PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection); if (php_oci_collection_trim(collection, trim_size)) { RETURN_FALSE; } - RETURN_TRUE; + RETURN_TRUE; } /* }}} */ @@ -2471,13 +2471,13 @@ PHP_FUNCTION(oci_new_collection) php_oci_collection *collection; char *tdo, *schema = NULL; size_t tdo_len, schema_len = 0; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|s", &z_connection, &tdo, &tdo_len, &schema, &schema_len) == FAILURE) { return; } - + PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - + if ( (collection = php_oci_collection_create(connection, tdo, (int) tdo_len, schema, (int) schema_len)) ) { object_init_ex(return_value, oci_coll_class_entry_ptr); add_property_resource(return_value, "collection", collection->id); diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c index 0566c552eb..7320bca899 100644 --- a/ext/oci8/oci8_lob.c +++ b/ext/oci8/oci8_lob.c @@ -81,7 +81,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, zend_lon } PHP_OCI_REGISTER_RESOURCE(descriptor, le_descriptor); - + descriptor->lob_current_position = 0; descriptor->lob_size = -1; /* we should set it to -1 to know, that it's just not initialized */ descriptor->buffering = PHP_OCI_LOB_BUFFER_DISABLED; /* buffering is off by default */ @@ -97,7 +97,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, zend_lon zend_hash_init(connection->descriptors, 0, NULL, php_oci_descriptor_flush_hash_dtor, 0); connection->descriptor_count = 0; } - + descriptor->index = (connection->descriptor_count)++; if (connection->descriptor_count == LONG_MAX) { php_error_docref(NULL, E_WARNING, "Internal descriptor counter has reached limit"); @@ -120,7 +120,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length) sword errstatus; *length = 0; - + if (descriptor->lob_size >= 0) { *length = descriptor->lob_size; return 0; @@ -133,7 +133,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length) return 1; } } - + PHP_OCI_CALL_RETURN(errstatus, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length)); if (errstatus != OCI_SUCCESS) { @@ -156,7 +156,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length) connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } - return 0; + return 0; } /* }}} */ @@ -203,7 +203,7 @@ sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece } /* }}} */ -/* {{{ php_oci_lob_calculate_buffer() +/* {{{ php_oci_lob_calculate_buffer() Work out the size for LOB buffering */ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, zend_long read_length) { @@ -226,7 +226,7 @@ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, z descriptor->chunk_size = chunk_size; connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } - + if ((read_length % descriptor->chunk_size) != 0) { return (int) descriptor->chunk_size * (((int) read_length / descriptor->chunk_size) + 1); } @@ -264,24 +264,24 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, zend_long read_length, zen if (length <= 0) { return 0; } - + if (initial_offset > length) { php_error_docref(NULL, E_WARNING, "Offset must be less than size of the LOB"); return 1; } - + if (read_length == -1) { requested_len = length; } - + if ((ub4) requested_len > (length - (ub4) initial_offset)) { requested_len = length - initial_offset; } - + if (requested_len <= 0) { return 0; } - + offset = initial_offset; if (descriptor->type == OCI_DTYPE_FILE) { @@ -352,15 +352,15 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, zend_long read_length, zen (ub1) descriptor->charset_form /* The character set form of the buffer data. */ ) ); - + efree(bufp); - + if (is_clob) { offset = descriptor->lob_current_position + chars_read; } else { offset = descriptor->lob_current_position + bytes_read; } - + if (errstatus != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, errstatus); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); @@ -371,7 +371,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, zend_long read_length, zen *data_len = 0; return 1; } - + descriptor->lob_current_position = (int)offset; if (descriptor->type == OCI_DTYPE_FILE) { @@ -402,20 +402,20 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i php_oci_connection *connection = (php_oci_connection *) descriptor->connection; ub4 lob_length; sword errstatus; - + *bytes_written = 0; if (php_oci_lob_get_length(descriptor, &lob_length)) { return 1; } - + if (!data || data_len <= 0) { return 0; } - + if (offset > descriptor->lob_current_position) { offset = descriptor->lob_current_position; } - + PHP_OCI_CALL_RETURN(errstatus, OCILobWrite, ( connection->svc, @@ -441,16 +441,16 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i } *bytes_written = data_len; descriptor->lob_current_position += data_len; - + if ((int) descriptor->lob_current_position > (int) descriptor->lob_size) { descriptor->lob_size = descriptor->lob_current_position; } - + /* marking buffer as used */ if (descriptor->buffering == PHP_OCI_LOB_BUFFER_ENABLED) { descriptor->buffering = PHP_OCI_LOB_BUFFER_USED; } - + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } @@ -467,12 +467,12 @@ int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off) /* disabling when it's already off */ return 0; } - + if (on_off && descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) { /* enabling when it's already on */ return 0; } - + if (on_off) { PHP_OCI_CALL_RETURN(errstatus, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor)); } else { @@ -509,11 +509,11 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d php_oci_connection *connection = descriptor_dest->connection; ub4 length_dest, length_from, copy_len; sword errstatus; - + if (php_oci_lob_get_length(descriptor_dest, &length_dest)) { return 1; } - + if (php_oci_lob_get_length(descriptor_from, &length_from)) { return 1; } @@ -546,7 +546,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } @@ -573,7 +573,7 @@ int php_oci_lob_close (php_oci_descriptor *descriptor) if (php_oci_temp_lob_close(descriptor)) { return 1; } - + return 0; } /* }}} */ @@ -587,16 +587,16 @@ int php_oci_temp_lob_close (php_oci_descriptor *descriptor) sword errstatus; PHP_OCI_CALL_RETURN(errstatus, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary)); - + if (errstatus != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, errstatus); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - + if (is_temporary) { PHP_OCI_CALL_RETURN(errstatus, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor)); - + if (errstatus != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, errstatus); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); @@ -630,7 +630,7 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, zend_long flush_flag) return 1; break; } - + /* do not really flush buffer, but report success * to suppress OCI error when flushing not used buffer * */ @@ -683,7 +683,7 @@ void php_oci_lob_free (php_oci_descriptor *descriptor) } } } - + /* flushing Lobs & Files with buffering enabled */ if ((descriptor->type == OCI_DTYPE_FILE || descriptor->type == OCI_DTYPE_LOB) && descriptor->buffering == PHP_OCI_LOB_BUFFER_USED) { php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE); @@ -711,17 +711,17 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename) char buf[8192]; ub4 offset = 1; sword errstatus; - + if (php_check_open_basedir(filename)) { return 1; } - + if ((fp = VCWD_OPEN(filename, O_RDONLY|O_BINARY)) == -1) { php_error_docref(NULL, E_WARNING, "Can't open file %s", filename); return 1; } - while ((loblen = read(fp, &buf, sizeof(buf))) > 0) { + while ((loblen = read(fp, &buf, sizeof(buf))) > 0) { PHP_OCI_CALL_RETURN(errstatus, OCILobWrite, ( @@ -751,7 +751,7 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename) offset += loblen; } close(fp); - + return 0; } /* }}} */ @@ -769,7 +769,7 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor if (php_oci_lob_get_length(descriptor_dest, &dest_len)) { return 1; } - + if (php_oci_lob_get_length(descriptor_from, &from_len)) { return 1; } @@ -798,11 +798,11 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, zend_long new_lob_leng OCILobLocator *lob = descriptor->descriptor; ub4 lob_length; sword errstatus; - + if (php_oci_lob_get_length(descriptor, &lob_length)) { return 1; } - + if (lob_length <= 0) { return 0; } @@ -816,7 +816,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, zend_long new_lob_leng php_error_docref(NULL, E_WARNING, "Size must be less than or equal to the current LOB size"); return 1; } - + PHP_OCI_CALL_RETURN(errstatus, OCILobTrim, (connection->svc, connection->err, lob, (ub4) new_lob_length)); if (errstatus != OCI_SUCCESS) { @@ -824,7 +824,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, zend_long new_lob_leng PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - + descriptor->lob_size = (ub4) new_lob_length; connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ @@ -842,11 +842,11 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, zend_long offset, ub4 len sword errstatus; *bytes_erased = 0; - + if (php_oci_lob_get_length(descriptor, &lob_length)) { return 1; } - + if (offset == -1) { offset = descriptor->lob_current_position; } @@ -854,7 +854,7 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, zend_long offset, ub4 len if (length == -1) { length = lob_length; } - + PHP_OCI_CALL_RETURN(errstatus, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, (ub4) offset+1)); if (errstatus != OCI_SUCCESS) { @@ -862,7 +862,7 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, zend_long offset, ub4 len PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - + *bytes_erased = length; connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; @@ -898,7 +898,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, zend_long type, char OCILobLocator *lob = descriptor->descriptor; ub4 bytes_written = 0; sword errstatus; - + switch (type) { case OCI_TEMP_BLOB: case OCI_TEMP_CLOB: diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index a346dfe0d3..1ce8d0c55c 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -60,9 +60,9 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char /* do not allocate stmt handle for refcursors, we'll get it from OCIStmtPrepare2() */ PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NULL)); } - + PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NULL)); - + if (query_len > 0) { PHP_OCI_CALL_RETURN(errstatus, OCIStmtPrepare2, ( @@ -93,7 +93,7 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char return NULL; } } - + if (query && query_len) { statement->last_query = ecalloc(1, query_len + 1); memcpy(statement->last_query, query, query_len); @@ -118,11 +118,11 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char } else { php_oci_statement_set_prefetch(statement, (ub4)100); /* semi-arbitrary, "sensible default" */ } - + PHP_OCI_REGISTER_RESOURCE(statement, le_statement); OCI_G(num_statements)++; - + return statement; } /* }}} */ @@ -153,7 +153,7 @@ php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement) statement2 = ecalloc(1,sizeof(php_oci_statement)); PHP_OCI_CALL(OCIHandleAlloc, (statement->connection->env, (dvoid **)&(statement2->err), OCI_HTYPE_ERROR, 0, NULL)); - statement2->stmt = (OCIStmt *)result; + statement2->stmt = (OCIStmt *)result; statement2->parent_stmtid = statement->id; statement2->impres_child_stmt = NULL; statement2->impres_count = 0; @@ -175,11 +175,11 @@ php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement) GC_ADDREF(statement2->connection->id); php_oci_statement_set_prefetch(statement2, statement->prefetch_count); - + PHP_OCI_REGISTER_RESOURCE(statement2, le_statement); - + OCI_G(num_statements)++; - + return statement2; } #endif /* OCI_MAJOR_VERSION < 12 */ @@ -197,7 +197,7 @@ int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch ) } PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err)); - + if (errstatus != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, errstatus); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); @@ -293,7 +293,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows) piecewisecols = 1; } } - + while (errstatus == OCI_NEED_DATA) { if (piecewisecols) { PHP_OCI_CALL_RETURN(errstatus, @@ -359,11 +359,11 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows) if (column == NULL) { continue; } - + if (!column->define) { continue; } - + ZEND_ASSERT(Z_ISREF(column->define->val)); zval_ptr_dtor(Z_REFVAL(column->define->val)); ZVAL_NULL(Z_REFVAL(column->define->val)); @@ -419,11 +419,11 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf php_oci_out_column *outcol = (php_oci_out_column *)ctx; if (!outcol) { - + php_error_docref(NULL, E_WARNING, "Invalid context pointer value"); return OCI_ERROR; } - + switch(outcol->data_type) { case SQLT_RSET: { php_oci_statement *nested_stmt; @@ -466,7 +466,7 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf } outcol->descid = descr->id; descr->charset_form = outcol->charset_form; - + *bufpp = descr->descriptor; *alenpp = &(outcol->retlen4); *piecep = OCI_ONE_PIECE; @@ -512,7 +512,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) return 1; break; } - + if (!statement->stmttype) { /* get statement type */ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); @@ -531,7 +531,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) } else { iters = 1; } - + if (statement->last_query) { /* Don't execute REFCURSORS or Implicit Result Set handles */ if (statement->binds) { @@ -550,7 +550,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } - + if (statement->binds) { zend_hash_apply(statement->binds, php_oci_bind_post_exec); } @@ -575,15 +575,15 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) if (statement->stmttype == OCI_STMT_SELECT && statement->executed == 0) { /* we only need to do the define step is this very statement is executed the first time! */ statement->executed = 1; - + ALLOC_HASHTABLE(statement->columns); zend_hash_init(statement->columns, 13, NULL, php_oci_column_hash_dtor, 0); - + counter = 1; /* get number of columns */ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err)); - + if (errstatus != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, errstatus); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); @@ -591,19 +591,19 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) } statement->ncolumns = colcount; - + for (counter = 1; counter <= colcount; counter++) { outcol = (php_oci_out_column *) ecalloc(1, sizeof(php_oci_out_column)); - + if ((outcol = zend_hash_index_update_ptr(statement->columns, counter, outcol)) == NULL) { FREE_HASHTABLE(statement->columns); /* out of memory */ return 1; } - + /* get column */ PHP_OCI_CALL_RETURN(errstatus, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)¶m, counter)); - + if (errstatus != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, errstatus); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); @@ -629,7 +629,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } - + /* get character set id */ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err)); @@ -639,10 +639,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } - + /* get size of the column */ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err)); - + if (errstatus != OCI_SUCCESS) { PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); statement->errcode = php_oci_error(statement->err, errstatus); @@ -655,7 +655,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) /* get scale of the column */ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err)); - + if (errstatus != OCI_SUCCESS) { PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); statement->errcode = php_oci_error(statement->err, errstatus); @@ -665,17 +665,17 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) /* get precision of the column */ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err)); - + if (errstatus != OCI_SUCCESS) { PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); statement->errcode = php_oci_error(statement->err, errstatus); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } - + /* get name of the column */ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err)); - + if (errstatus != OCI_SUCCESS) { PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); statement->errcode = php_oci_error(statement->err, errstatus); @@ -766,9 +766,9 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) } else { outcol->storage_size4++; /* add one for string terminator */ } - + outcol->storage_size4 *= 3; - + dynamic = OCI_DEFAULT; buf = outcol->data = (text *) safe_emalloc(1, outcol->storage_size4, 0); memset(buf, 0, outcol->storage_size4); @@ -812,7 +812,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode) ); } - + if (errstatus != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, errstatus); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); @@ -902,7 +902,7 @@ void php_oci_statement_free(php_oci_statement *statement) zend_list_delete(statement->connection->id); efree(statement); - + OCI_G(num_statements)--; } /* }}} */ @@ -923,7 +923,7 @@ int php_oci_bind_pre_exec(zval *data, void *result) * bind->indicator are not used for oci_bind_array_by_name. */ return 0; - } + } switch (bind->type) { case SQLT_NTY: case SQLT_BFILEE: @@ -936,7 +936,7 @@ int php_oci_bind_pre_exec(zval *data, void *result) *(int *)result = 1; } break; - + case SQLT_CHR: case SQLT_AFC: case SQLT_INT: @@ -1036,7 +1036,7 @@ int php_oci_bind_post_exec(zval *data) ub4 buff_len = 1024; memset((void*)buff,0,sizeof(buff)); - + if ((i < (int) bind->array.old_length) && (entry = zend_hash_get_current_data(hash)) != NULL) { PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); zval_ptr_dtor(entry); @@ -1063,7 +1063,7 @@ int php_oci_bind_post_exec(zval *data) } } break; - + case SQLT_AFC: case SQLT_CHR: case SQLT_VCS: @@ -1119,7 +1119,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l case SQLT_NTY: { zval *tmp; - + if (Z_TYPE_P(param) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(param), "collection", sizeof("collection")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find collection property"); return 1; @@ -1128,7 +1128,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l PHP_OCI_ZVAL_TO_COLLECTION_EX(tmp, bind_collection); value_sz = sizeof(void*); mode = OCI_DEFAULT; - + if (!bind_collection->collection) { return 1; } @@ -1141,7 +1141,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l case SQLT_RDD: { zval *tmp; - + if (Z_TYPE_P(param) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(param), "descriptor", sizeof("descriptor")-1)) == NULL) { php_error_docref(NULL, E_WARNING, "Unable to find descriptor property"); return 1; @@ -1150,15 +1150,15 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(tmp, bind_descriptor); value_sz = sizeof(void*); - + oci_desc = bind_descriptor->descriptor; - + if (!oci_desc) { return 1; } } break; - + case SQLT_INT: case SQLT_NUM: if (Z_TYPE_P(param) == IS_RESOURCE || Z_TYPE_P(param) == IS_OBJECT) { @@ -1170,7 +1170,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l value_sz = sizeof(oci_phpsized_int); mode = OCI_DEFAULT; break; - + case SQLT_LBI: case SQLT_BIN: case SQLT_LNG: @@ -1260,12 +1260,12 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l zend_string_release(zvtmp); } - /* Make sure the minimum of value_sz is 1 to avoid ORA-3149 + /* Make sure the minimum of value_sz is 1 to avoid ORA-3149 * when both in/out parameters are bound with empty strings */ if (value_sz == 0) value_sz = 1; - + bindp->descriptor = oci_desc; bindp->statement = oci_stmt; bindp->parent_statement = statement; @@ -1283,7 +1283,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l statement->stmt, /* statement handle */ (OCIBind **)&bindp->bind, /* bind hdl (will alloc) */ statement->err, /* error handle */ - (text*) name, /* placeholder name */ + (text*) name, /* placeholder name */ (sb4) name_len, /* placeholder length */ (dvoid *)bind_data, /* in/out data */ value_sz, /* PHP_OCI_MAX_DATA_SIZE, */ /* max size of input/output data */ @@ -1335,14 +1335,14 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l (ub4 *) 0 ) ); - + if (errstatus) { statement->errcode = php_oci_error(statement->err, errstatus); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } } - + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } @@ -1484,7 +1484,7 @@ sb4 php_oci_bind_out_callback( Z_STRVAL_P(val) = ecalloc(1, Z_STRLEN_P(val) + 1); /* XXX is this right? */ ZVAL_STRINGL(val, NULL, Z_STRLEN(val) + 1); -#endif +#endif /* XXX we assume that zend-zval len has 4 bytes */ *alenpp = (ub4*) &Z_STRLEN_P(val); @@ -1520,7 +1520,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME 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), (int) Z_STRLEN_P(column_index)); if (!column) { @@ -1551,9 +1551,9 @@ int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type) { ub2 statement_type; sword errstatus; - + *type = 0; - + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); if (errstatus != OCI_SUCCESS) { @@ -1574,9 +1574,9 @@ int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows) { ub4 statement_numrows; sword errstatus; - + *numrows = 0; - + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err)); if (errstatus != OCI_SUCCESS) { @@ -1609,7 +1609,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t php_error_docref(NULL, E_WARNING, "Invalid max length value (" ZEND_LONG_FMT ")", maxlength); return 1; } - + switch(type) { case SQLT_NUM: case SQLT_INT: @@ -1620,7 +1620,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t case SQLT_FLT: bind = php_oci_bind_array_helper_double(val, max_table_length); break; - + case SQLT_AFC: case SQLT_CHR: case SQLT_VCS: @@ -1646,7 +1646,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t /* failed to generate bind struct */ return 1; } - + bind->descriptor = NULL; bind->statement = NULL; bind->parent_statement = statement; @@ -1675,8 +1675,8 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t (ub4) OCI_DEFAULT ) ); - - + + if (errstatus != OCI_SUCCESS) { if (bind->array.elements) { efree(bind->array.elements); @@ -1737,7 +1737,7 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, zend_long max_table_le zend_hash_move_forward(hash); } } - + bind = emalloc(sizeof(php_oci_bind)); ZVAL_UNDEF(&bind->val); bind->array.elements = (text *)safe_emalloc(max_table_length * (maxlength + 1), sizeof(text), 0); @@ -1749,9 +1749,9 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, zend_long max_table_le 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); - + for (i = 0; i < bind->array.current_length; i++) { if ((entry = zend_hash_get_current_data(hash)) != NULL) { convert_to_string_ex(entry); @@ -1769,13 +1769,13 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, zend_long max_table_le for (i = 0; i < max_table_length; i++) { if ((i < bind->array.current_length) && (entry = zend_hash_get_current_data(hash)) != NULL) { int element_length; - + convert_to_string_ex(entry); element_length = ((size_t) maxlength > Z_STRLEN_P(entry)) ? (int) Z_STRLEN_P(entry) : (int) maxlength; - + memcpy((text *)bind->array.elements + i*maxlength, Z_STRVAL_P(entry), element_length); ((text *)bind->array.elements)[i*maxlength + element_length] = '\0'; - + zend_hash_move_forward(hash); } else { ((text *)bind->array.elements)[i*maxlength] = '\0'; @@ -1808,7 +1808,7 @@ php_oci_bind *php_oci_bind_array_helper_number(zval *var, zend_long max_table_le 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++) { if (i < bind->array.current_length) { @@ -1849,7 +1849,7 @@ php_oci_bind *php_oci_bind_array_helper_double(zval *var, zend_long max_table_le 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++) { if (i < bind->array.current_length) { @@ -1899,7 +1899,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, zend_long max_table_leng bind->array.element_lengths[i] = sizeof(OCIDate); } if ((i < bind->array.current_length) && (entry = zend_hash_get_current_data(hash)) != NULL) { - + convert_to_string_ex(entry); PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_P(entry), (ub4) Z_STRLEN_P(entry), NULL, 0, NULL, 0, &oci_date)); @@ -1912,7 +1912,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, zend_long max_table_leng PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return NULL; } - + ((OCIDate *)bind->array.elements)[i] = oci_date; zend_hash_move_forward(hash); } else { @@ -1927,7 +1927,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, zend_long max_table_leng PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return NULL; } - + ((OCIDate *)bind->array.elements)[i] = oci_date; } connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ |