Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 58 lines (53 sloc) 1.957 kb
fb9a3a59 » nijel
2006-11-17 Check before commit!
1 <?php
817e7907 » Sebastian Mendel
2007-03-19 synced/fixed vim line
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
374abd51 » Sebastian Mendel
2007-03-20 fixed/added page level docblock
3 /**
4 *
5 * @version $Id$
da19f7be » Sebastian Mendel
2007-03-20 marked phpMyAdmin Designer as own package (phpMyAdmin-Designer)
6 * @package phpMyAdmin-Designer
374abd51 » Sebastian Mendel
2007-03-20 fixed/added page level docblock
7 */
fb9a3a59 » nijel
2006-11-17 Check before commit!
8
374abd51 » Sebastian Mendel
2007-03-20 fixed/added page level docblock
9 /**
10 *
11 */
21398414 » lem9
2006-11-22 rename pmd_session.php to pmd_common.php
12 include_once 'pmd_common.php';
fb9a3a59 » nijel
2006-11-17 Check before commit!
13 require_once './libraries/relation.lib.php';
11fe5570 » lem9
2008-02-21 avoid of existing variables during extract
14 extract($_POST, EXTR_SKIP);
15 extract($_GET, EXTR_SKIP);
fb9a3a59 » nijel
2006-11-17 Check before commit!
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
7c5d5c46 » lem9
2008-05-04 PBXT: foreign key support
26 if (PMA_foreignkey_supported($type_T1) && PMA_foreignkey_supported($type_T2) && $type_T1 == $type_T2) {
9949e5c0 » lem9
2007-07-11 Do not try to delete an internal relation if we just deleted an InnoD…
27 // InnoDB
7c5d5c46 » lem9
2008-05-04 PBXT: foreign key support
28 $existrel_foreign = PMA_getForeigners($DB2, $T2, '', 'foreign');
fb9a3a59 » nijel
2006-11-17 Check before commit!
29
7c5d5c46 » lem9
2008-05-04 PBXT: foreign key support
30 if (isset($existrel_foreign[$F2]['constraint'])) {
fb9a3a59 » nijel
2006-11-17 Check before commit!
31 $upd_query = 'ALTER TABLE ' . PMA_backquote($T2)
32 . ' DROP FOREIGN KEY '
7c5d5c46 » lem9
2008-05-04 PBXT: foreign key support
33 . PMA_backquote($existrel_foreign[$F2]['constraint']);
fb9a3a59 » nijel
2006-11-17 Check before commit!
34 $upd_rs = PMA_DBI_query($upd_query);
35 }
9949e5c0 » lem9
2007-07-11 Do not try to delete an internal relation if we just deleted an InnoD…
36 } else {
37 // internal relations
dc6c010d » lem9
2008-05-11 deleting internal relation no longer worked
38 PMA_query_as_cu('DELETE FROM '
39 . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.'
40 . $cfg['Server']['relation'].' WHERE '
817e7907 » Sebastian Mendel
2007-03-19 synced/fixed vim line
41 . 'master_db = \'' . PMA_sqlAddslashes($DB2) . '\''
dc6c010d » lem9
2008-05-11 deleting internal relation no longer worked
42 . ' AND master_table = \'' . PMA_sqlAddslashes($T2) . '\''
43 . ' AND master_field = \'' . PMA_sqlAddslashes($F2) . '\''
44 . ' AND foreign_db = \'' . PMA_sqlAddslashes($DB1) . '\''
45 . ' AND foreign_table = \'' . PMA_sqlAddslashes($T1) . '\''
46 . ' AND foreign_field = \'' . PMA_sqlAddslashes($F1) . '\''
af31d1e0 » lem9
2007-01-02 designer: support for MSIE 6 and various fixes
47 , FALSE, PMA_DBI_QUERY_STORE);
9949e5c0 » lem9
2007-07-11 Do not try to delete an internal relation if we just deleted an InnoD…
48 }
817e7907 » Sebastian Mendel
2007-03-19 synced/fixed vim line
49 PMD_return(1, 'strRelationDeleted');
fb9a3a59 » nijel
2006-11-17 Check before commit!
50
51 function PMD_return($b,$ret)
52 {
53 global $K;
af31d1e0 » lem9
2007-01-02 designer: support for MSIE 6 and various fixes
54 header("Content-Type: text/xml; charset=utf-8");
55 header("Cache-Control: no-cache");
fb9a3a59 » nijel
2006-11-17 Check before commit!
56 die('<root act="relation_upd" return="'.$ret.'" b="'.$b.'" K="'.$K.'"></root>');
57 }
58 ?>
Something went wrong with that request. Please try again.