OCI_G(env) = NULL;
OCI_G(err) = NULL;
- }
- else {
+ } else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SUCCESS_WITH_INFO: %s", tmp_buf);
}
}
if (le->type == le_pconnection) {
connection = (php_oci_connection *)le->ptr;
}
- }
- else if (!persistent && zend_hash_find(&EG(regular_list), hashed_details.c, hashed_details.len+1, (void **) &le) == SUCCESS) {
+ } else if (!persistent && zend_hash_find(&EG(regular_list), hashed_details.c, hashed_details.len+1, (void **) &le) == SUCCESS) {
found = 1;
if (le->type == le_index_ptr) {
int type, link;
* */
if ( (connection->next_ping > 0) && (timestamp >= connection->next_ping) && !php_oci_connection_ping(connection TSRMLS_CC)) {
/* server died */
- }
- else {
+ } else {
int rsrc_type;
/* okay, the connection is open and the server is still alive */
zend_hash_del(&EG(persistent_list), hashed_details.c, hashed_details.len+1);
connection = NULL;
goto open;
- }
- else {
+ } else {
/* we do not ping non-persistent connections */
smart_str_free_ex(&hashed_details, 0);
zend_list_addref(connection->rsrc_id);
/* found something, but it's not a connection, delete it */
if (persistent) {
zend_hash_del(&EG(persistent_list), hashed_details.c, hashed_details.len+1);
- }
- else {
+ } else {
zend_hash_del(&EG(regular_list), hashed_details.c, hashed_details.len+1);
}
}
connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection));
connection->hash_key = estrndup(hashed_details.c, hashed_details.len+1);
connection->is_persistent = 0;
- }
- else {
+ } else {
connection = (php_oci_connection *) calloc(1, sizeof(php_oci_connection));
connection->hash_key = zend_strndup(hashed_details.c, hashed_details.len);
connection->is_persistent = 1;
}
- }
- else {
+ } else {
connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection));
connection->hash_key = estrndup(hashed_details.c, hashed_details.len+1);
connection->is_persistent = 0;
connection->idle_expiry = (OCI_G(persistent_timeout) > 0) ? (timestamp + OCI_G(persistent_timeout)) : 0;
if (OCI_G(ping_interval) >= 0) {
connection->next_ping = timestamp + OCI_G(ping_interval);
- }
- else {
+ } else {
/* -1 means "Off" */
connection->next_ping = 0;
}
connection->rsrc_id = zend_list_insert(connection, le_pconnection);
zend_hash_update(&EG(persistent_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
OCI_G(num_persistent)++;
- }
- else if (!exclusive) {
+ } else if (!exclusive) {
connection->rsrc_id = zend_list_insert(connection, le_connection);
new_le.ptr = (void *)connection->rsrc_id;
new_le.type = le_index_ptr;
zend_hash_update(&EG(regular_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
OCI_G(num_links)++;
- }
- else {
+ } else {
connection->rsrc_id = zend_list_insert(connection, le_connection);
OCI_G(num_links)++;
}
free(connection->hash_key);
}
free(connection);
- }
- else {
+ } else {
if (connection->hash_key) {
efree(connection->hash_key);
}
if (column->is_cursor) { /* REFCURSOR -> simply return the statement id */
ZVAL_RESOURCE(value, column->stmtid);
zend_list_addref(column->stmtid);
- }
- else if (column->is_descr) {
+ } else if (column->is_descr) {
if (column->data_type != SQLT_RDD) {
int rsrc_type;
} else {
if (lob_length > 0) {
ZVAL_STRINGL(value, lob_buffer, lob_length, 0);
- }
- else {
+ } else {
ZVAL_EMPTY_STRING(value);
}
return 0;
add_property_resource(value, "descriptor", column->descid);
zend_list_addref(column->descid);
}
- }
- else {
+ } else {
switch (column->retcode) {
case 0:
/* intact value */
if (ZEND_NUM_ARGS() == 2) {
fetch_mode = mode;
}
- }
- else if (expected_args == 2) {
+ } else if (expected_args == 2) {
/* only for oci_fetch_array() */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_statement, &fetch_mode) == FAILURE) {
if (ZEND_NUM_ARGS() == 1) {
fetch_mode = mode;
}
- }
- else {
+ } else {
/* for all oci_fetch_*() */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_statement) == FAILURE) {
if (OCI_G(ping_interval) >= 0) {
connection->next_ping = timestamp + OCI_G(ping_interval);
- }
- else {
+ } else {
/* ping_interval is -1 */
connection->next_ping = 0;
}
connection->used_this_request = 0;
- }
- else if (OCI_G(persistent_timeout) != -1) {
+ } else if (OCI_G(persistent_timeout) != -1) {
if (connection->idle_expiry < timestamp) {
/* connection has timed out */
return 1;
collection->collection = NULL;
/* get type handle by name */
- connection->errcode = PHP_OCI_CALL(OCITypeByName, (connection->env, connection->err, connection->svc, (text *) schema, (ub4) schema_len, (text *) tdo, (ub4) tdo_len, (CONST text *) 0, (ub4) 0, OCI_DURATION_SESSION, OCI_TYPEGET_ALL, &(collection->tdo)));
+ connection->errcode = PHP_OCI_CALL(OCITypeByName,
+ (
+ connection->env,
+ connection->err,
+ connection->svc,
+ (text *) schema,
+ (ub4) schema_len,
+ (text *) tdo,
+ (ub4) tdo_len,
+ (CONST text *) 0,
+ (ub4) 0,
+ OCI_DURATION_SESSION,
+ OCI_TYPEGET_ALL,
+ &(collection->tdo)
+ )
+ );
if (connection->errcode) {
goto CLEANUP;
}
/* describe TDO */
- connection->errcode = PHP_OCI_CALL(OCIDescribeAny, (connection->svc, connection->err, (dvoid *) collection->tdo, (ub4) 0, OCI_OTYPE_PTR, (ub1) OCI_DEFAULT, (ub1) OCI_PTYPE_TYPE, dschp1));
+ connection->errcode = PHP_OCI_CALL(OCIDescribeAny,
+ (
+ connection->svc,
+ connection->err,
+ (dvoid *) collection->tdo,
+ (ub4) 0,
+ OCI_OTYPE_PTR,
+ (ub1) OCI_DEFAULT,
+ (ub1) OCI_PTYPE_TYPE,
+ dschp1
+ )
+ );
if (connection->errcode) {
goto CLEANUP;
}
/* get the collection type code of the attribute */
- connection->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid*) parmp1, (ub4) OCI_DTYPE_PARAM, (dvoid*) &(collection->coll_typecode), (ub4 *) 0, (ub4) OCI_ATTR_COLLECTION_TYPECODE, connection->err));
+ connection->errcode = PHP_OCI_CALL(OCIAttrGet,
+ (
+ (dvoid*) parmp1,
+ (ub4) OCI_DTYPE_PARAM,
+ (dvoid*) &(collection->coll_typecode),
+ (ub4 *) 0,
+ (ub4) OCI_ATTR_COLLECTION_TYPECODE,
+ connection->err
+ )
+ );
if (connection->errcode) {
goto CLEANUP;
case OCI_TYPECODE_TABLE:
case OCI_TYPECODE_VARRAY:
/* get collection element handle */
- connection->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid*) parmp1, (ub4) OCI_DTYPE_PARAM, (dvoid*) &parmp2, (ub4 *) 0, (ub4) OCI_ATTR_COLLECTION_ELEMENT, connection->err));
+ connection->errcode = PHP_OCI_CALL(OCIAttrGet,
+ (
+ (dvoid*) parmp1,
+ (ub4) OCI_DTYPE_PARAM,
+ (dvoid*) &parmp2,
+ (ub4 *) 0,
+ (ub4) OCI_ATTR_COLLECTION_ELEMENT,
+ connection->err
+ )
+ );
if (connection->errcode) {
goto CLEANUP;
}
/* get REF of the TDO for the type */
- connection->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid*) parmp2, (ub4) OCI_DTYPE_PARAM, (dvoid*) &(collection->elem_ref), (ub4 *) 0, (ub4) OCI_ATTR_REF_TDO, connection->err));
+ connection->errcode = PHP_OCI_CALL(OCIAttrGet,
+ (
+ (dvoid*) parmp2,
+ (ub4) OCI_DTYPE_PARAM,
+ (dvoid*) &(collection->elem_ref),
+ (ub4 *) 0,
+ (ub4) OCI_ATTR_REF_TDO,
+ connection->err
+ )
+ );
if (connection->errcode) {
goto CLEANUP;
}
/* get the TDO (only header) */
- connection->errcode = PHP_OCI_CALL(OCITypeByRef, (connection->env, connection->err, collection->elem_ref, OCI_DURATION_SESSION, OCI_TYPEGET_HEADER, &(collection->element_type)));
+ connection->errcode = PHP_OCI_CALL(OCITypeByRef,
+ (
+ connection->env,
+ connection->err,
+ collection->elem_ref,
+ OCI_DURATION_SESSION,
+ OCI_TYPEGET_HEADER,
+ &(collection->element_type)
+ )
+ );
if (connection->errcode) {
goto CLEANUP;
}
/* get typecode */
- connection->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid*) parmp2, (ub4) OCI_DTYPE_PARAM, (dvoid*) &(collection->element_typecode), (ub4 *) 0, (ub4) OCI_ATTR_TYPECODE, connection->err));
+ connection->errcode = PHP_OCI_CALL(OCIAttrGet,
+ (
+ (dvoid*) parmp2,
+ (ub4) OCI_DTYPE_PARAM,
+ (dvoid*) &(collection->element_typecode),
+ (ub4 *) 0,
+ (ub4) OCI_ATTR_TYPECODE,
+ connection->err
+ )
+ );
if (connection->errcode) {
goto CLEANUP;
return 1;
}
- connection->errcode = PHP_OCI_CALL(OCICollAppend, (connection->env, connection->err, (dvoid *) &oci_date, (dvoid *) &new_index, (OCIColl *) collection->collection));
+ connection->errcode = PHP_OCI_CALL(OCICollAppend,
+ (
+ connection->env,
+ connection->err,
+ (dvoid *) &oci_date,
+ (dvoid *) &new_index,
+ (OCIColl *) collection->collection
+ )
+ );
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
return 1;
}
- connection->errcode = PHP_OCI_CALL(OCICollAppend, (connection->env, connection->err, (dvoid *) &oci_number, (dvoid *) &new_index, (OCIColl *) collection->collection));
+ connection->errcode = PHP_OCI_CALL(OCICollAppend,
+ (
+ connection->env,
+ connection->err,
+ (dvoid *) &oci_number,
+ (dvoid *) &new_index,
+ (OCIColl *) collection->collection
+ )
+ );
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
return 1;
}
- connection->errcode = PHP_OCI_CALL(OCICollAppend, (connection->env, connection->err, (dvoid *) ocistr, (dvoid *) &new_index, (OCIColl *) collection->collection));
+ connection->errcode = PHP_OCI_CALL(OCICollAppend,
+ (
+ connection->env,
+ connection->err,
+ (dvoid *) ocistr,
+ (dvoid *) &new_index,
+ (OCIColl *) collection->collection
+ )
+ );
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
MAKE_STD_ZVAL(*result_element);
ZVAL_NULL(*result_element);
- connection->errcode = PHP_OCI_CALL(OCICollGetElem, (connection->env, connection->err, collection->collection, (ub4)index, &exists, &element, (dvoid **)&element_index));
+ connection->errcode = PHP_OCI_CALL(OCICollGetElem,
+ (
+ connection->env,
+ connection->err,
+ collection->collection,
+ (ub4)index,
+ &exists,
+ &element,
+ (dvoid **)&element_index
+ )
+ );
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
return 1;
}
- connection->errcode = PHP_OCI_CALL(OCICollAssignElem, (connection->env, connection->err, (ub4)index, (dvoid *) &oci_date, (dvoid *) &new_index, (OCIColl *) collection->collection));
+ connection->errcode = PHP_OCI_CALL(OCICollAssignElem,
+ (
+ connection->env,
+ connection->err,
+ (ub4)index,
+ (dvoid *) &oci_date,
+ (dvoid *) &new_index,
+ (OCIColl *) collection->collection
+ )
+ );
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
return 1;
}
- connection->errcode = PHP_OCI_CALL(OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *) &oci_number, (dvoid *) &new_index, (OCIColl *) collection->collection));
+ connection->errcode = PHP_OCI_CALL(OCICollAssignElem,
+ (
+ connection->env,
+ connection->err,
+ (ub4) index,
+ (dvoid *) &oci_number,
+ (dvoid *) &new_index,
+ (OCIColl *) collection->collection
+ )
+ );
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
return 1;
}
- connection->errcode = PHP_OCI_CALL(OCICollAssignElem, (connection->env, connection->err, (ub4)index, (dvoid *) ocistr, (dvoid *) &new_index, (OCIColl *) collection->collection));
+ connection->errcode = PHP_OCI_CALL(OCICollAssignElem,
+ (
+ connection->env,
+ connection->err,
+ (ub4)index,
+ (dvoid *) ocistr,
+ (dvoid *) &new_index,
+ (OCIColl *) collection->collection
+ )
+ );
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
if (on_off) {
connection->errcode = PHP_OCI_CALL(OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor));
- }
- else {
+ } else {
connection->errcode = PHP_OCI_CALL(OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor));
}
{
if (descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) {
return 1;
- }
- else {
+ } else {
return 0;
}
} /* }}} */
if (length == -1) {
copy_len = length_from - descriptor_from->lob_current_position;
- }
- else {
+ } else {
copy_len = length;
}
return 1;
}
- connection->errcode = PHP_OCI_CALL(OCILobCopy, (connection->svc, connection->err, descriptor_dest->descriptor, descriptor_from->descriptor, copy_len, descriptor_dest->lob_current_position+1, descriptor_from->lob_current_position+1));
+ connection->errcode = PHP_OCI_CALL(OCILobCopy,
+ (
+ connection->svc,
+ connection->err,
+ descriptor_dest->descriptor,
+ descriptor_from->descriptor,
+ copy_len,
+ descriptor_dest->lob_current_position+1,
+ descriptor_from->lob_current_position+1
+ )
+ );
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
return 1;
}
- connection->errcode = PHP_OCI_CALL(OCILobCreateTemporary, (connection->svc, connection->err, lob, OCI_DEFAULT, OCI_DEFAULT, type, OCI_ATTR_NOCACHE, OCI_DURATION_SESSION));
+ connection->errcode = PHP_OCI_CALL(OCILobCreateTemporary,
+ (
+ connection->svc,
+ connection->err,
+ lob,
+ OCI_DEFAULT,
+ OCI_DEFAULT,
+ type,
+ OCI_ATTR_NOCACHE,
+ OCI_DURATION_SESSION
+ )
+ );
if (connection->errcode) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
if (query_len > 0) {
#if HAVE_OCI_STMT_PREPARE2
- connection->errcode = PHP_OCI_CALL(OCIStmtPrepare2, (connection->svc, &(statement->stmt), connection->err, (text *)query, query_len, NULL, 0, OCI_NTV_SYNTAX, OCI_DEFAULT));
+ connection->errcode = PHP_OCI_CALL(OCIStmtPrepare2,
+ (
+ connection->svc,
+ &(statement->stmt),
+ connection->err,
+ (text *)query,
+ query_len,
+ NULL,
+ 0,
+ OCI_NTV_SYNTAX,
+ OCI_DEFAULT
+ )
+ );
#else
connection->errcode = PHP_OCI_CALL(OCIStmtPrepare, (statement->stmt, connection->err, (text *)query, query_len, OCI_NTV_SYNTAX, OCI_DEFAULT));
#endif
column->cb_retlen = PHP_OCI_PIECE_SIZE;
- PHP_OCI_CALL( OCIStmtSetPieceInfo, ((void *) column->oci_define, OCI_HTYPE_DEFINE, statement->err, ((char*)column->data) + column->retlen4, &(column->cb_retlen), OCI_NEXT_PIECE, &column->indicator, &column->retcode));
+ PHP_OCI_CALL(OCIStmtSetPieceInfo,
+ (
+ (void *) column->oci_define,
+ OCI_HTYPE_DEFINE,
+ statement->err,
+ ((char*)column->data) + column->retlen4,
+ &(column->cb_retlen),
+ OCI_NEXT_PIECE,
+ &column->indicator,
+ &column->retcode
+ )
+ );
}
}
#if HAVE_OCI_STMT_PREPARE2
if (statement->last_query_len) { /* FIXME: magical */
PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_STRLS_CACHE_DELETE));
- }
- else {
+ } else {
PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT));
}
#else
} else if (Z_TYPE_P(bind->zval) == IS_STRING && Z_STRLEN_P(bind->zval) > 0) {
Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRLEN_P(bind->zval)+1);
Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] = '\0';
- }
- else if (Z_TYPE_P(bind->zval) == IS_ARRAY) {
+ } else if (Z_TYPE_P(bind->zval) == IS_ARRAY) {
int i;
zval **entry;
HashTable *hash = HASH_OF(bind->zval);
zval_dtor(*entry);
ZVAL_LONG(*entry, ((ub4 *)(bind->array.elements))[i]);
zend_hash_move_forward(hash);
- }
- else {
+ } else {
add_next_index_long(bind->zval, ((ub4 *)(bind->array.elements))[i]);
}
}
zval_dtor(*entry);
ZVAL_DOUBLE(*entry, ((double *)(bind->array.elements))[i]);
zend_hash_move_forward(hash);
- }
- else {
+ } else {
add_next_index_double(bind->zval, ((double *)(bind->array.elements))[i]);
}
}
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
ZVAL_NULL(*entry);
- }
- else {
+ } else {
ZVAL_STRINGL(*entry, buff, buff_len, 1);
}
zend_hash_move_forward(hash);
- }
- else {
+ } else {
connection->errcode = PHP_OCI_CALL(OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
add_next_index_null(bind->zval);
- }
- else {
+ } else {
add_next_index_stringl(bind->zval, buff, buff_len, 1);
}
}
zval_dtor(*entry);
ZVAL_STRINGL(*entry, ((text *)bind->array.elements)+i*bind->array.max_length, curr_element_length, 1);
zend_hash_move_forward(hash);
- }
- else {
+ } else {
add_next_index_stringl(bind->zval, ((text *)bind->array.elements)+i*bind->array.max_length, curr_element_length, 1);
}
}
}
if (maxlength == -1) {
value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRLEN_P(var) : 0;
- }
- else {
+ } else {
value_sz = maxlength;
}
break;
}
if (mode == OCI_DATA_AT_EXEC) {
- statement->errcode = PHP_OCI_CALL(OCIBindDynamic, (bindp->bind, statement->err, (dvoid *)bindp, php_oci_bind_in_callback, (dvoid *)bindp, php_oci_bind_out_callback));
+ statement->errcode = PHP_OCI_CALL(OCIBindDynamic,
+ (
+ bindp->bind,
+ statement->err,
+ (dvoid *)bindp,
+ php_oci_bind_in_callback,
+ (dvoid *)bindp,
+ php_oci_bind_out_callback
+ )
+ );
if (statement->errcode != OCI_SUCCESS) {
php_oci_error(statement->err, statement->errcode TSRMLS_CC);
#ifdef PHP_OCI8_HAVE_COLLECTIONS
if (type == SQLT_NTY) {
/* Bind object */
- statement->errcode = PHP_OCI_CALL(OCIBindObject, (bindp->bind, statement->err, bind_collection->tdo, (dvoid **) &(bind_collection->collection), (ub4 *) 0, (dvoid **) 0, (ub4 *) 0));
+ statement->errcode = PHP_OCI_CALL(OCIBindObject,
+ (
+ bindp->bind,
+ statement->err,
+ bind_collection->tdo,
+ (dvoid **) &(bind_collection->collection),
+ (ub4 *) 0,
+ (dvoid **) 0,
+ (ub4 *) 0
+ )
+ );
if (statement->errcode) {
php_oci_error(statement->err, statement->errcode TSRMLS_CC);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%s\"", Z_STRVAL_P(column_index));
return NULL;
}
- }
- else {
+ } else {
convert_to_long(column_index);
column = php_oci_statement_get_column(statement, Z_LVAL_P(column_index), NULL, 0 TSRMLS_CC);
if (!column) {
((text *)bind->array.elements)[i*maxlength + element_length] = '\0';
zend_hash_move_forward(hash);
- }
- else {
+ } else {
((text *)bind->array.elements)[i*maxlength] = '\0';
}
}
convert_to_long_ex(entry);
((ub4 *)bind->array.elements)[i] = (ub4) Z_LVAL_PP(entry);
zend_hash_move_forward(hash);
- }
- else {
+ } else {
((ub4 *)bind->array.elements)[i] = 0;
}
}
convert_to_double_ex(entry);
((double *)bind->array.elements)[i] = (double) Z_DVAL_PP(entry);
zend_hash_move_forward(hash);
- }
- else {
+ } else {
((double *)bind->array.elements)[i] = 0;
}
}
((OCIDate *)bind->array.elements)[i] = oci_date;
zend_hash_move_forward(hash);
- }
- else {
+ } else {
connection->errcode = PHP_OCI_CALL(OCIDateFromText, (connection->err, "01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date));
if (connection->errcode != OCI_SUCCESS) {