]> granicus.if.org Git - php/commitdiff
Get the Sybase modules uptodate
authorZeev Suraski <zeev@php.net>
Fri, 16 Jul 1999 22:00:53 +0000 (22:00 +0000)
committerZeev Suraski <zeev@php.net>
Fri, 16 Jul 1999 22:00:53 +0000 (22:00 +0000)
ext/sybase/sybase-ct.c
ext/sybase/sybase.c

index b928e2ba45c58d4abe4bfa0a9fc260d066c3d6c9..cf50de9f29d48e0eac7e74513965389b4778cc56 100644 (file)
@@ -1246,7 +1246,7 @@ PHP_FUNCTION(sybct_fetch_row)
        pval *sybct_result_index;
        int type,i,id;
        sybct_result *result;
-       pval field_content;
+       pval *field_content;
 
        if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &sybct_result_index)==FAILURE) {
                WRONG_PARAM_COUNT;
@@ -1267,9 +1267,11 @@ PHP_FUNCTION(sybct_fetch_row)
        
        array_init(return_value);
        for (i=0; i<result->num_fields; i++) {
-               field_content = result->data[result->cur_row][i];
-               pval_copy_constructor(&field_content);
-               _php3_hash_index_update(return_value->value.ht, i, (void *) &field_content, sizeof(pval),NULL);
+               field_content = (pval *) emalloc(sizeof(pval));
+               *field_content = result->data[result->cur_row][i];
+               INIT_PZVAL(field_content);
+               pval_copy_constructor(field_content);
+               _php3_hash_index_update(return_value->value.ht, i, (void *) &field_content, sizeof(pval* ), NULL);
        }
        result->cur_row++;
 }
@@ -1281,7 +1283,7 @@ static PHP_FUNCTION(sybct_fetch_hash)
        sybct_result *result;
        int type;
        int i;
-       pval *pval_ptr,tmp;
+       pval *tmp;
        PLS_FETCH();
        
        if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &sybct_result_index)==FAILURE) {
@@ -1305,13 +1307,15 @@ static PHP_FUNCTION(sybct_fetch_hash)
        }
        
        for (i=0; i<result->num_fields; i++) {
-               tmp = result->data[result->cur_row][i];
-               pval_copy_constructor(&tmp);
-               if (PG(magic_quotes_runtime) && tmp.type == IS_STRING) {
-                       tmp.value.str.val = _php3_addslashes(tmp.value.str.val,tmp.value.str.len,&tmp.value.str.len,1);
+               tmp = (pval *) emalloc(sizeof(pval));
+               *tmp = result->data[result->cur_row][i];
+               INIT_PZVAL(tmp);
+               pval_copy_constructor(tmp);
+               if (PG(magic_quotes_runtime) && tmp->type == IS_STRING) {
+                       tmp->value.str.val = _php3_addslashes(tmp->value.str.val,tmp->value.str.len,&tmp->value.str.len,1);
                }
-               _php3_hash_index_update(return_value->value.ht, i, (void *) &tmp, sizeof(pval), (void **) &pval_ptr);
-               _php3_hash_pointer_update(return_value->value.ht, result->fields[i].name, strlen(result->fields[i].name)+1, pval_ptr);
+               _php3_hash_index_update(return_value->value.ht, i, (void *) &tmp, sizeof(pval *), NULL);
+               _php3_hash_update(return_value->value.ht, result->fields[i].name, strlen(result->fields[i].name)+1, (void *) &tmp, sizeof(pval *) NULL);
        }
        result->cur_row++;
 }
index 179b5afe06d9d4f7b85a0404c1abedeaab7ddc9c..760335d21e3101b84608ffd6afebf127d17a4fd2 100644 (file)
@@ -867,7 +867,7 @@ PHP_FUNCTION(sybase_fetch_row)
        pval *sybase_result_index;
        int type,i,id;
        sybase_result *result;
-       pval field_content;
+       pval *field_content;
 
        if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
                WRONG_PARAM_COUNT;
@@ -888,9 +888,10 @@ PHP_FUNCTION(sybase_fetch_row)
        
        array_init(return_value);
        for (i=0; i<result->num_fields; i++) {
-               field_content = result->data[result->cur_row][i];
-               pval_copy_constructor(&field_content);
-               _php3_hash_index_update(return_value->value.ht, i, (void *) &field_content, sizeof(pval),NULL);
+               MAKE_STD_ZVAL(field_content);
+               *field_content = result->data[result->cur_row][i];
+               pval_copy_constructor(field_content);
+               _php3_hash_index_update(return_value->value.ht, i, (void *) &field_content, sizeof(pval *), NULL);
        }
        result->cur_row++;
 }
@@ -902,7 +903,7 @@ static PHP_FUNCTION(sybase_fetch_hash)
        sybase_result *result;
        int type;
        int i;
-       pval *pval_ptr,tmp;
+       pval *tmp;
        
        if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
                WRONG_PARAM_COUNT;
@@ -925,13 +926,15 @@ static PHP_FUNCTION(sybase_fetch_hash)
        }
        
        for (i=0; i<result->num_fields; i++) {
-               tmp = result->data[result->cur_row][i];
-               pval_copy_constructor(&tmp);
-               if (PG(magic_quotes_runtime) && tmp.type == IS_STRING) {
-                       tmp.value.str.val = _php3_addslashes(tmp.value.str.val,tmp.value.str.len,&tmp.value.str.len,1);
+               MAKE_STD_ZVAL(tmp);
+               *tmp = result->data[result->cur_row][i];
+               pval_copy_constructor(tmp);
+               if (PG(magic_quotes_runtime) && tmp->type == IS_STRING) {
+                       tmp->value.str.val = _php3_addslashes(tmp->value.str.val,tmp->value.str.len,&tmp->value.str.len,1);
                }
-               _php3_hash_index_update(return_value->value.ht, i, (void *) &tmp, sizeof(pval), (void **) &pval_ptr);
-               _php3_hash_pointer_update(return_value->value.ht, result->fields[i].name, strlen(result->fields[i].name)+1, pval_ptr);
+               _php3_hash_index_update(return_value->value.ht, i, (void *) &tmp, sizeof(pval *), NULL);
+               tmp->refcount++;
+               _php3_hash_update(return_value->value.ht, result->fields[i].name, strlen(result->fields[i].name)+1, (void *) &tmp, sizeof(pval  *), NULL);
        }
        result->cur_row++;
 }