mirror of
https://github.com/php/php-src.git
synced 2026-04-18 21:41:22 +02:00
Merge branch 'PHP-7.1' into PHP-7.2
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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_REFCOUNT(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:
|
||||
@@ -1265,7 +1265,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
|
||||
*/
|
||||
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 */
|
||||
|
||||
@@ -58,7 +58,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): OCI-21560: argument 3 is null, invalid, or out of range in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
|
||||
|
||||
@@ -58,7 +58,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): Maximum array length must be greater than zero in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
|
||||
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): ORA-01403: %s
|
||||
ORA-06512: at "%s.ARRAY_BIND_003_PKG", line %d
|
||||
ORA-06512: at line %d in %sarray_bind_003.php on line %d
|
||||
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): ORA-01403: %s
|
||||
ORA-06512: at "%s.ARRAY_BIND_004_PKG", line %d
|
||||
ORA-06512: at line %d in %sarray_bind_004.php on line %d
|
||||
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(4) "five"
|
||||
|
||||
@@ -58,7 +58,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: -1 in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
|
||||
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): ORA-06550: line %d, column %d:
|
||||
PLS-00418: %s
|
||||
ORA-06550: %s
|
||||
|
||||
@@ -11,7 +11,7 @@ var_dump(oci_bind_array_by_name($c, ":c1", $array, 5, 5, SQLT_CHR));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): supplied resource is not a valid oci8 statement resource in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
|
||||
@@ -19,7 +19,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): ORA-01036: illegal variable name/number in %s on line %d
|
||||
array(5) {
|
||||
[0]=>
|
||||
|
||||
@@ -58,7 +58,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||
|
||||
Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
|
||||
|
||||
@@ -19,7 +19,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name(): Invalid max length value (-10) in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name() expects at most 6 parameters, 7 given in %s on line %d
|
||||
NULL
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(5)
|
||||
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(9) "05-NOV-05"
|
||||
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(9) "05-NOV-05"
|
||||
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
float(5.9999)
|
||||
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
float(5.9999)
|
||||
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(5)
|
||||
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
int(5)
|
||||
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(4) "five"
|
||||
|
||||
@@ -61,7 +61,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(4) "five"
|
||||
|
||||
@@ -26,7 +26,7 @@ $stmtarray = array(
|
||||
"insert into bind_char_tab values (2, NULL, 'abc')",
|
||||
"insert into bind_char_tab values (3, NULL, 'abc ')"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
@@ -196,7 +196,7 @@ function do_e_q($s)
|
||||
$stmtarray = array(
|
||||
"drop table bind_char_tab"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
@@ -28,7 +28,7 @@ $stmtarray = array(
|
||||
"insert into bind_char_tab values (2, NULL, 'abc')",
|
||||
"insert into bind_char_tab values (3, NULL, 'abc ')"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
@@ -198,7 +198,7 @@ function do_e_q($s)
|
||||
$stmtarray = array(
|
||||
"drop table bind_char_tab"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
@@ -25,7 +25,7 @@ $stmtarray = array(
|
||||
"create table bind_char_tab (id number, c1 date)",
|
||||
"insert into bind_char_tab values (1, '2008-04-20')",
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
@@ -85,7 +85,7 @@ function do_e_q($s)
|
||||
$stmtarray = array(
|
||||
"drop table bind_char_tab"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
@@ -25,7 +25,7 @@ $stmtarray = array(
|
||||
"create table bind_char_tab (id number, c1 date)",
|
||||
"insert into bind_char_tab values (1, '2008-04-20')",
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
@@ -85,7 +85,7 @@ function do_e_q($s)
|
||||
$stmtarray = array(
|
||||
"drop table bind_char_tab"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
@@ -22,7 +22,7 @@ require(dirname(__FILE__).'/connect.inc');
|
||||
$stmtarray = array(
|
||||
"create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
|
||||
@@ -24,7 +24,7 @@ require(dirname(__FILE__).'/connect.inc');
|
||||
$stmtarray = array(
|
||||
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
|
||||
@@ -24,7 +24,7 @@ require(dirname(__FILE__).'/connect.inc');
|
||||
$stmtarray = array(
|
||||
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
|
||||
@@ -16,7 +16,7 @@ NLS_LANG=
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
|
||||
$stmtarray = array(
|
||||
"drop sequence myseq",
|
||||
"drop table mytab",
|
||||
@@ -53,7 +53,7 @@ oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
|
||||
@@ -51,7 +51,7 @@ oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
|
||||
@@ -16,7 +16,7 @@ NLS_LANG=
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
|
||||
$stmtarray = array(
|
||||
"drop sequence myseq",
|
||||
"drop table mytab",
|
||||
@@ -55,7 +55,7 @@ oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
|
||||
@@ -16,7 +16,7 @@ NLS_LANG=
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
|
||||
$stmtarray = array(
|
||||
"drop sequence myseq",
|
||||
"drop table mytab",
|
||||
@@ -55,7 +55,7 @@ oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
|
||||
@@ -6,7 +6,7 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
|
||||
$create_st = array();
|
||||
$create_st[] = "drop sequence myseq";
|
||||
$create_st[] = "drop table mytab";
|
||||
@@ -49,7 +49,7 @@ foreach ($create_st as $statement) {
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(2)
|
||||
int(3)
|
||||
|
||||
@@ -16,7 +16,7 @@ NLS_LANG=
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
|
||||
$create_st = array();
|
||||
$create_st[] = "drop sequence myseq";
|
||||
$create_st[] = "drop table mytab";
|
||||
@@ -51,7 +51,7 @@ oci8_test_sql_execute($c, $drop_st);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
|
||||
@@ -14,7 +14,7 @@ if (!(isset($matches[0]) && $matches[1] < 12)) {
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
|
||||
$create_st = array();
|
||||
$create_st[] = "drop sequence myseq";
|
||||
$create_st[] = "drop table mytab";
|
||||
@@ -49,7 +49,7 @@ oci8_test_sql_execute($c, $drop_st);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
string(1) "1"
|
||||
string(1) "2"
|
||||
string(1) "3"
|
||||
|
||||
@@ -9,7 +9,7 @@ require(dirname(__FILE__).'/skipif.inc');
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
|
||||
// Initialize
|
||||
|
||||
$stmtarray = array(
|
||||
@@ -19,7 +19,7 @@ $stmtarray = array(
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run test
|
||||
|
||||
|
||||
$collection = oci_new_collection($c, "BUG32325_T");
|
||||
|
||||
$sql = "begin
|
||||
@@ -45,7 +45,7 @@ oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
int(4)
|
||||
float(2)
|
||||
float(3)
|
||||
|
||||
@@ -33,7 +33,7 @@ $s1 = oci_parse($c, "drop table test_nclob");
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
["NC"]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
|
||||
@@ -7,7 +7,7 @@ require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
function f($conn)
|
||||
|
||||
@@ -31,7 +31,7 @@ $clob = oci_new_descriptor($c, OCI_D_LOB);
|
||||
oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB);
|
||||
$clob->writetemporary("<MYTAG/>", OCI_TEMP_CLOB);
|
||||
$success = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS);
|
||||
oci_free_statement($stmt);
|
||||
oci_free_statement($stmt);
|
||||
$clob->close();
|
||||
|
||||
// Query back the change
|
||||
|
||||
@@ -44,7 +44,7 @@ var_dump($strings);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(1) "A"
|
||||
|
||||
@@ -24,7 +24,7 @@ var_dump($bv);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
NULL
|
||||
int(0)
|
||||
Done
|
||||
|
||||
@@ -42,7 +42,7 @@ var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(3) "one"
|
||||
|
||||
@@ -51,7 +51,7 @@ $stmtarray = array(
|
||||
"insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c15) values
|
||||
(113, 'aaaaaaa', 'bbbbbbbbbb', 'cccccc', 'e', 'f', 'dddd', '12/04/2006', '12/04/2006', 2224, 'zzzzzzz')"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
|
||||
|
||||
@@ -102,27 +102,27 @@ function dropxmltab($c) // delete table
|
||||
function fillxmltab($c)
|
||||
{
|
||||
for ($id = 1; $id <= 100; $id++) {
|
||||
|
||||
// create an XML element string with random data
|
||||
|
||||
// create an XML element string with random data
|
||||
$s = "<data>";
|
||||
for ($j = 0; $j < 128; $j++) {
|
||||
$s .= rand();
|
||||
$s .= rand();
|
||||
}
|
||||
$s .= "</data>\n";
|
||||
$s .= "</data>\n";
|
||||
for ($j = 0; $j < 4; $j++) {
|
||||
$s .= $s;
|
||||
}
|
||||
}
|
||||
$data = "<?xml version=\"1.0\"?><records>" . $s . "</records>";
|
||||
|
||||
|
||||
// insert XML data into database
|
||||
|
||||
|
||||
$stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))");
|
||||
oci_bind_by_name($stmt, ":id", $id);
|
||||
$clob = oci_new_descriptor($c, OCI_D_LOB);
|
||||
oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB);
|
||||
$clob->writetemporary($data);
|
||||
oci_execute($stmt);
|
||||
|
||||
|
||||
$clob->close();
|
||||
$clob->free();
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ $statement = oci_parse($c, "DROP TABLE BIND_TEST");
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
Test 1
|
||||
array(5) {
|
||||
[0]=>
|
||||
|
||||
@@ -9,7 +9,7 @@ require(dirname(__FILE__).'/skipif.inc');
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
|
||||
// Initialize
|
||||
|
||||
$stmtarray = array(
|
||||
@@ -23,7 +23,7 @@ $stmtarray = array(
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run test
|
||||
|
||||
|
||||
$sql = "select col1,col2,col3,col4,col5,col6,col7,col8,col9 from bug71600_tab";
|
||||
|
||||
echo "Test 1\n";
|
||||
@@ -80,7 +80,7 @@ oci8_test_sql_execute($c, $stmtarray);
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
Test 1
|
||||
Executing SELECT statament...
|
||||
Fetching data by columns...
|
||||
|
||||
@@ -10,8 +10,8 @@ require dirname(__FILE__).'/connect.inc';
|
||||
oci_close($c);
|
||||
|
||||
oci_connect($user, $password, $dbase);
|
||||
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECT--
|
||||
Done
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ $statement = OCIParse($c,$ora_sql);
|
||||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ var_dump($all);
|
||||
|
||||
|
||||
require(dirname(__FILE__).'/drop_table.inc');
|
||||
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
|
||||
@@ -64,7 +64,7 @@ var_dump($all);
|
||||
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
|
||||
@@ -62,7 +62,7 @@ foreach($values_array as $val ) {
|
||||
oci_set_module_name($c1,$val);
|
||||
oci_set_client_identifier($c1,$val);
|
||||
oci_set_client_info($c1,$val);
|
||||
$r = oci_set_action($c1,$val);
|
||||
$r = oci_set_action($c1,$val);
|
||||
if ($r) {
|
||||
echo "Values set successfully to $val\n";
|
||||
foreach($attr_array as $attr) {
|
||||
|
||||
@@ -13,7 +13,7 @@ if (!empty($dbase)) {
|
||||
else {
|
||||
var_dump(oci_connect($user, $password));
|
||||
}
|
||||
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
|
||||
@@ -13,7 +13,7 @@ if (!empty($dbase)) {
|
||||
else {
|
||||
var_dump(ocilogon($user, $password));
|
||||
}
|
||||
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
|
||||
@@ -18,7 +18,7 @@ if (!empty($dbase))
|
||||
$c1 = oci_new_connect($user,$password,$dbase);
|
||||
else
|
||||
$c1 = oci_new_connect($user,$password);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c1, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
|
||||
@@ -18,7 +18,7 @@ if (!empty($dbase))
|
||||
$c1 = oci_new_connect($user,$password,$dbase);
|
||||
else
|
||||
$c1 = oci_new_connect($user,$password);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c1, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
|
||||
@@ -20,7 +20,7 @@ if (!empty($dbase))
|
||||
$c1 = oci_new_connect($user,$password,$dbase);
|
||||
else
|
||||
$c1 = oci_new_connect($user,$password);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c1, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
|
||||
@@ -20,7 +20,7 @@ if (!empty($dbase))
|
||||
$c1 = oci_new_connect($user,$password,$dbase);
|
||||
else
|
||||
$c1 = oci_new_connect($user,$password);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c1, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
|
||||
@@ -20,7 +20,7 @@ if (!empty($dbase))
|
||||
$c1 = oci_new_connect($user,$password,$dbase);
|
||||
else
|
||||
$c1 = oci_new_connect($user,$password);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c1, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
|
||||
@@ -20,7 +20,7 @@ if (!empty($dbase))
|
||||
$c1 = oci_new_connect($user,$password,$dbase);
|
||||
else
|
||||
$c1 = oci_new_connect($user,$password);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c1, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
|
||||
@@ -20,7 +20,7 @@ if (!empty($dbase))
|
||||
$c1 = oci_new_connect($user,$password,$dbase);
|
||||
else
|
||||
$c1 = oci_new_connect($user,$password);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c1, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
|
||||
@@ -20,7 +20,7 @@ if (!empty($dbase))
|
||||
$c1 = oci_new_connect($user,$password,$dbase);
|
||||
else
|
||||
$c1 = oci_new_connect($user,$password);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c1, $stmtarray);
|
||||
|
||||
// Run Test
|
||||
|
||||
@@ -21,7 +21,7 @@ var_dump($c5 == $c6);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
resource(%d) of type (oci8 connection)
|
||||
resource(%d) of type (oci8 connection)
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ if (!empty($dbase)) {
|
||||
else {
|
||||
var_dump(oci_connect($user, $password));
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
|
||||
@@ -31,7 +31,7 @@ if (!empty($dbase)) {
|
||||
else {
|
||||
var_dump(oci_connect($user, $password));
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
|
||||
@@ -24,7 +24,7 @@ if (!empty($dbase)) {
|
||||
else {
|
||||
var_dump(ocilogon($user, $password));
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
|
||||
@@ -31,7 +31,7 @@ if (!empty($dbase)) {
|
||||
else {
|
||||
var_dump(ocilogon($user, $password));
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
|
||||
@@ -15,7 +15,7 @@ if (!empty($dbase)) {
|
||||
else {
|
||||
oci_connect($user, $password);
|
||||
}
|
||||
|
||||
|
||||
oci_internal_debug(false);
|
||||
|
||||
?>
|
||||
|
||||
@@ -44,7 +44,7 @@ $stmtarray = array(
|
||||
);
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
|
||||
@@ -44,7 +44,7 @@ $stmtarray = array(
|
||||
);
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
|
||||
@@ -44,7 +44,7 @@ $stmtarray = array(
|
||||
);
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
|
||||
@@ -45,7 +45,7 @@ $stmtarray = array(
|
||||
);
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
|
||||
@@ -14,7 +14,7 @@ $stmtarray = array(
|
||||
"drop table phptestrawtable",
|
||||
"create table phptestrawtable( id number(10), fileimage raw(1000))"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)");
|
||||
|
||||
@@ -14,7 +14,7 @@ $stmtarray = array(
|
||||
"drop table phpdefblobtable",
|
||||
"create table phpdefblobtable (id number(10), fileimage blob)"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Load data
|
||||
@@ -78,7 +78,7 @@ while (oci_fetch($stmt)) {
|
||||
$stmtarray = array(
|
||||
"drop table phpdefblobtable"
|
||||
);
|
||||
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
@@ -41,7 +41,7 @@ require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
["BLOB"]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
|
||||
@@ -92,7 +92,7 @@ foreach ($values_array as $val ) {
|
||||
if ($c1) {
|
||||
get_edit_attr($c1);
|
||||
oci_close($c1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n\n**Test 1.5 - Negative case with an invalid string value. *********\n";
|
||||
|
||||
@@ -15,7 +15,7 @@ var_dump(oci_fetch_array($stmt));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): ORA-00942: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
|
||||
@@ -14,6 +14,6 @@ oci_execute($stmt, -1);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECTF--
|
||||
Warning: oci_execute(): Invalid execute mode given: -1 in %s on line %d
|
||||
Done
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user