Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 57 lines (51 sloc) 1.824 kb
609d38a Marc Delisle start QA_11
lem9 authored
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 *
5 * @version $Id$
6 * @package phpMyAdmin-Designer
7 */
8
9 /**
10 *
11 */
12 include_once 'pmd_common.php';
13 require_once './libraries/relation.lib.php';
14 extract($_POST);
15 extract($_GET);
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
26 if ($type_T1 == 'INNODB' && $type_T2 == 'INNODB') {
27 // InnoDB
28 $existrel_innodb = PMA_getForeigners($DB2, $T2, '', 'innodb');
29
30 if (PMA_MYSQL_INT_VERSION >= 40013 && isset($existrel_innodb[$F2]['constraint'])) {
31 $upd_query = 'ALTER TABLE ' . PMA_backquote($T2)
32 . ' DROP FOREIGN KEY '
33 . PMA_backquote($existrel_innodb[$F2]['constraint']);
34 $upd_rs = PMA_DBI_query($upd_query);
35 }
36 } else {
37 // internal relations
38 PMA_query_as_cu('DELETE FROM '.$cfg['Server']['relation'].' WHERE '
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) . '\''
44 . 'AND foreign_field = \'' . PMA_sqlAddslashes($F1) . '\''
45 , FALSE, PMA_DBI_QUERY_STORE);
46 }
47 PMD_return(1, 'strRelationDeleted');
48
49 function PMD_return($b,$ret)
50 {
51 global $K;
52 header("Content-Type: text/xml; charset=utf-8");
53 header("Cache-Control: no-cache");
54 die('<root act="relation_upd" return="'.$ret.'" b="'.$b.'" K="'.$K.'"></root>');
55 }
56 ?>
Something went wrong with that request. Please try again.