The branch, QA_3_4 has been updated
via 2e101cc7336f2a448dd1682a49f8b343386f8c07 (commit)
from f29ba65b70dc36b037a5a2620bf6b553709c8962 (commit)
- Log -----------------------------------------------------------------
commit 2e101cc7336f2a448dd1682a49f8b343386f8c07
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Tue Sep 27 21:06:21 2011 +0530
bug #3412862 [relation] Relations/constraints are dropped/created on every change
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
tbl_relation.php | 29 +++++++++++------------------
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cc46481..a45a6ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,7 @@ phpMyAdmin - ChangeLog
- bug #3411633 [core] Call to undefined function PMA_isSuperuser()
- bug #3413743 [interface] Display options link missing after search
- bug #3324161 [core] CSP policy causing designer JS buttons to fail
+- bug #3412862 [relation] Relations/constraints are dropped/created on every change
3.4.5.0 (2011-09-14)
- bug #3375325 [interface] Page list in navigation frame looks odd
diff --git a/tbl_relation.php b/tbl_relation.php
index 400fc63..e4dcc16 100644
--- a/tbl_relation.php
+++ b/tbl_relation.php
@@ -72,9 +72,9 @@ function PMA_generate_dropdown($dropdown_question, $select_name,
$choices, $sele
}
/**
- * Split a string on backquote pairs
+ * Split a string on backquote pairs
*
- * @param string original string
+ * @param string original string
* @return array containing the elements (and their surrounding backquotes)
*
* @access public
@@ -97,7 +97,7 @@ function PMA_backquote_split($text)
}
$elements[] = substr($text, $first_backquote, $second_backquote -
$first_backquote + 1);
$pos = $second_backquote + 1;
- }
+ }
return($elements);
}
@@ -216,25 +216,18 @@ if (isset($_REQUEST['destination_foreign'])) {
} elseif
(PMA_backquote($existrel_foreign[$master_field]['foreign_db']) != $foreign_db
||
PMA_backquote($existrel_foreign[$master_field]['foreign_table']) !=
$foreign_table
||
PMA_backquote($existrel_foreign[$master_field]['foreign_field']) !=
$foreign_field
- || ($_REQUEST['on_delete'][$master_field_md5] !=
(!empty($existrel_foreign[$master_field]['on_delete']) ?
$existrel_foreign[$master_field]['on_delete'] : ''))
- || ($_REQUEST['on_update'][$master_field_md5] !=
(!empty($existrel_foreign[$master_field]['on_update']) ?
$existrel_foreign[$master_field]['on_update'] : ''))
+ || ($_REQUEST['on_delete'][$master_field_md5] !=
(!empty($existrel_foreign[$master_field]['on_delete']) ?
$existrel_foreign[$master_field]['on_delete'] : 'RESTRICT'))
+ || ($_REQUEST['on_update'][$master_field_md5] !=
(!empty($existrel_foreign[$master_field]['on_update']) ?
$existrel_foreign[$master_field]['on_update'] : 'RESTRICT'))
) {
// another foreign key is already defined for this field
// or
// an option has been changed for ON DELETE or ON UPDATE
- // remove existing key
+ // remove existing key and add the new one
$sql_query = 'ALTER TABLE ' . PMA_backquote($table)
. ' DROP FOREIGN KEY '
- .
PMA_backquote($existrel_foreign[$master_field]['constraint']) . ';';
-
- // I tried to send both in one query but it failed
- PMA_DBI_query($sql_query);
- $display_query .= $sql_query . "\n";
-
- // add another
- $sql_query = 'ALTER TABLE ' . PMA_backquote($table)
- . ' ADD FOREIGN KEY ('
+ .
PMA_backquote($existrel_foreign[$master_field]['constraint']) . ', '
+ . 'ADD FOREIGN KEY ('
. PMA_backquote($master_field) . ')'
. ' REFERENCES '
. $foreign_db . '.'
@@ -376,7 +369,7 @@ if ($cfgRelation['relwork'] ||
PMA_foreignkey_supported($tbl_type)) {
&& isset($curr_table[1])
&& strtoupper($curr_table[1]) == $tbl_type) {
// explicitely ask for non-quoted list of indexed columns
- // need to obtain backquoted values to support dots inside values
+ // need to obtain backquoted values to support dots inside values
$selectboxall_foreign = array_merge($selectboxall_foreign,
$current_table->getIndexedColumns($backquoted = true));
}
} // end while over tables
@@ -506,9 +499,9 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
</span>
<span class="formelement">
<?php
- // For ON DELETE and ON UPDATE, the default action
+ // For ON DELETE and ON UPDATE, the default action
// is RESTRICT as per MySQL doc; however, a SHOW CREATE TABLE
- // won't display the clause if it's set as RESTRICT.
+ // won't display the clause if it's set as RESTRICT.
PMA_generate_dropdown('ON DELETE',
'on_delete[' . $myfield_md5 . ']',
$options_array,
hooks/post-receive
--
phpMyAdmin
Show replies by date