Skip to content
Newer
Older
100644 57 lines (51 sloc) 1.82 KB
fb9a3a5 @nijel Check before commit!
nijel authored
1 <?php
817e790 synced/fixed vim line
Sebastian Mendel authored
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
374abd5 fixed/added page level docblock
Sebastian Mendel authored
3 /**
4 *
5 * @version $Id$
da19f7b marked phpMyAdmin Designer as own package (phpMyAdmin-Designer)
Sebastian Mendel authored
6 * @package phpMyAdmin-Designer
374abd5 fixed/added page level docblock
Sebastian Mendel authored
7 */
fb9a3a5 @nijel Check before commit!
nijel authored
8
374abd5 fixed/added page level docblock
Sebastian Mendel authored
9 /**
10 *
11 */
2139841 @lem9 rename pmd_session.php to pmd_common.php
lem9 authored
12 include_once 'pmd_common.php';
fb9a3a5 @nijel Check before commit!
nijel authored
13 require_once './libraries/relation.lib.php';
11fe557 @lem9 avoid of existing variables during extract
lem9 authored
14 extract($_POST, EXTR_SKIP);
15 extract($_GET, EXTR_SKIP);
fb9a3a5 @nijel Check before commit!
nijel authored
16 $die_save_pos = 0;
17 include_once 'pmd_save_pos.php';
18 list($DB1,$T1) = explode(".",$T1);
19 list($DB2,$T2) = explode(".",$T2);
20
21 $tables = PMA_DBI_get_tables_full($db, $T1);
22 $type_T1 = strtoupper($tables[$T1]['ENGINE']);
23 $tables = PMA_DBI_get_tables_full($db, $T2);
24 $type_T2 = strtoupper($tables[$T2]['ENGINE']);
25
7c5d5c4 @lem9 PBXT: foreign key support
lem9 authored
26 if (PMA_foreignkey_supported($type_T1) && PMA_foreignkey_supported($type_T2) && $type_T1 == $type_T2) {
9949e5c @lem9 Do not try to delete an internal relation if we just deleted an InnoD…
lem9 authored
27 // InnoDB
7c5d5c4 @lem9 PBXT: foreign key support
lem9 authored
28 $existrel_foreign = PMA_getForeigners($DB2, $T2, '', 'foreign');
fb9a3a5 @nijel Check before commit!
nijel authored
29
7c5d5c4 @lem9 PBXT: foreign key support
lem9 authored
30 if (isset($existrel_foreign[$F2]['constraint'])) {
fb9a3a5 @nijel Check before commit!
nijel authored
31 $upd_query = 'ALTER TABLE ' . PMA_backquote($T2)
32 . ' DROP FOREIGN KEY '
7c5d5c4 @lem9 PBXT: foreign key support
lem9 authored
33 . PMA_backquote($existrel_foreign[$F2]['constraint']);
fb9a3a5 @nijel Check before commit!
nijel authored
34 $upd_rs = PMA_DBI_query($upd_query);
35 }
9949e5c @lem9 Do not try to delete an internal relation if we just deleted an InnoD…
lem9 authored
36 } else {
37 // internal relations
38 PMA_query_as_cu('DELETE FROM '.$cfg['Server']['relation'].' WHERE '
817e790 synced/fixed vim line
Sebastian Mendel authored
39 . 'master_db = \'' . PMA_sqlAddslashes($DB2) . '\''
40 . 'AND master_table = \'' . PMA_sqlAddslashes($T2) . '\''
41 . 'AND master_field = \'' . PMA_sqlAddslashes($F2) . '\''
42 . 'AND foreign_db = \'' . PMA_sqlAddslashes($DB1) . '\''
43 . 'AND foreign_table = \'' . PMA_sqlAddslashes($T1) . '\''
af31d1e @lem9 designer: support for MSIE 6 and various fixes
lem9 authored
44 . 'AND foreign_field = \'' . PMA_sqlAddslashes($F1) . '\''
45 , FALSE, PMA_DBI_QUERY_STORE);
9949e5c @lem9 Do not try to delete an internal relation if we just deleted an InnoD…
lem9 authored
46 }
817e790 synced/fixed vim line
Sebastian Mendel authored
47 PMD_return(1, 'strRelationDeleted');
fb9a3a5 @nijel Check before commit!
nijel authored
48
49 function PMD_return($b,$ret)
50 {
51 global $K;
af31d1e @lem9 designer: support for MSIE 6 and various fixes
lem9 authored
52 header("Content-Type: text/xml; charset=utf-8");
53 header("Cache-Control: no-cache");
fb9a3a5 @nijel Check before commit!
nijel authored
54 die('<root act="relation_upd" return="'.$ret.'" b="'.$b.'" K="'.$K.'"></root>');
55 }
56 ?>
Something went wrong with that request. Please try again.