cvs: php4 /ext/dbx dbx.c /ext/dbx/tests 005.phpt
| From: | Marc Boeren | Date: | Thu, 19 Jul 2001 15:44:58 +0000 |
| Subject: | cvs: php4 /ext/dbx dbx.c /ext/dbx/tests 005.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-6270@lists.php.net to get a copy of this message | ||
mboeren Thu Jul 19 11:44:58 2001 EDT
Modified files:
/php4/ext/dbx dbx.c
/php4/ext/dbx/tests 005.phpt
Log:
changed implementation of creating reference to a value by columnname (Mc)
added a test for changing the referenced value (Mc)
Index: php4/ext/dbx/dbx.c
diff -u php4/ext/dbx/dbx.c:1.16 php4/ext/dbx/dbx.c:1.17
--- php4/ext/dbx/dbx.c:1.16 Wed Jun 20 07:30:47 2001
+++ php4/ext/dbx/dbx.c Thu Jul 19 11:44:56 2001
@@ -464,15 +464,13 @@
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;
Index: php4/ext/dbx/tests/005.phpt
diff -u php4/ext/dbx/tests/005.phpt:1.1 php4/ext/dbx/tests/005.phpt:1.2
--- php4/ext/dbx/tests/005.phpt:1.1 Tue Jun 5 09:51:01 2001
+++ php4/ext/dbx/tests/005.phpt Thu Jul 19 11:44:58 2001
@@ -23,6 +23,8 @@
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 @@
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