Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 70 lines (61 sloc) 2.194 kb
fb9a3a59 »
2006-11-17 Check before commit!
1 <?php
817e7907 »
2007-03-19 synced/fixed vim line
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
374abd51 »
2007-03-20 fixed/added page level docblock
3 /**
bf8bb147 »
2013-08-06 Various coding style fixes
4 * PMD relation update handler
374abd51 »
2007-03-20 fixed/added page level docblock
5 *
e56949f1 »
2011-10-25 Use package name PhpMyAdmin
6 * @package PhpMyAdmin-Designer
374abd51 »
2007-03-20 fixed/added page level docblock
7 */
fb9a3a59 »
2006-11-17 Check before commit!
8
374abd51 »
2007-03-20 fixed/added page level docblock
9 /**
10 *
11 */
c8b68657 »
2012-04-17 Move common includes to root files rather than to library (which shou…
12 require_once './libraries/common.inc.php';
31c8ca63 »
2012-06-05 Disable Response class for XHR requests in PMD
13
14 PMA_Response::getInstance()->disable();
15
b2fd866d »
2012-03-16 Leading ./ paths for includes can be omitted, part 2
16 require_once 'libraries/pmd_common.php';
11fe5570 »
2008-02-21 avoid of existing variables during extract
17 extract($_POST, EXTR_SKIP);
18 extract($_GET, EXTR_SKIP);
fb9a3a59 »
2006-11-17 Check before commit!
19 $die_save_pos = 0;
a30554b1 »
2011-09-06 use require() instead of include() when including file unconditionally
20 require_once 'pmd_save_pos.php';
e67a0a25 »
2011-09-23 Spaces between parameters in function calls
21 list($DB1, $T1) = explode(".", $T1);
22 list($DB2, $T2) = explode(".", $T2);
fb9a3a59 »
2006-11-17 Check before commit!
23
650a8cdd »
2013-05-24 Convert database interface to a class
24 $tables = $GLOBALS['dbi']->getTablesFull($db, $T1);
fb9a3a59 »
2006-11-17 Check before commit!
25 $type_T1 = strtoupper($tables[$T1]['ENGINE']);
650a8cdd »
2013-05-24 Convert database interface to a class
26 $tables = $GLOBALS['dbi']->getTablesFull($db, $T2);
fb9a3a59 »
2006-11-17 Check before commit!
27 $type_T2 = strtoupper($tables[$T2]['ENGINE']);
28
85055697 »
2010-11-06 Designer: their could be an internal relation to delete even if engin…
29 $try_to_delete_internal_relation = false;
30
e6894be5 »
2012-09-16 Renamed ->method() with PMA_Util::method()
31 if (PMA_Util::isForeignKeySupported($type_T1)
32 && PMA_Util::isForeignKeySupported($type_T2)
76646613 »
2012-06-22 Implement class behavior of common.lib.php file
33 && $type_T1 == $type_T2
34 ) {
9949e5c0 »
2007-07-11 Do not try to delete an internal relation if we just deleted an InnoD…
35 // InnoDB
7c5d5c46 »
2008-05-04 PBXT: foreign key support
36 $existrel_foreign = PMA_getForeigners($DB2, $T2, '', 'foreign');
fb9a3a59 »
2006-11-17 Check before commit!
37
7c5d5c46 »
2008-05-04 PBXT: foreign key support
38 if (isset($existrel_foreign[$F2]['constraint'])) {
e6894be5 »
2012-09-16 Renamed ->method() with PMA_Util::method()
39 $upd_query = 'ALTER TABLE ' . PMA_Util::backquote($DB2)
40 . '.' . PMA_Util::backquote($T2) . ' DROP FOREIGN KEY '
41 . PMA_Util::backquote($existrel_foreign[$F2]['constraint'])
7e169fca »
2012-08-31 Coding style improvements
42 . ';';
650a8cdd »
2013-05-24 Convert database interface to a class
43 $upd_rs = $GLOBALS['dbi']->query($upd_query);
85055697 »
2010-11-06 Designer: their could be an internal relation to delete even if engin…
44 } else {
45 // there can be an internal relation even if InnoDB
46 $try_to_delete_internal_relation = true;
fb9a3a59 »
2006-11-17 Check before commit!
47 }
9949e5c0 »
2007-07-11 Do not try to delete an internal relation if we just deleted an InnoD…
48 } else {
85055697 »
2010-11-06 Designer: their could be an internal relation to delete even if engin…
49 $try_to_delete_internal_relation = true;
50 }
51 if ($try_to_delete_internal_relation) {
9949e5c0 »
2007-07-11 Do not try to delete an internal relation if we just deleted an InnoD…
52 // internal relations
ec046f7d »
2012-06-23 Use camel case for function names (PMA_query_as_controluser => PMA_qu…
53 PMA_queryAsControlUser(
299da6d0 »
2011-09-23 More style errors fixed
54 'DELETE FROM '
e6894be5 »
2012-09-16 Renamed ->method() with PMA_Util::method()
55 . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.'
299da6d0 »
2011-09-23 More style errors fixed
56 . $cfg['Server']['relation'].' WHERE '
e6894be5 »
2012-09-16 Renamed ->method() with PMA_Util::method()
57 . 'master_db = \'' . PMA_Util::sqlAddSlashes($DB2) . '\''
58 . ' AND master_table = \'' . PMA_Util::sqlAddSlashes($T2) . '\''
59 . ' AND master_field = \'' . PMA_Util::sqlAddSlashes($F2) . '\''
60 . ' AND foreign_db = \'' . PMA_Util::sqlAddSlashes($DB1) . '\''
61 . ' AND foreign_table = \'' . PMA_Util::sqlAddSlashes($T1) . '\''
62 . ' AND foreign_field = \'' . PMA_Util::sqlAddSlashes($F1) . '\'',
299da6d0 »
2011-09-23 More style errors fixed
63 false,
3dd99512 »
2013-05-26 These constants are better as a part of DatabaseInterface class
64 PMA_DatabaseInterface::QUERY_STORE
299da6d0 »
2011-09-23 More style errors fixed
65 );
9949e5c0 »
2007-07-11 Do not try to delete an internal relation if we just deleted an InnoD…
66 }
b05a903d »
2010-05-14 gettext conversion
67 PMD_return_upd(1, __('Relation deleted'));
fb9a3a59 »
2006-11-17 Check before commit!
68
69 ?>
Something went wrong with that request. Please try again.