Merge remote-tracking branch 'origin/master'

This commit is contained in:
Michal Čihař 2012-07-29 15:23:08 +02:00
commit e08e5d12c4
4 changed files with 29 additions and 18 deletions

View File

@ -1431,7 +1431,10 @@ class PMA_DisplayResults
&& ($direction != self::DISP_DIR_HORIZONTAL_FLIPPED)
) {
$comments_map = array();
if (isset($analyzed_sql[0]) && is_array($analyzed_sql[0]) && isset($analyzed_sql[0]['table_ref'])) {
if (isset($analyzed_sql[0])
&& is_array($analyzed_sql[0])
&& isset($analyzed_sql[0]['table_ref'])
) {
foreach ($analyzed_sql[0]['table_ref'] as $tbl) {
$tb = $tbl['table_true_name'];
$comments_map[$tb] = PMA_getComments($this->__get('_db'), $tb);

View File

@ -40,8 +40,10 @@ if (isset($mode)) {
die("<script>alert('Pages not found!');history.go(-2);</script>");
}
$pmd_table = $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($GLOBALS['cfgRelation']['designer_coords']);
$pma_table = $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['table_coords']);
$pmd_table = $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.'
. $common_functions->backquote($GLOBALS['cfgRelation']['designer_coords']);
$pma_table = $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.'
. $common_functions->backquote($cfgRelation['table_coords']);
$scale_q = $common_functions->sqlAddSlashes($scale);
if ('create_export' == $mode) {
@ -57,7 +59,12 @@ if (isset($mode)) {
$pdf_page_number_q = $common_functions->sqlAddSlashes($pdf_page_number);
if ('export' == $mode) {
$sql = "REPLACE INTO " . $pma_table . " (db_name, table_name, pdf_page_number, x, y) SELECT db_name, table_name, " . $pdf_page_number_q . ", ROUND(x/" . $scale_q . ") , ROUND(y/" . $scale_q . ") y FROM " . $pmd_table . " WHERE db_name = '" . $common_functions->sqlAddSlashes($db) . "'";
$sql = "REPLACE INTO " . $pma_table
. " (db_name, table_name, pdf_page_number, x, y)"
. " SELECT db_name, table_name, " . $pdf_page_number_q . ","
. " ROUND(x/" . $scale_q . ") , ROUND(y/" . $scale_q . ") y"
. " FROM " . $pmd_table
. " WHERE db_name = '" . $common_functions->sqlAddSlashes($db) . "'";
PMA_queryAsControlUser($sql, true, PMA_DBI_QUERY_STORE);
}
@ -72,7 +79,7 @@ if (isset($mode)) {
AND
' . $pmd_table . '.`table_name` = ' . $pma_table . '.`table_name`
AND
' . $pmd_table . '.`db_name`=\''. $common_functions->sqlAddSlashes($db) .'\'
' . $pmd_table . '.`db_name`=\''. $common_functions->sqlAddSlashes($db) . '\'
AND pdf_page_number = ' . $pdf_page_number_q . ';',
true, PMA_DBI_QUERY_STORE
);

View File

@ -35,14 +35,14 @@ if ($common_functions->isForeignKeySupported($type_T1)
) {
PMD_return_new(0, __('Error: relation already exists.'));
}
// note: in InnoDB, the index does not requires to be on a PRIMARY
// or UNIQUE key
// improve: check all other requirements for InnoDB relations
// note: in InnoDB, the index does not requires to be on a PRIMARY
// or UNIQUE key
// improve: check all other requirements for InnoDB relations
$result = PMA_DBI_query(
'SHOW INDEX FROM ' . $common_functions->backquote($db)
. '.' . $common_functions->backquote($T1) . ';'
);
$index_array1 = array(); // will be use to emphasis prim. keys in the table view
$index_array1 = array(); // will be use to emphasis prim. keys in the table view
while ($row = PMA_DBI_fetch_assoc($result)) {
$index_array1[$row['Column_name']] = 1;
}
@ -52,7 +52,7 @@ if ($common_functions->isForeignKeySupported($type_T1)
'SHOW INDEX FROM ' . $common_functions->backquote($db)
. '.' . $common_functions->backquote($T2) . ';'
);
$index_array2 = array(); // will be used to emphasis prim. keys in the table view
$index_array2 = array(); // will be used to emphasis prim. keys in the table view
while ($row = PMA_DBI_fetch_assoc($result)) {
$index_array2[$row['Column_name']] = 1;
}
@ -76,11 +76,9 @@ if ($common_functions->isForeignKeySupported($type_T1)
}
$upd_query .= ';';
PMA_DBI_try_query($upd_query) or PMD_return_new(0, __('Error: Relation not added.'));
PMD_return_new(1, __('FOREIGN KEY relation added'));
PMD_return_new(1, __('FOREIGN KEY relation added'));
}
// internal (pmadb) relation
} else {
} else { // internal (pmadb) relation
if ($GLOBALS['cfgRelation']['relwork'] == false) {
PMD_return_new(0, _('General relation features') . ':' . _('Disabled'));
} else {
@ -102,7 +100,7 @@ if ($common_functions->isForeignKeySupported($type_T1)
} else {
PMD_return_new(0, __('Error: Relation not added.'));
}
}
}
}
function PMD_return_new($b,$ret)

View File

@ -38,17 +38,20 @@ foreach ($post_params as $one_post_param) {
}
foreach ($t_x as $key => $value) {
$KEY = empty($IS_AJAX) ? urldecode($key) : $key; // table name decode (post PDF exp/imp)
// table name decode (post PDF exp/imp)
$KEY = empty($IS_AJAX) ? urldecode($key) : $key;
list($DB,$TAB) = explode(".", $KEY);
PMA_queryAsControlUser(
'DELETE FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($GLOBALS['cfgRelation']['designer_coords'])
'DELETE FROM ' . $common_functions->backquote($GLOBALS['cfgRelation']['db'])
. '.' . $common_functions->backquote($GLOBALS['cfgRelation']['designer_coords'])
. ' WHERE `db_name` = \'' . $common_functions->sqlAddSlashes($DB) . '\''
. ' AND `table_name` = \'' . $common_functions->sqlAddSlashes($TAB) . '\'',
true, PMA_DBI_QUERY_STORE
);
PMA_queryAsControlUser(
'INSERT INTO ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($GLOBALS['cfgRelation']['designer_coords'])
'INSERT INTO ' . $common_functions->backquote($GLOBALS['cfgRelation']['db'])
. '.' . $common_functions->backquote($GLOBALS['cfgRelation']['designer_coords'])
. ' (db_name, table_name, x, y, v, h)'
. ' VALUES ('
. '\'' . $common_functions->sqlAddSlashes($DB) . '\', '