bug #1438999 updating a multi-table view

This commit is contained in:
Marc Delisle
2006-05-23 16:54:30 +00:00
parent a34c3c3d63
commit 26019039ca
2 changed files with 14 additions and 7 deletions

View File

@@ -573,7 +573,8 @@ foreach ($loop_array AS $vrowcount => $vrow) {
echo ' <input type="hidden" name="fields_null_prev' . $vkey . '[' . urlencode($field) . ']"'; echo ' <input type="hidden" name="fields_null_prev' . $vkey . '[' . urlencode($field) . ']"';
if ($real_null_value && !$first_timestamp) { if ($real_null_value && !$first_timestamp) {
echo ' checked="checked"'; //echo ' checked="checked"';
echo ' value="on"';
} }
echo ' />' . "\n"; echo ' />' . "\n";

View File

@@ -168,13 +168,15 @@ foreach ($loop_array AS $primary_key_index => $enc_primary_key) {
$cur_value = $me_funcs[$encoded_key] . '(' . $val . '), '; $cur_value = $me_funcs[$encoded_key] . '(' . $val . '), ';
} }
// i n s e r t
if ($is_insert) { if ($is_insert) {
// insert, no need to add column // no need to add column into the valuelist
$valuelist .= $cur_value; $valuelist .= $cur_value;
} elseif (isset($me_fields_null_prev) && isset($me_fields_null_prev[$encoded_key]) && !isset($me_fields_null[$encoded_key])) {
// field had the null checkbox // u p d a t e
} elseif (isset($me_fields_null_prev) && isset($me_fields_null_prev[$encoded_key]) && !empty($me_fields_null_prev[$encoded_key]) && !isset($me_fields_null[$encoded_key])) {
// field had the null checkbox before the update
// field no longer has the null checkbox // field no longer has the null checkbox
// field does not have the same value
$valuelist .= PMA_backquote($key) . ' = ' . $cur_value; $valuelist .= PMA_backquote($key) . ' = ' . $cur_value;
} elseif (empty($me_funcs[$encoded_key]) } elseif (empty($me_funcs[$encoded_key])
&& isset($me_fields_prev) && isset($me_fields_prev[$encoded_key]) && isset($me_fields_prev) && isset($me_fields_prev[$encoded_key])
@@ -182,8 +184,12 @@ foreach ($loop_array AS $primary_key_index => $enc_primary_key) {
// No change for this column and no MySQL function is used -> next column // No change for this column and no MySQL function is used -> next column
continue; continue;
} elseif (!empty($val)) { } elseif (!empty($val)) {
// TODO: avoid setting a field to NULL when it's already NULL // avoid setting a field to NULL when it's already NULL
$valuelist .= PMA_backquote($key) . ' = ' . $cur_value; // (field had the null checkbox before the update
// field still has the null checkbox)
if (!(isset($me_fields_null_prev) && isset($me_fields_null_prev[$encoded_key]) && !empty($me_fields_null_prev[$encoded_key]) && isset($me_fields_null[$encoded_key]))) {
$valuelist .= PMA_backquote($key) . ' = ' . $cur_value;
}
} }
} // end while } // end while