mirror of
https://github.com/php/php-src.git
synced 2026-04-29 19:23:22 +02:00
changed implementation of creating reference to a value by columnname (Mc)
added a test for changing the referenced value (Mc)
This commit is contained in:
+4
-6
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user