diff options
| author | Christopher Jones <sixd@php.net> | 2008-04-18 00:05:27 +0000 |
|---|---|---|
| committer | Christopher Jones <sixd@php.net> | 2008-04-18 00:05:27 +0000 |
| commit | 08eaa56798fba86a72a34e0919d2ce3511c544cb (patch) | |
| tree | 6ed613484bad6429997406bea1d85a79eb00df73 /ext/oci8/oci8_interface.c | |
| parent | de34e8700029fc2d380c485e98401829da9b4d6c (diff) | |
| download | php-git-08eaa56798fba86a72a34e0919d2ce3511c544cb.tar.gz | |
MFH
Code:
- Do scope-end release for oci_pconnect (oci8.old_oci_close_semantics=1 gives old behavior)
- Fix session reuse with 10.2 client libs
- Fix the Ping macro version check for 10.2
- Add type check associated with zend_list_find
- Code connection re-organized for reuse
- Format comments
- WS changes
- Prepare for new PECL release
Tests:
- Add new tests
- Rationalize password tests
- Revert use of __DIR__ so tests will work with PHP 5.2
- Update some skipifs to make tests more portable
Diffstat (limited to 'ext/oci8/oci8_interface.c')
| -rw-r--r-- | ext/oci8/oci8_interface.c | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 22de0f3a10..dd3a8e30bd 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -442,8 +442,7 @@ PHP_FUNCTION(oci_lob_seek) } PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - - + if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { RETURN_FALSE; } @@ -453,9 +452,9 @@ PHP_FUNCTION(oci_lob_seek) descriptor->lob_current_position += offset; break; case PHP_OCI_SEEK_END: - if (descriptor->lob_size + offset >= 0) { + if ((descriptor->lob_size + offset) >= 0) { descriptor->lob_current_position = descriptor->lob_size + offset; - } + } else { descriptor->lob_current_position = 0; } @@ -464,8 +463,7 @@ PHP_FUNCTION(oci_lob_seek) default: descriptor->lob_current_position = (offset > 0) ? offset : 0; break; - } - + } RETURN_TRUE; } /* }}} */ @@ -505,7 +503,7 @@ PHP_FUNCTION(oci_lob_write) zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; int data_len; - long write_len = 0; + long write_len = 0; ub4 bytes_written; char *data; @@ -861,7 +859,8 @@ PHP_FUNCTION(oci_lob_export) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - char *filename, *buffer; + char *filename; + char *buffer; int filename_len; long start = -1, length = -1, block_length; php_stream *stream; @@ -1026,7 +1025,7 @@ PHP_FUNCTION(oci_lob_close) RETURN_TRUE; } /* }}} */ -#endif +#endif /* {{{ proto object oci_new_descriptor(resource connection [, int type]) Initialize a new empty descriptor LOB/FILE (LOB is default) */ @@ -1249,7 +1248,7 @@ PHP_FUNCTION(oci_field_type_raw) { php_oci_out_column *column; - column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); + column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); if (column) { RETURN_LONG(column->data_type); } @@ -1455,7 +1454,7 @@ PHP_FUNCTION(oci_fetch_all) efree(columns); efree(outarrs); - } + } RETURN_LONG(rows); } @@ -1519,17 +1518,15 @@ PHP_FUNCTION(oci_free_statement) Disconnect from database */ PHP_FUNCTION(oci_close) { - /* oci_close for pconnect (if old_oci_close_semantics not set) would - * release the connection back to the client-side session pool (and to the + /* oci_close for pconnect (if old_oci_close_semantics not set) would + * release the connection back to the client-side session pool (and to the * server-side pool if Database Resident Connection Pool is being used). * Subsequent pconnects in the same script are not guaranteed to get the - * same database session. When a persistent connection goes out-of-scope, - * the connection is not released to the session pool and is kept in the Plist + * same database session. */ zval *z_connection; php_oci_connection *connection; - int dummy_type = -1; if (OCI_G(old_oci_close_semantics)) { /* do nothing to keep BC */ @@ -1543,16 +1540,6 @@ PHP_FUNCTION(oci_close) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); zend_list_delete(connection->rsrc_id); - /* If refcount has fallen to zero(resource id removed from the list), - * Release the OCI session associated with this connection structure back - * to the underlying pool. The connection would be cached in the plist as a - * stub - */ - if(connection->is_persistent && connection->using_spool && !zend_list_find(connection->rsrc_id, &dummy_type)) { - - php_oci_connection_release(connection TSRMLS_CC); - } - ZVAL_NULL(z_connection); RETURN_TRUE; @@ -1728,7 +1715,7 @@ PHP_FUNCTION(oci_password_change) int user_len, pass_old_len, pass_new_len, dbname_len; php_oci_connection *connection; - /* Disable in Safe Mode */ + /* Disable in Safe Mode */ if (PG(safe_mode)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "is disabled in Safe Mode"); RETURN_FALSE; @@ -2188,7 +2175,7 @@ PHP_FUNCTION(oci_new_collection) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "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, tdo_len, schema, schema_len TSRMLS_CC)) ) { |
