summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Boeren <mboeren@php.net>2001-07-19 15:44:58 +0000
committerMarc Boeren <mboeren@php.net>2001-07-19 15:44:58 +0000
commite8bcbacb3e24f6ea2af436bebe92b0ff17156d49 (patch)
tree06bdfe05cdc34eeb7af69ea530fa4bb1285f77e8
parent01814bb2b8bf46f40c0117d880097574ed8b5802 (diff)
downloadphp-git-e8bcbacb3e24f6ea2af436bebe92b0ff17156d49.tar.gz
changed implementation of creating reference to a value by columnname (Mc)
added a test for changing the referenced value (Mc)
-rw-r--r--ext/dbx/dbx.c10
-rw-r--r--ext/dbx/tests/005.phpt3
2 files changed, 7 insertions, 6 deletions
diff --git a/ext/dbx/dbx.c b/ext/dbx/dbx.c
index 055d7350e0..1e54ad0689 100644
--- a/ext/dbx/dbx.c
+++ b/ext/dbx/dbx.c
@@ -464,15 +464,13 @@ ZEND_FUNCTION(dbx_query)
zend_hash_index_update(data->value.ht, row_count, (void *)&(rv_row), sizeof(zval *), (void **) &row_ptr);
/* associate results with fieldnames */
if (info_flags & DBX_RESULT_ASSOC) {
- zval **columnname_ptr, **actual_ptr, **reference_ptr;
- zval * dummy;
- ALLOC_ZVAL(dummy);
- INIT_ZVAL(*dummy);
+ zval **columnname_ptr, **actual_ptr;
for (col_index=0; col_index<rv_column_count->value.lval; ++col_index) {
zend_hash_index_find((*inforow_ptr)->value.ht, col_index, (void **) &columnname_ptr);
zend_hash_index_find((*row_ptr)->value.ht, col_index, (void **) &actual_ptr);
- zend_hash_update((*row_ptr)->value.ht, (*columnname_ptr)->value.str.val, (*columnname_ptr)->value.str.len + 1, &dummy, sizeof(zval *), (void **) &reference_ptr);
- zend_assign_to_variable_reference(NULL, reference_ptr, actual_ptr, NULL ELS_CC);
+ (*actual_ptr)->refcount+=1;
+ (*actual_ptr)->is_ref=1;
+ zend_hash_update((*row_ptr)->value.ht, (*columnname_ptr)->value.str.val, (*columnname_ptr)->value.str.len + 1, actual_ptr, sizeof(zval *), NULL);
}
}
++row_count;
diff --git a/ext/dbx/tests/005.phpt b/ext/dbx/tests/005.phpt
index 7185fdd0a8..4ee7f7c5a7 100644
--- a/ext/dbx/tests/005.phpt
+++ b/ext/dbx/tests/005.phpt
@@ -23,6 +23,8 @@ else {
for ($i=0; $i<$dro->rows; ++$i) {
print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".$dro->data[$i]['field1'].".".strlen($dro->data[$i]['field2'])."\n");
}
+ $dro->data[0]['id']='changed_value';
+ print($dro->data[0][0]."\n");
}
// insert query
if (dbx_query($dlo, $sql_insert_statement)) {
@@ -76,6 +78,7 @@ else {
40.100.field2 contains >64k text.70051
50.20.empty fields.0
60.20.empty fields.0
+changed_value
insert-query: dbx_query works ok
999999.temporary_record.0
update-query: dbx_query works ok