summaryrefslogtreecommitdiff
path: root/ext/oci8/oci8_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/oci8/oci8_interface.c')
-rw-r--r--ext/oci8/oci8_interface.c407
1 files changed, 201 insertions, 206 deletions
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 198493b946..a76b740a3b 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -51,8 +51,8 @@ PHP_FUNCTION(oci_define_by_name)
{
zval *stmt, *var;
char *name;
- int name_len;
- long type = 0;
+ size_t name_len;
+ zend_long type = 0;
php_oci_statement *statement;
php_oci_define *define, *tmp_define;
@@ -74,7 +74,8 @@ PHP_FUNCTION(oci_define_by_name)
define = ecalloc(1,sizeof(php_oci_define));
- if (zend_hash_add(statement->defines, name, name_len, define, sizeof(php_oci_define), (void **)&tmp_define) == SUCCESS) {
+ //if (zend_hash_add(statement->defines, name, name_len, define, sizeof(php_oci_define), (void **)&tmp_define) == SUCCESS) {
+ if ((tmp_define = zend_hash_add_new_ptr(statement->defines, zend_string_init(name, name_len, 0), define)) != NULL) {
efree(define);
define = tmp_define;
} else {
@@ -85,8 +86,8 @@ PHP_FUNCTION(oci_define_by_name)
define->name = (text*) estrndup(name, name_len);
define->name_len = name_len;
define->type = type;
- define->zval = var;
- zval_add_ref(&var);
+ memmove(&define->zval, var, sizeof(zval));
+ Z_ADDREF_P(var);
RETURN_TRUE;
}
@@ -98,8 +99,8 @@ PHP_FUNCTION(oci_define_by_name)
PHP_FUNCTION(oci_bind_by_name)
{
ub2 bind_type = SQLT_CHR; /* unterminated string */
- int name_len;
- long maxlen = -1, type = 0;
+ size_t name_len;
+ zend_long maxlen = -1, type = 0;
char *name;
zval *z_statement;
zval *bind_var = NULL;
@@ -126,10 +127,10 @@ PHP_FUNCTION(oci_bind_by_name)
Bind a PHP array to an Oracle PL/SQL type by name */
PHP_FUNCTION(oci_bind_array_by_name)
{
- int name_len;
- long max_item_len = -1;
- long max_array_len = 0;
- long type = SQLT_AFC;
+ size_t name_len;
+ zend_long max_item_len = -1;
+ zend_long max_array_len = 0;
+ zend_long type = SQLT_AFC;
char *name;
zval *z_statement;
zval *bind_var = NULL;
@@ -161,7 +162,7 @@ PHP_FUNCTION(oci_bind_array_by_name)
Deletes large object description */
PHP_FUNCTION(oci_free_descriptor)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
if (!getThis()) {
@@ -170,12 +171,12 @@ PHP_FUNCTION(oci_free_descriptor)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
zend_list_delete(descriptor->id);
RETURN_TRUE;
@@ -186,11 +187,11 @@ PHP_FUNCTION(oci_free_descriptor)
Saves a large object */
PHP_FUNCTION(oci_lob_save)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
char *data;
- int data_len;
- long offset = 0;
+ size_t data_len;
+ zend_long offset = 0;
ub4 bytes_written;
if (getThis()) {
@@ -204,12 +205,12 @@ PHP_FUNCTION(oci_lob_save)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (offset < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset parameter must be greater than or equal to 0");
@@ -227,10 +228,10 @@ PHP_FUNCTION(oci_lob_save)
Loads file into a LOB */
PHP_FUNCTION(oci_lob_import)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
char *filename;
- int filename_len;
+ size_t filename_len;
if (getThis()) {
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
@@ -259,12 +260,12 @@ PHP_FUNCTION(oci_lob_import)
}
#endif
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_import(descriptor, filename TSRMLS_CC)) {
RETURN_FALSE;
@@ -277,7 +278,7 @@ PHP_FUNCTION(oci_lob_import)
Loads a large object */
PHP_FUNCTION(oci_lob_load)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
char *buffer = NULL;
ub4 buffer_len;
@@ -288,18 +289,18 @@ PHP_FUNCTION(oci_lob_load)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_read(descriptor, -1, 0, &buffer, &buffer_len TSRMLS_CC)) {
RETURN_FALSE;
}
if (buffer_len > 0) {
- RETURN_STRINGL(buffer, buffer_len, 0);
+ RETURN_STRINGL(buffer, buffer_len);
}
else {
RETURN_EMPTY_STRING();
@@ -311,9 +312,9 @@ PHP_FUNCTION(oci_lob_load)
Reads particular part of a large object */
PHP_FUNCTION(oci_lob_read)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- long length;
+ zend_long length;
char *buffer;
ub4 buffer_len;
@@ -328,12 +329,12 @@ PHP_FUNCTION(oci_lob_read)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (length <= 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0");
@@ -344,7 +345,7 @@ PHP_FUNCTION(oci_lob_read)
RETURN_FALSE;
}
if (buffer_len > 0) {
- RETURN_STRINGL(buffer, buffer_len, 0);
+ RETURN_STRINGL(buffer, buffer_len);
}
else {
RETURN_EMPTY_STRING();
@@ -356,7 +357,7 @@ PHP_FUNCTION(oci_lob_read)
Checks if EOF is reached */
PHP_FUNCTION(oci_lob_eof)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
ub4 lob_length;
@@ -366,12 +367,12 @@ PHP_FUNCTION(oci_lob_eof)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (!php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC) && lob_length >= 0) {
if (lob_length == descriptor->lob_current_position) {
@@ -386,7 +387,7 @@ PHP_FUNCTION(oci_lob_eof)
Tells LOB pointer position */
PHP_FUNCTION(oci_lob_tell)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
if (!getThis()) {
@@ -395,12 +396,12 @@ PHP_FUNCTION(oci_lob_tell)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
RETURN_LONG(descriptor->lob_current_position);
}
@@ -410,7 +411,7 @@ PHP_FUNCTION(oci_lob_tell)
Rewind pointer of a LOB */
PHP_FUNCTION(oci_lob_rewind)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
if (!getThis()) {
@@ -419,12 +420,12 @@ PHP_FUNCTION(oci_lob_rewind)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
descriptor->lob_current_position = 0;
@@ -436,9 +437,9 @@ PHP_FUNCTION(oci_lob_rewind)
Moves the pointer of a LOB */
PHP_FUNCTION(oci_lob_seek)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- long offset, whence = PHP_OCI_SEEK_SET;
+ zend_long offset, whence = PHP_OCI_SEEK_SET;
ub4 lob_length;
if (getThis()) {
@@ -452,12 +453,12 @@ PHP_FUNCTION(oci_lob_seek)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
RETURN_FALSE;
@@ -488,7 +489,7 @@ PHP_FUNCTION(oci_lob_seek)
Returns size of a large object */
PHP_FUNCTION(oci_lob_size)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
ub4 lob_length;
@@ -498,12 +499,12 @@ PHP_FUNCTION(oci_lob_size)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
RETURN_FALSE;
@@ -516,10 +517,10 @@ PHP_FUNCTION(oci_lob_size)
Writes data to current position of a LOB */
PHP_FUNCTION(oci_lob_write)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- int data_len;
- long write_len = 0;
+ size_t data_len;
+ zend_long write_len = 0;
ub4 bytes_written;
char *data;
@@ -542,12 +543,12 @@ PHP_FUNCTION(oci_lob_write)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (data_len <= 0) {
RETURN_LONG(0);
@@ -564,7 +565,7 @@ PHP_FUNCTION(oci_lob_write)
Appends data from a LOB to another LOB */
PHP_FUNCTION(oci_lob_append)
{
- zval **tmp_dest, **tmp_from, *z_descriptor_dest = getThis(), *z_descriptor_from;
+ zval *tmp_dest, *tmp_from, *z_descriptor_dest = getThis(), *z_descriptor_from;
php_oci_descriptor *descriptor_dest, *descriptor_from;
if (getThis()) {
@@ -578,18 +579,18 @@ PHP_FUNCTION(oci_lob_append)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor"), (void **)&tmp_dest) == FAILURE) {
+ if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
RETURN_FALSE;
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor"), (void **)&tmp_from) == FAILURE) {
+ if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, 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);
+ 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 TSRMLS_CC)) {
RETURN_FALSE;
@@ -603,9 +604,9 @@ PHP_FUNCTION(oci_lob_append)
Truncates a LOB */
PHP_FUNCTION(oci_lob_truncate)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- long trim_length = 0;
+ zend_long trim_length = 0;
ub4 ub_trim_length;
if (getThis()) {
@@ -619,7 +620,7 @@ PHP_FUNCTION(oci_lob_truncate)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
@@ -630,7 +631,7 @@ PHP_FUNCTION(oci_lob_truncate)
}
ub_trim_length = (ub4) trim_length;
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_truncate(descriptor, ub_trim_length TSRMLS_CC)) {
RETURN_FALSE;
@@ -643,10 +644,10 @@ PHP_FUNCTION(oci_lob_truncate)
Erases a specified portion of the internal LOB, starting at a specified offset */
PHP_FUNCTION(oci_lob_erase)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
ub4 bytes_erased;
- long offset = -1, length = -1;
+ zend_long offset = -1, length = -1;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &offset, &length) == FAILURE) {
@@ -679,12 +680,12 @@ PHP_FUNCTION(oci_lob_erase)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_erase(descriptor, offset, length, &bytes_erased TSRMLS_CC)) {
RETURN_FALSE;
@@ -697,9 +698,9 @@ PHP_FUNCTION(oci_lob_erase)
Flushes the LOB buffer */
PHP_FUNCTION(oci_lob_flush)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- long flush_flag = 0;
+ zend_long flush_flag = 0;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flush_flag) == FAILURE) {
@@ -712,12 +713,12 @@ PHP_FUNCTION(oci_lob_flush)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (descriptor->buffering == PHP_OCI_LOB_BUFFER_DISABLED) {
/* buffering wasn't enabled, there is nothing to flush */
@@ -735,7 +736,7 @@ PHP_FUNCTION(oci_lob_flush)
Enables/disables buffering for a LOB */
PHP_FUNCTION(ocisetbufferinglob)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
zend_bool flag;
@@ -750,12 +751,12 @@ PHP_FUNCTION(ocisetbufferinglob)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_set_buffering(descriptor, flag TSRMLS_CC)) {
RETURN_FALSE;
@@ -768,7 +769,7 @@ PHP_FUNCTION(ocisetbufferinglob)
Returns current state of buffering for a LOB */
PHP_FUNCTION(ocigetbufferinglob)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
if (!getThis()) {
@@ -777,12 +778,12 @@ PHP_FUNCTION(ocigetbufferinglob)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) {
RETURN_TRUE;
@@ -795,26 +796,26 @@ PHP_FUNCTION(ocigetbufferinglob)
Copies data from a LOB to another LOB */
PHP_FUNCTION(oci_lob_copy)
{
- zval **tmp_dest, **tmp_from, *z_descriptor_dest, *z_descriptor_from;
+ zval *tmp_dest, *tmp_from, *z_descriptor_dest, *z_descriptor_from;
php_oci_descriptor *descriptor_dest, *descriptor_from;
- long length = 0;
+ zend_long length = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO|l", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr, &length) == FAILURE) {
return;
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor"), (void **)&tmp_dest) == FAILURE) {
+ if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
RETURN_FALSE;
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor"), (void **)&tmp_from) == FAILURE) {
+ if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, 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);
+ 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 TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0");
@@ -837,7 +838,7 @@ PHP_FUNCTION(oci_lob_copy)
Tests to see if two LOB/FILE locators are equal */
PHP_FUNCTION(oci_lob_is_equal)
{
- zval **tmp_first, **tmp_second, *z_descriptor_first, *z_descriptor_second;
+ zval *tmp_first, *tmp_second, *z_descriptor_first, *z_descriptor_second;
php_oci_descriptor *descriptor_first, *descriptor_second;
boolean is_equal;
@@ -845,18 +846,18 @@ PHP_FUNCTION(oci_lob_is_equal)
return;
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor_first), "descriptor", sizeof("descriptor"), (void **)&tmp_first) == FAILURE) {
+ if ((tmp_first = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_first), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
RETURN_FALSE;
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor_second), "descriptor", sizeof("descriptor"), (void **)&tmp_second) == FAILURE) {
+ if ((tmp_second = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_second), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, 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);
+ 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 TSRMLS_CC)) {
RETURN_FALSE;
@@ -873,12 +874,12 @@ PHP_FUNCTION(oci_lob_is_equal)
Writes a large object into a file */
PHP_FUNCTION(oci_lob_export)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
char *filename;
char *buffer;
- int filename_len;
- long start = -1, length = -1, block_length;
+ size_t filename_len;
+ zend_long start = -1, length = -1, block_length;
php_stream *stream;
ub4 lob_length;
@@ -927,12 +928,12 @@ PHP_FUNCTION(oci_lob_export)
}
#endif
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
RETURN_FALSE;
@@ -1006,11 +1007,11 @@ PHP_FUNCTION(oci_lob_export)
Writes temporary blob */
PHP_FUNCTION(oci_lob_write_temporary)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
char *data;
- int data_len;
- long type = OCI_TEMP_CLOB;
+ size_t data_len;
+ zend_long type = OCI_TEMP_CLOB;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &type) == FAILURE) {
@@ -1023,12 +1024,12 @@ PHP_FUNCTION(oci_lob_write_temporary)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_write_tmp(descriptor, type, data, data_len TSRMLS_CC)) {
RETURN_FALSE;
@@ -1041,7 +1042,7 @@ PHP_FUNCTION(oci_lob_write_temporary)
Closes lob descriptor */
PHP_FUNCTION(oci_lob_close)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
if (!getThis()) {
@@ -1050,12 +1051,12 @@ PHP_FUNCTION(oci_lob_close)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_close(descriptor TSRMLS_CC)) {
RETURN_FALSE;
@@ -1071,7 +1072,7 @@ PHP_FUNCTION(oci_new_descriptor)
zval *z_connection;
php_oci_connection *connection;
php_oci_descriptor *descriptor;
- long type = OCI_DTYPE_LOB;
+ zend_long type = OCI_DTYPE_LOB;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_connection, &type) == FAILURE) {
return;
@@ -1146,7 +1147,7 @@ PHP_FUNCTION(oci_field_name)
php_oci_out_column *column;
if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) {
- RETURN_STRINGL(column->name, column->name_len, 1);
+ RETURN_STRINGL(column->name, column->name_len);
}
RETURN_FALSE;
}
@@ -1210,64 +1211,64 @@ PHP_FUNCTION(oci_field_type)
switch (column->data_type) {
#ifdef SQLT_TIMESTAMP
case SQLT_TIMESTAMP:
- RETVAL_STRING("TIMESTAMP",1);
+ RETVAL_STRING("TIMESTAMP");
break;
#endif
#ifdef SQLT_TIMESTAMP_TZ
case SQLT_TIMESTAMP_TZ:
- RETVAL_STRING("TIMESTAMP WITH TIMEZONE",1);
+ RETVAL_STRING("TIMESTAMP WITH TIMEZONE");
break;
#endif
#ifdef SQLT_TIMESTAMP_LTZ
case SQLT_TIMESTAMP_LTZ:
- RETVAL_STRING("TIMESTAMP WITH LOCAL TIMEZONE",1);
+ RETVAL_STRING("TIMESTAMP WITH LOCAL TIMEZONE");
break;
#endif
#ifdef SQLT_INTERVAL_YM
case SQLT_INTERVAL_YM:
- RETVAL_STRING("INTERVAL YEAR TO MONTH",1);
+ RETVAL_STRING("INTERVAL YEAR TO MONTH");
break;
#endif
#ifdef SQLT_INTERVAL_DS
case SQLT_INTERVAL_DS:
- RETVAL_STRING("INTERVAL DAY TO SECOND",1);
+ RETVAL_STRING("INTERVAL DAY TO SECOND");
break;
#endif
case SQLT_DAT:
- RETVAL_STRING("DATE",1);
+ RETVAL_STRING("DATE");
break;
case SQLT_NUM:
- RETVAL_STRING("NUMBER",1);
+ RETVAL_STRING("NUMBER");
break;
case SQLT_LNG:
- RETVAL_STRING("LONG",1);
+ RETVAL_STRING("LONG");
break;
case SQLT_BIN:
- RETVAL_STRING("RAW",1);
+ RETVAL_STRING("RAW");
break;
case SQLT_LBI:
- RETVAL_STRING("LONG RAW",1);
+ RETVAL_STRING("LONG RAW");
break;
case SQLT_CHR:
- RETVAL_STRING("VARCHAR2",1);
+ RETVAL_STRING("VARCHAR2");
break;
case SQLT_RSET:
- RETVAL_STRING("REFCURSOR",1);
+ RETVAL_STRING("REFCURSOR");
break;
case SQLT_AFC:
- RETVAL_STRING("CHAR",1);
+ RETVAL_STRING("CHAR");
break;
case SQLT_BLOB:
- RETVAL_STRING("BLOB",1);
+ RETVAL_STRING("BLOB");
break;
case SQLT_CLOB:
- RETVAL_STRING("CLOB",1);
+ RETVAL_STRING("CLOB");
break;
case SQLT_BFILE:
- RETVAL_STRING("BFILE",1);
+ RETVAL_STRING("BFILE");
break;
case SQLT_RDD:
- RETVAL_STRING("ROWID",1);
+ RETVAL_STRING("ROWID");
break;
default:
RETVAL_LONG(column->data_type);
@@ -1318,7 +1319,7 @@ PHP_FUNCTION(oci_execute)
{
zval *z_statement;
php_oci_statement *statement;
- long mode = OCI_COMMIT_ON_SUCCESS;
+ zend_long mode = OCI_COMMIT_ON_SUCCESS;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_statement, &mode) == FAILURE) {
return;
@@ -1386,13 +1387,14 @@ PHP_FUNCTION(ocifetchinto)
Fetch all rows of result data into an array */
PHP_FUNCTION(oci_fetch_all)
{
- zval *z_statement, *array, *element, *tmp;
+ zval *z_statement, *array;
+ zval element, tmp;
php_oci_statement *statement;
php_oci_out_column **columns;
- zval ***outarrs;
+ zval **outarrs;
ub4 nrows = 1;
int i;
- long rows = 0, flags = 0, skip = 0, maxrows = -1;
+ zend_long rows = 0, flags = 0, skip = 0, maxrows = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|lll", &z_statement, &array, &skip, &maxrows, &flags) == FAILURE) {
return;
@@ -1417,23 +1419,21 @@ PHP_FUNCTION(oci_fetch_all)
}
while (!php_oci_statement_fetch(statement, nrows TSRMLS_CC)) {
- zval *row;
+ zval row;
- MAKE_STD_ZVAL(row);
- array_init(row);
+ array_init(&row);
for (i = 0; i < statement->ncolumns; i++) {
- MAKE_STD_ZVAL(element);
- php_oci_column_to_zval(columns[ i ], element, PHP_OCI_RETURN_LOBS TSRMLS_CC);
+ php_oci_column_to_zval(columns[ i ], &element, PHP_OCI_RETURN_LOBS TSRMLS_CC);
if (flags & PHP_OCI_NUM) {
- zend_hash_next_index_insert(Z_ARRVAL_P(row), &element, sizeof(zval*), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL(row), &element);
} else { /* default to ASSOC */
- zend_symtable_update(Z_ARRVAL_P(row), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL);
+ zend_symtable_update(Z_ARRVAL(row), zend_string_init(columns[ i ]->name, columns[ i ]->name_len+1, 0), &element);
}
}
- zend_hash_next_index_insert(Z_ARRVAL_P(array), &row, sizeof(zval*), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(array), &row);
rows++;
if (maxrows != -1 && rows == maxrows) {
@@ -1451,25 +1451,22 @@ PHP_FUNCTION(oci_fetch_all)
for (i = 0; i < statement->ncolumns; i++) {
columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
- zend_hash_next_index_insert(Z_ARRVAL_P(array), &tmp, sizeof(zval*), (void **) &(outarrs[ i ]));
+ array_init(&tmp);
+ outarrs[ i ] = zend_hash_next_index_insert(Z_ARRVAL_P(array), &tmp);
}
} else { /* default to ASSOC */
for (i = 0; i < statement->ncolumns; i++) {
columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
- zend_symtable_update(Z_ARRVAL_P(array), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ]));
+ array_init(&tmp);
+ outarrs[ i ] = zend_symtable_update(Z_ARRVAL_P(array), zend_string_init(columns[ i ]->name, columns[ i ]->name_len+1, 0), &tmp);
}
}
while (!php_oci_statement_fetch(statement, nrows TSRMLS_CC)) {
for (i = 0; i < statement->ncolumns; i++) {
- MAKE_STD_ZVAL(element);
- php_oci_column_to_zval(columns[ i ], element, PHP_OCI_RETURN_LOBS TSRMLS_CC);
- zend_hash_index_update((*(outarrs[ i ]))->value.ht, rows, (void *)&element, sizeof(zval*), NULL);
+ php_oci_column_to_zval(columns[ i ], &element, PHP_OCI_RETURN_LOBS TSRMLS_CC);
+ zend_hash_index_update(&(outarrs[ i ])->value.arr->ht, rows, &element);
}
rows++;
@@ -1616,7 +1613,7 @@ PHP_FUNCTION(oci_error)
}
if (ZEND_NUM_ARGS() > 0) {
- statement = (php_oci_statement *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_statement);
+ statement = (php_oci_statement *) zend_fetch_resource(arg TSRMLS_CC, -1, NULL, NULL, 1, le_statement);
if (statement) {
errh = statement->err;
errcode = statement->errcode;
@@ -1627,14 +1624,14 @@ PHP_FUNCTION(oci_error)
goto go_out;
}
- connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_connection);
+ connection = (php_oci_connection *) zend_fetch_resource(arg TSRMLS_CC, -1, NULL, NULL, 1, le_connection);
if (connection) {
errh = connection->err;
errcode = connection->errcode;
goto go_out;
}
- connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_pconnection);
+ connection = (php_oci_connection *) zend_fetch_resource(arg TSRMLS_CC, -1, NULL, NULL, 1, le_pconnection);
if (connection) {
errh = connection->err;
errcode = connection->errcode;
@@ -1696,7 +1693,7 @@ PHP_FUNCTION(oci_parse)
php_oci_connection *connection;
php_oci_statement *statement;
char *query;
- int query_len;
+ size_t query_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &query, &query_len) == FAILURE) {
return;
@@ -1707,7 +1704,7 @@ PHP_FUNCTION(oci_parse)
statement = php_oci_statement_create(connection, query, query_len TSRMLS_CC);
if (statement) {
- RETURN_RESOURCE(statement->id);
+ RETURN_RES(statement->id);
}
RETURN_FALSE;
}
@@ -1719,7 +1716,7 @@ PHP_FUNCTION(oci_set_prefetch)
{
zval *z_statement;
php_oci_statement *statement;
- long size;
+ zend_long size;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &z_statement, &size) == FAILURE) {
return;
@@ -1746,7 +1743,7 @@ PHP_FUNCTION(oci_set_client_identifier)
zval *z_connection;
php_oci_connection *connection;
char *client_id;
- int client_id_len;
+ size_t client_id_len;
sword errstatus;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_id, &client_id_len) == FAILURE) {
@@ -1796,7 +1793,7 @@ PHP_FUNCTION(oci_set_edition)
{
#if ((OCI_MAJOR_VERSION > 11) || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION >= 2)))
char *edition;
- int edition_len;
+ size_t edition_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &edition, &edition_len) == FAILURE) {
return;
@@ -1830,7 +1827,7 @@ PHP_FUNCTION(oci_set_module_name)
zval *z_connection;
php_oci_connection *connection;
char *module;
- int module_len;
+ size_t module_len;
sword errstatus;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &module, &module_len) == FAILURE) {
@@ -1862,7 +1859,7 @@ PHP_FUNCTION(oci_set_action)
zval *z_connection;
php_oci_connection *connection;
char *action;
- int action_len;
+ size_t action_len;
sword errstatus;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &action, &action_len) == FAILURE) {
@@ -1894,7 +1891,7 @@ PHP_FUNCTION(oci_set_client_info)
zval *z_connection;
php_oci_connection *connection;
char *client_info;
- int client_info_len;
+ size_t client_info_len;
sword errstatus;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_info, &client_info_len) == FAILURE) {
@@ -1927,7 +1924,7 @@ PHP_FUNCTION(oci_set_db_operation)
zval *z_connection;
php_oci_connection *connection;
char *dbop_name;
- int dbop_name_len;
+ size_t dbop_name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &dbop_name, &dbop_name_len) == FAILURE) {
return;
@@ -1956,7 +1953,7 @@ PHP_FUNCTION(oci_password_change)
{
zval *z_connection;
char *user, *pass_old, *pass_new, *dbname;
- int user_len, pass_old_len, pass_new_len, dbname_len;
+ size_t user_len, pass_old_len, pass_new_len, dbname_len;
php_oci_connection *connection;
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || (PHP_MAJOR_VERSION < 5)
@@ -2006,7 +2003,7 @@ PHP_FUNCTION(oci_password_change)
if (!connection) {
RETURN_FALSE;
}
- RETURN_RESOURCE(connection->id);
+ RETURN_RES(connection->id);
}
WRONG_PARAM_COUNT;
}
@@ -2029,7 +2026,7 @@ PHP_FUNCTION(oci_new_cursor)
statement = php_oci_statement_create(connection, NULL, 0 TSRMLS_CC);
if (statement) {
- RETURN_RESOURCE(statement->id);
+ RETURN_RES(statement->id);
}
RETURN_FALSE;
}
@@ -2058,7 +2055,7 @@ PHP_FUNCTION(oci_client_version)
char *version = NULL;
php_oci_client_get_version(&version TSRMLS_CC);
- RETURN_STRING(version, 0);
+ RETURN_STRING(version);
}
/* }}} */
@@ -2080,7 +2077,7 @@ PHP_FUNCTION(oci_server_version)
RETURN_FALSE;
}
- RETURN_STRING(version, 0);
+ RETURN_STRING(version);
}
/* }}} */
@@ -2104,37 +2101,37 @@ PHP_FUNCTION(oci_statement_type)
switch (type) {
case OCI_STMT_SELECT:
- RETVAL_STRING("SELECT",1);
+ RETVAL_STRING("SELECT");
break;
case OCI_STMT_UPDATE:
- RETVAL_STRING("UPDATE",1);
+ RETVAL_STRING("UPDATE");
break;
case OCI_STMT_DELETE:
- RETVAL_STRING("DELETE",1);
+ RETVAL_STRING("DELETE");
break;
case OCI_STMT_INSERT:
- RETVAL_STRING("INSERT",1);
+ RETVAL_STRING("INSERT");
break;
case OCI_STMT_CREATE:
- RETVAL_STRING("CREATE",1);
+ RETVAL_STRING("CREATE");
break;
case OCI_STMT_DROP:
- RETVAL_STRING("DROP",1);
+ RETVAL_STRING("DROP");
break;
case OCI_STMT_ALTER:
- RETVAL_STRING("ALTER",1);
+ RETVAL_STRING("ALTER");
break;
case OCI_STMT_BEGIN:
- RETVAL_STRING("BEGIN",1);
+ RETVAL_STRING("BEGIN");
break;
case OCI_STMT_DECLARE:
- RETVAL_STRING("DECLARE",1);
+ RETVAL_STRING("DECLARE");
break;
case OCI_STMT_CALL:
- RETVAL_STRING("CALL",1);
+ RETVAL_STRING("CALL");
break;
default:
- RETVAL_STRING("UNKNOWN",1);
+ RETVAL_STRING("UNKNOWN");
}
}
/* }}} */
@@ -2164,7 +2161,7 @@ PHP_FUNCTION(oci_num_rows)
Deletes collection object*/
PHP_FUNCTION(oci_free_collection)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
if (!getThis()) {
@@ -2173,12 +2170,12 @@ PHP_FUNCTION(oci_free_collection)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
zend_list_delete(collection->id);
RETURN_TRUE;
@@ -2189,10 +2186,10 @@ PHP_FUNCTION(oci_free_collection)
Append an object to the collection */
PHP_FUNCTION(oci_collection_append)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
char *value;
- int value_len;
+ size_t value_len;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &value, &value_len) == FAILURE) {
@@ -2205,12 +2202,12 @@ PHP_FUNCTION(oci_collection_append)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_append(collection, value, value_len TSRMLS_CC)) {
RETURN_FALSE;
@@ -2223,10 +2220,10 @@ PHP_FUNCTION(oci_collection_append)
Retrieve the value at collection index ndx */
PHP_FUNCTION(oci_collection_element_get)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
- long element_index;
- zval *value;
+ zend_long element_index;
+ zval value;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &element_index) == FAILURE) {
@@ -2239,20 +2236,18 @@ PHP_FUNCTION(oci_collection_element_get)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_element_get(collection, element_index, &value TSRMLS_CC)) {
RETURN_FALSE;
}
- *return_value = *value;
- zval_copy_ctor(return_value);
- zval_ptr_dtor(&value);
+ RETURN_ZVAL(&value, 1, 1);
}
/* }}} */
@@ -2260,7 +2255,7 @@ PHP_FUNCTION(oci_collection_element_get)
Assign a collection from another existing collection */
PHP_FUNCTION(oci_collection_assign)
{
- zval **tmp_dest, **tmp_from, *z_collection_dest = getThis(), *z_collection_from;
+ zval *tmp_dest, *tmp_from, *z_collection_dest = getThis(), *z_collection_from;
php_oci_collection *collection_dest, *collection_from;
if (getThis()) {
@@ -2274,18 +2269,18 @@ PHP_FUNCTION(oci_collection_assign)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection_dest), "collection", sizeof("collection"), (void **)&tmp_dest) == FAILURE) {
+ if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_collection_dest), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property. The first argument should be valid collection object");
RETURN_FALSE;
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection_from), "collection", sizeof("collection"), (void **)&tmp_from) == FAILURE) {
+ if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_collection_from), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property. The second argument should be valid collection object");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp_dest, collection_dest);
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp_from, collection_from);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp_dest, collection_dest);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp_from, collection_from);
if (php_oci_collection_assign(collection_dest, collection_from TSRMLS_CC)) {
RETURN_FALSE;
@@ -2298,10 +2293,10 @@ PHP_FUNCTION(oci_collection_assign)
Assign element val to collection at index ndx */
PHP_FUNCTION(oci_collection_element_assign)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
- int value_len;
- long element_index;
+ size_t value_len;
+ zend_long element_index;
char *value;
if (getThis()) {
@@ -2315,12 +2310,12 @@ PHP_FUNCTION(oci_collection_element_assign)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_element_set(collection, element_index, value, value_len TSRMLS_CC)) {
RETURN_FALSE;
@@ -2333,7 +2328,7 @@ PHP_FUNCTION(oci_collection_element_assign)
Return the size of a collection */
PHP_FUNCTION(oci_collection_size)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
sb4 size = 0;
@@ -2343,12 +2338,12 @@ PHP_FUNCTION(oci_collection_size)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_size(collection, &size TSRMLS_CC)) {
RETURN_FALSE;
@@ -2361,9 +2356,9 @@ PHP_FUNCTION(oci_collection_size)
Return the max value of a collection. For a varray this is the maximum length of the array */
PHP_FUNCTION(oci_collection_max)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
- long max;
+ zend_long max;
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) {
@@ -2371,12 +2366,12 @@ PHP_FUNCTION(oci_collection_max)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_max(collection, &max TSRMLS_CC)) {
RETURN_FALSE;
@@ -2389,9 +2384,9 @@ PHP_FUNCTION(oci_collection_max)
Trim num elements from the end of a collection */
PHP_FUNCTION(oci_collection_trim)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
- long trim_size;
+ zend_long trim_size;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &trim_size) == FAILURE) {
@@ -2404,12 +2399,12 @@ PHP_FUNCTION(oci_collection_trim)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_trim(collection, trim_size TSRMLS_CC)) {
RETURN_FALSE;
@@ -2426,7 +2421,7 @@ PHP_FUNCTION(oci_new_collection)
php_oci_connection *connection;
php_oci_collection *collection;
char *tdo, *schema = NULL;
- int tdo_len, schema_len = 0;
+ size_t tdo_len, schema_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|s", &z_connection, &tdo, &tdo_len, &schema, &schema_len) == FAILURE) {
return;
@@ -2463,7 +2458,7 @@ PHP_FUNCTION(oci_get_implicit_resultset)
if (imp_statement) {
if (php_oci_statement_execute(imp_statement, (ub4)OCI_DEFAULT TSRMLS_CC))
RETURN_FALSE;
- RETURN_RESOURCE(imp_statement->id);
+ RETURN_RES(imp_statement->id);
}
RETURN_FALSE;
}