2 /* vim: set expandtab sw=4 ts=4 sts=4: */
6 * @package phpMyAdmin-Designer
12 include_once 'pmd_common.php';
13 require_once './libraries/relation.lib.php';
14 extract($_POST, EXTR_SKIP
);
15 extract($_GET, EXTR_SKIP
);
17 include_once 'pmd_save_pos.php';
18 list($DB1,$T1) = explode(".",$T1);
19 list($DB2,$T2) = explode(".",$T2);
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']);
26 if ($type_T1 == 'INNODB' && $type_T2 == 'INNODB') {
28 $existrel_innodb = PMA_getForeigners($DB2, $T2, '', 'innodb');
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);
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
);
47 PMD_return(1, 'strRelationDeleted');
49 function PMD_return($b,$ret)
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>');