RFE #1743983: replace $max_characters by a configurable param MaxCharactersInDisplayedSQL
[phpmyadmin/crack.git] / pmd_relation_upd.php
blob5941353c513f0ace1d31bca6aaead2c4d591e34e
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin-Designer
7 */
9 /**
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);
21 //++++++++++++++++++++++++++++++++++++++++++++++++++++ InnoDB ++++++++++++++++++++++++++++++++++++++++++++++++++++
24 $tables = PMA_DBI_get_tables_full($db, $T1);
25 $type_T1 = strtoupper($tables[$T1]['ENGINE']);
26 $tables = PMA_DBI_get_tables_full($db, $T2);
27 $type_T2 = strtoupper($tables[$T2]['ENGINE']);
29 if ($type_T1 == 'INNODB' && $type_T2 == 'INNODB') {
30 $existrel_innodb = PMA_getForeigners($DB2, $T2, '', 'innodb');
32 if (PMA_MYSQL_INT_VERSION >= 40013 && isset($existrel_innodb[$F2]['constraint'])) {
33 $upd_query = 'ALTER TABLE ' . PMA_backquote($T2)
34 . ' DROP FOREIGN KEY '
35 . PMA_backquote($existrel_innodb[$F2]['constraint']);
36 $upd_rs = PMA_DBI_query($upd_query);
39 //---------------------------------------------------------------------------------------------------
42 PMA_query_as_cu('DELETE FROM '.$cfg['Server']['relation'].' WHERE '
43 . 'master_db = \'' . PMA_sqlAddslashes($DB2) . '\''
44 . 'AND master_table = \'' . PMA_sqlAddslashes($T2) . '\''
45 . 'AND master_field = \'' . PMA_sqlAddslashes($F2) . '\''
46 . 'AND foreign_db = \'' . PMA_sqlAddslashes($DB1) . '\''
47 . 'AND foreign_table = \'' . PMA_sqlAddslashes($T1) . '\''
48 . 'AND foreign_field = \'' . PMA_sqlAddslashes($F1) . '\''
49 , FALSE, PMA_DBI_QUERY_STORE);
51 PMD_return(1, 'strRelationDeleted');
53 function PMD_return($b,$ret)
55 global $K;
56 header("Content-Type: text/xml; charset=utf-8");
57 header("Cache-Control: no-cache");
58 die('<root act="relation_upd" return="'.$ret.'" b="'.$b.'" K="'.$K.'"></root>');