Check before commit!
[phpmyadmin/crack.git] / pmd_relation_upd.php
blobc0dec6f9f8970d18799fba7404763505c00da837
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 include_once 'pmd_session.php';
6 require_once './libraries/relation.lib.php';
7 extract($_POST);
8 extract($_GET);
9 $die_save_pos = 0;
10 include_once 'pmd_save_pos.php';
11 list($DB1,$T1) = explode(".",$T1);
12 list($DB2,$T2) = explode(".",$T2);
14 PMA_getRelationsParam();
16 //++++++++++++++++++++++++++++++++++++++++++++++++++++ InnoDB ++++++++++++++++++++++++++++++++++++++++++++++++++++
19 $tables = PMA_DBI_get_tables_full($db, $T1);
20 $type_T1 = strtoupper($tables[$T1]['ENGINE']);
21 $tables = PMA_DBI_get_tables_full($db, $T2);
22 $type_T2 = strtoupper($tables[$T2]['ENGINE']);
24 if ($type_T1 == 'INNODB' && $type_T2 == 'INNODB') {
25 $existrel_innodb = PMA_getForeigners($DB2, $T2, '', 'innodb');
27 if (PMA_MYSQL_INT_VERSION >= 40013 && isset($existrel_innodb[$F2]['constraint'])) {
28 $upd_query = 'ALTER TABLE ' . PMA_backquote($T2)
29 . ' DROP FOREIGN KEY '
30 . PMA_backquote($existrel_innodb[$F2]['constraint']);
31 $upd_rs = PMA_DBI_query($upd_query);
34 //---------------------------------------------------------------------------------------------------
36 PMA_query_as_cu("DELETE FROM ".$cfg['Server']['relation']." WHERE
37 master_db = '$DB2' AND master_table = '$T2' AND master_field = '$F2'
38 AND foreign_db = '$DB1' AND foreign_table = '$T1' AND foreign_field = '$F1'", FALSE, PMA_DBI_QUERY_STORE);
40 PMD_return(1, $strRelationDeleted);
42 function PMD_return($b,$ret)
44 global $K;
45 die('<root act="relation_upd" return="'.$ret.'" b="'.$b.'" K="'.$K.'"></root>');