added database name to relation querys

This commit is contained in:
Sebastian Mendel
2005-12-17 17:36:58 +00:00
parent d1b9d33269
commit 16a71a194e
11 changed files with 186 additions and 143 deletions

View File

@@ -5,6 +5,13 @@ phpMyAdmin - Changelog
$Id$
$Source$
2005-12-17 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* db_details_importdocsql.php, db_operations.php,
libraries\relation.lib.php, libraries\relation_cleanup.lib.php
libraries\tbl_move_copy.php, libraries\transformations.lib.php
pdf_pages.php, pdf_schema.php, tbl_alter.php, tbl_relation.php:
added database name to relation querys
2005-12-17 Marc Delisle <lem9@users.sourceforge.net>
* libraries/url_generating.lib.php: problem with accented table names

View File

@@ -64,13 +64,15 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
//echo '<p>' . $line . '</p>';
$inf = explode('|',$line);
if (!empty($inf[1]) && strlen(trim($inf[1])) > 0) {
$qry = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['column_info'])
. ' (db_name, table_name, column_name, ' . PMA_backquote('comment') . ') '
. ' VALUES('
. '\'' . PMA_sqlAddslashes($GLOBALS['db']) . '\','
. '\'' . PMA_sqlAddslashes(trim($tab)) . '\','
. '\'' . PMA_sqlAddslashes(trim($inf[0])) . '\','
. '\'' . PMA_sqlAddslashes(trim($inf[1])) . '\')';
$qry = '
INSERT INTO
' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['column_info']) . '
( db_name, table_name, column_name, ' . PMA_backquote('comment') . ' )
VALUES (
\'' . PMA_sqlAddslashes($GLOBALS['db']) . '\',
\'' . PMA_sqlAddslashes(trim($tab)) . '\',
\'' . PMA_sqlAddslashes(trim($inf[0])) . '\',
\'' . PMA_sqlAddslashes(trim($inf[1])) . '\')';
if (PMA_query_as_cu($qry)) {
echo '<p>' . $GLOBALS['strAddedColumnComment'] . ' ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . '</p>';
} else {
@@ -80,15 +82,17 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
} // end inf[1] exists
if (!empty($inf[2]) && strlen(trim($inf[2])) > 0) {
$for = explode('->', $inf[2]);
$qry = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['relation'])
. '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)'
. ' VALUES('
. '\'' . PMA_sqlAddslashes($GLOBALS['db']) . '\', '
. '\'' . PMA_sqlAddslashes(trim($tab)) . '\', '
. '\'' . PMA_sqlAddslashes(trim($inf[0])) . '\', '
. '\'' . PMA_sqlAddslashes($GLOBALS['db']) . '\', '
. '\'' . PMA_sqlAddslashes(trim($for[0])) . '\','
. '\'' . PMA_sqlAddslashes(trim($for[1])) . '\')';
$qry = '
INSERT INTO
' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['relation']) . '
( master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)
VALUES (
\'' . PMA_sqlAddslashes($GLOBALS['db']) . '\',
\'' . PMA_sqlAddslashes(trim($tab)) . '\',
\'' . PMA_sqlAddslashes(trim($inf[0])) . '\',
\'' . PMA_sqlAddslashes($GLOBALS['db']) . '\',
\'' . PMA_sqlAddslashes(trim($for[0])) . '\',
\'' . PMA_sqlAddslashes(trim($for[1])) . '\')';
if (PMA_query_as_cu($qry)) {
echo '<p>' . $GLOBALS['strAddedColumnRelation'] . ' ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . ' to ' . htmlspecialchars($inf[2]) . '</p>';
} else {

View File

@@ -328,8 +328,10 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?>
<?php
// We only show this if we find something in the new pdf_pages table
$test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$test_query = '
SELECT *
FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) . '
WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$test_rs = PMA_query_as_cu($test_query, NULL, PMA_DBI_QUERY_STORE);
if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) { ?>

View File

@@ -287,10 +287,14 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') {
global $cfgRelation, $err_url_0;
if ($cfgRelation['relwork'] && ($source == 'both' || $source == 'internal')) {
$rel_query = 'SELECT master_field, foreign_db, foreign_table, foreign_field'
. ' FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\' '
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\' ';
$rel_query = '
SELECT master_field,
foreign_db,
foreign_table,
foreign_field
FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['relation']) . '
WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'
AND master_table = \'' . PMA_sqlAddslashes($table) . '\' ';
if (!empty($column)) {
$rel_query .= ' AND master_field = \'' . PMA_sqlAddslashes($column) . '\'';
}
@@ -406,9 +410,11 @@ function PMA_getDisplayField($db, $table) {
*/
if (trim(@$cfgRelation['table_info']) != '') {
$disp_query = 'SELECT display_field FROM ' . PMA_backquote($cfgRelation['table_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$disp_query = '
SELECT display_field
FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['table_info']) . '
WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'
AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$disp_res = PMA_query_as_cu($disp_query);
$row = ($disp_res ? PMA_DBI_fetch_assoc($disp_res) : '');
@@ -477,17 +483,22 @@ function PMA_getComments($db, $table = '') {
// (this function can be called even if $cfgRelation['commwork'] is
// FALSE, to get native column comments, so recheck here)
if ($cfgRelation['commwork']) {
$com_qry = 'SELECT column_name, comment FROM ' . PMA_backquote($cfgRelation['db']) . '.' .PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$com_qry = '
SELECT column_name,
comment
FROM ' . PMA_backquote($cfgRelation['db']) . '.' .PMA_backquote($cfgRelation['column_info']) . '
WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'
AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$com_rs = PMA_query_as_cu($com_qry, TRUE, PMA_DBI_QUERY_STORE);
}
} else {
// pmadb internal db comments
$com_qry = 'SELECT ' . PMA_backquote('comment') . ' FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'\''
. ' AND column_name = \'(db_comment)\'';
$com_qry = '
SELECT ' . PMA_backquote('comment') . '
FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'
AND table_name = \'\'
AND column_name = \'(db_comment)\'';
$com_rs = PMA_query_as_cu($com_qry, TRUE, PMA_DBI_QUERY_STORE);
}
@@ -584,18 +595,25 @@ function PMA_setComment($db, $table, $col, $comment, $removekey = '', $mode='aut
);
if ($removekey != '' AND $removekey != $col) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddslashes($removekey) . '\'';
$remove_query = '
DELETE FROM
' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\'
AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\'
AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddslashes($removekey) . '\'';
PMA_query_as_cu($remove_query);
unset($remove_query);
}
$test_qry = 'SELECT ' . PMA_backquote('comment') . ', mimetype, transformation, transformation_options FROM ' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddslashes($col) . '\'';
$test_qry = '
SELECT ' . PMA_backquote('comment') . ',
mimetype,
transformation,
transformation_options
FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\'
AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\'
AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddslashes($col) . '\'';
$test_rs = PMA_query_as_cu($test_qry, TRUE, PMA_DBI_QUERY_STORE);
if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
@@ -603,25 +621,30 @@ function PMA_setComment($db, $table, $col, $comment, $removekey = '', $mode='aut
PMA_DBI_free_result($test_rs);
if (strlen($comment) > 0 || strlen($row['mimetype']) > 0 || strlen($row['transformation']) > 0 || strlen($row['transformation_options']) > 0) {
$upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['column_info'])
. ' SET ' . PMA_backquote('comment') . ' = \'' . PMA_sqlAddslashes($comment) . '\''
. ' WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddSlashes($col) . '\'';
$upd_query = '
UPDATE ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
SET ' . PMA_backquote('comment') . ' = \'' . PMA_sqlAddslashes($comment) . '\'
WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\'
AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\'
AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddSlashes($col) . '\'';
} else {
$upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddslashes($col) . '\'';
$upd_query = '
DELETE FROM
' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\'
AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\'
AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddslashes($col) . '\'';
}
} else if (strlen($comment) > 0) {
$upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['column_info'])
. ' (db_name, table_name, column_name, ' . PMA_backquote('comment') . ') '
. ' VALUES('
. '\'' . PMA_sqlAddslashes($db) . '\','
. '\'' . PMA_sqlAddslashes($table) . '\','
. '\'' . PMA_sqlAddslashes($col) . '\','
. '\'' . PMA_sqlAddslashes($comment) . '\')';
$upd_query = '
INSERT INTO
' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
(db_name, table_name, column_name, ' . PMA_backquote('comment') . ')
VALUES (
\'' . PMA_sqlAddslashes($db) . '\',
\'' . PMA_sqlAddslashes($table) . '\',
\'' . PMA_sqlAddslashes($col) . '\',
\'' . PMA_sqlAddslashes($comment) . '\')';
}
if (isset($upd_query)){
@@ -650,18 +673,20 @@ function PMA_setComment($db, $table, $col, $comment, $removekey = '', $mode='aut
function PMA_setHistory($db, $table, $username, $sqlquery) {
global $cfgRelation;
$hist_rs = PMA_query_as_cu('INSERT INTO ' . PMA_backquote($cfgRelation['history']) . ' ('
. PMA_backquote('username') . ','
. PMA_backquote('db') . ','
. PMA_backquote('table') . ','
. PMA_backquote('timevalue') . ','
. PMA_backquote('sqlquery')
. ') VALUES ('
. '\'' . PMA_sqlAddslashes($username) . '\','
. '\'' . PMA_sqlAddslashes($db) . '\','
. '\'' . PMA_sqlAddslashes($table) . '\','
. 'NOW(),'
. '\'' . PMA_sqlAddslashes($sqlquery) . '\')');
$hist_rs = PMA_query_as_cu('
INSERT INTO
' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['history']) . '
( ' . PMA_backquote('username') . ',
' . PMA_backquote('db') . ',
' . PMA_backquote('table') . ',
' . PMA_backquote('timevalue') . ',
' . PMA_backquote('sqlquery') . ' )
VALUES
( \'' . PMA_sqlAddslashes($username) . '\',
\'' . PMA_sqlAddslashes($db) . '\',
\'' . PMA_sqlAddslashes($table) . '\',
NOW(),
\'' . PMA_sqlAddslashes($sqlquery) . '\' )');
return true;
} // end of 'PMA_setHistory()' function
@@ -679,13 +704,13 @@ function PMA_setHistory($db, $table, $username, $sqlquery) {
function PMA_getHistory($username) {
global $cfgRelation;
$hist_query = 'SELECT '
. PMA_backquote('db') . ','
. PMA_backquote('table') . ','
. PMA_backquote('sqlquery')
. ' FROM ' . PMA_backquote($cfgRelation['history'])
. ' WHERE username = \'' . PMA_sqlAddslashes($username) . '\''
. ' ORDER BY id DESC';
$hist_query = '
SELECT ' . PMA_backquote('db') . ',
' . PMA_backquote('table') . ',
' . PMA_backquote('sqlquery') . '
FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['history']) . '
WHERE username = \'' . PMA_sqlAddslashes($username) . '\'
ORDER BY id DESC';
$hist_rs = PMA_query_as_cu($hist_query);
unset($hist_query);
@@ -719,9 +744,11 @@ function PMA_getHistory($username) {
function PMA_purgeHistory($username) {
global $cfgRelation, $cfg;
$purge_query = 'SELECT timevalue FROM ' . PMA_backquote($cfgRelation['history'])
. ' WHERE username = \'' . PMA_sqlAddSlashes($username) . '\''
. ' ORDER BY timevalue DESC LIMIT ' . $cfg['QueryHistoryMax'] . ', 1';
$purge_query = '
SELECT timevalue
FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['history']) . '
WHERE username = \'' . PMA_sqlAddSlashes($username) . '\'
ORDER BY timevalue DESC LIMIT ' . $cfg['QueryHistoryMax'] . ', 1';
$purge_rs = PMA_query_as_cu($purge_query);
$i = 0;
$row = PMA_DBI_fetch_row($purge_rs);
@@ -731,7 +758,10 @@ function PMA_purgeHistory($username) {
$maxtime = $row[0];
// quotes added around $maxtime to prevent a difficult to
// reproduce problem
$remove_rs = PMA_query_as_cu('DELETE FROM ' . PMA_backquote($cfgRelation['history']) . ' WHERE timevalue <= "' . $maxtime . '"');
$remove_rs = PMA_query_as_cu('
DELETE FROM
' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['history']) . '
WHERE timevalue <= \'' . $maxtime . '\'');
}
return true;

View File

@@ -13,7 +13,7 @@ $cfgRelation = PMA_getRelationsParam();
function PMA_relationsCleanupColumn($db, $table, $column) {
global $cfgRelation;
if ($cfgRelation['commwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND column_name = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
@@ -22,7 +22,7 @@ function PMA_relationsCleanupColumn($db, $table, $column) {
}
if ($cfgRelation['displaywork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND display_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
@@ -31,14 +31,14 @@ function PMA_relationsCleanupColumn($db, $table, $column) {
}
if ($cfgRelation['relwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND master_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query);
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND foreign_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
@@ -51,7 +51,7 @@ function PMA_relationsCleanupTable($db, $table) {
global $cfgRelation;
if ($cfgRelation['commwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query);
@@ -59,7 +59,7 @@ function PMA_relationsCleanupTable($db, $table) {
}
if ($cfgRelation['displaywork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query);
@@ -67,7 +67,7 @@ function PMA_relationsCleanupTable($db, $table) {
}
if ($cfgRelation['pdfwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query);
@@ -75,13 +75,13 @@ function PMA_relationsCleanupTable($db, $table) {
}
if ($cfgRelation['relwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query);
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query);
@@ -93,45 +93,45 @@ function PMA_relationsCleanupDatabase($db) {
global $cfgRelation;
if ($cfgRelation['commwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query);
}
if ($cfgRelation['bookmarkwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['bookmark'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['bookmark'])
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query);
}
if ($cfgRelation['displaywork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query);
}
if ($cfgRelation['pdfwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query);
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query);
}
if ($cfgRelation['relwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query);
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
$remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query);

View File

@@ -46,7 +46,7 @@ function PMA_duplicate_table_info($work, $pma_table, $get_fields, $where_fields,
}
$table_copy_query = 'SELECT ' . implode(', ', $select_parts)
. ' FROM ' . PMA_backquote($cfgRelation[$pma_table])
. ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation[$pma_table])
. ' WHERE ' . implode(' AND ', $where_parts);
// must use PMA_DBI_QUERY_STORE here, since we execute another
@@ -61,7 +61,7 @@ function PMA_duplicate_table_info($work, $pma_table, $get_fields, $where_fields,
}
}
$new_table_query = 'INSERT IGNORE INTO ' . PMA_backquote($cfgRelation[$pma_table])
$new_table_query = 'INSERT IGNORE INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation[$pma_table])
. ' (' . implode(', ', $select_parts) . ', ' . implode(', ', $new_parts) . ')'
. ' VALUES '
. ' (\'' . implode('\', \'', $value_parts) . '\', \'' . implode('\', \'', $new_value_parts) . '\')';
@@ -214,7 +214,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
// garvin: Move old entries from PMA-DBs to new table
if ($cfgRelation['commwork']) {
$remove_query = 'UPDATE ' . PMA_backquote($cfgRelation['column_info'])
$remove_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' SET table_name = \'' . PMA_sqlAddslashes($target_table) . '\', '
. ' db_name = \'' . PMA_sqlAddslashes($target_db) . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\''
@@ -226,7 +226,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
// garvin: updating bookmarks is not possible since only a single table is moved,
// and not the whole DB.
// if ($cfgRelation['bookmarkwork']) {
// $remove_query = 'UPDATE ' . PMA_backquote($cfgRelation['bookmark'])
// $remove_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['bookmark'])
// . ' SET dbase = \'' . PMA_sqlAddslashes($target_db) . '\''
// . ' WHERE dbase = \'' . PMA_sqlAddslashes($source_db) . '\'';
// $rmv_rs = PMA_query_as_cu($remove_query);
@@ -234,7 +234,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
// }
if ($cfgRelation['displaywork']) {
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_info'])
$table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' SET db_name = \'' . PMA_sqlAddslashes($target_db) . '\', '
. ' table_name = \'' . PMA_sqlAddslashes($target_table) . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\''
@@ -245,7 +245,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
}
if ($cfgRelation['relwork']) {
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['relation'])
$table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' SET foreign_table = \'' . PMA_sqlAddslashes($target_table) . '\','
. ' foreign_db = \'' . PMA_sqlAddslashes($target_db) . '\''
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($source_db) . '\''
@@ -254,7 +254,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
unset($table_query);
unset($tb_rs);
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['relation'])
$table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' SET master_table = \'' . PMA_sqlAddslashes($target_table) . '\','
. ' master_db = \'' . PMA_sqlAddslashes($target_db) . '\''
. ' WHERE master_db = \'' . PMA_sqlAddslashes($source_db) . '\''
@@ -270,7 +270,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
// please have a look at it?
if ($cfgRelation['pdfwork']) {
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_coords'])
$table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' SET table_name = \'' . PMA_sqlAddslashes($target_table) . '\','
. ' db_name = \'' . PMA_sqlAddslashes($target_db) . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\''
@@ -280,13 +280,13 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
unset($tb_rs);
/*
$pdf_query = 'SELECT pdf_page_number '
. ' FROM ' . PMA_backquote($cfgRelation['table_coords'])
. ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($target_db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($target_table) . '\'';
$pdf_rs = PMA_query_as_cu($pdf_query);
while ($pdf_copy_row = PMA_DBI_fetch_assoc($pdf_rs)) {
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['pdf_pages'])
$table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' SET db_name = \'' . PMA_sqlAddslashes($target_db) . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\''
. ' AND page_nr = \'' . PMA_sqlAddslashes($pdf_copy_row['pdf_page_number']) . '\'';
@@ -305,7 +305,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
// Get all comments and MIME-Types for current table
$comments_copy_query = 'SELECT
column_name, ' . PMA_backquote('comment') . ($cfgRelation['mimework'] ? ', mimetype, transformation, transformation_options' : '') . '
FROM ' . PMA_backquote($cfgRelation['column_info']) . '
FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
WHERE
db_name = \'' . PMA_sqlAddslashes($source_db) . '\' AND
table_name = \'' . PMA_sqlAddslashes($source_table) . '\'';
@@ -313,7 +313,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
// Write every comment as new copied entry. [MIME]
while ($comments_copy_row = PMA_DBI_fetch_assoc($comments_copy_rs)) {
$new_comment_query = 'REPLACE INTO ' . PMA_backquote($cfgRelation['column_info'])
$new_comment_query = 'REPLACE INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' (db_name, table_name, column_name, ' . PMA_backquote('comment') . ($cfgRelation['mimework'] ? ', mimetype, transformation, transformation_options' : '') . ') '
. ' VALUES('
. '\'' . PMA_sqlAddslashes($target_db) . '\','
@@ -397,7 +397,7 @@ function PMA_table_rename( $old_name, $new_name )
$cfgRelation = PMA_getRelationsParam();
if ( $cfgRelation['commwork'] ) {
$remove_query = '
UPDATE ' . PMA_backquote($cfgRelation['column_info']) . '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
SET table_name = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE db_name = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\'
AND table_name = \'' . PMA_sqlAddslashes($old_name) . '\'';
@@ -407,7 +407,7 @@ function PMA_table_rename( $old_name, $new_name )
if ( $cfgRelation['displaywork'] ) {
$table_query = '
UPDATE ' . PMA_backquote($cfgRelation['table_info']) . '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info']) . '
SET table_name = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE db_name = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\'
AND table_name = \'' . PMA_sqlAddslashes($old_name) . '\'';
@@ -417,14 +417,14 @@ function PMA_table_rename( $old_name, $new_name )
if ( $cfgRelation['relwork'] ) {
$table_query = '
UPDATE ' . PMA_backquote($cfgRelation['relation']) . '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation']) . '
SET foreign_table = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE foreign_db = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\'
AND foreign_table = \'' . PMA_sqlAddslashes($old_name) . '\'';
PMA_query_as_cu($table_query);
$table_query = '
UPDATE ' . PMA_backquote($cfgRelation['relation']) . '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation']) . '
SET master_table = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE master_db = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\'
AND master_table = \'' . PMA_sqlAddslashes($old_name) . '\'';
@@ -434,7 +434,7 @@ function PMA_table_rename( $old_name, $new_name )
if ( $cfgRelation['pdfwork'] ) {
$table_query = '
UPDATE ' . PMA_backquote($cfgRelation['table_coords']) . '
UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . '
SET table_name = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE db_name = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\'
AND table_name = \'' . PMA_sqlAddslashes($old_name) . '\'';

View File

@@ -95,7 +95,7 @@ function PMA_getAvailableMIMEtypes() {
function PMA_getMIME($db, $table, $strict = false) {
global $cfgRelation;
$com_qry = 'SELECT column_name, mimetype, transformation, transformation_options FROM ' . PMA_backquote($cfgRelation['column_info'])
$com_qry = 'SELECT column_name, mimetype, transformation, transformation_options FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND (mimetype != \'\'' . (!$strict ? ' OR transformation != \'\' OR transformation_options != \'\'' : '') . ')';
@@ -137,7 +137,7 @@ function PMA_getMIME($db, $table, $strict = false) {
function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $transformation_options, $forcedelete = false) {
global $cfgRelation;
$test_qry = 'SELECT mimetype, ' . PMA_backquote('comment') . ' FROM ' . PMA_backquote($cfgRelation['column_info'])
$test_qry = 'SELECT mimetype, ' . PMA_backquote('comment') . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
@@ -149,7 +149,7 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $transformat
unset($test_rs);
if (!$forcedelete && (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0 || strlen($row['comment']) > 0)) {
$upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['column_info'])
$upd_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' SET mimetype = \'' . PMA_sqlAddslashes($mimetype) . '\','
. ' transformation = \'' . PMA_sqlAddslashes($transformation) . '\','
. ' transformation_options = \'' . PMA_sqlAddslashes($transformation_options) . '\''
@@ -157,13 +157,13 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $transformat
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
} else {
$upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info'])
$upd_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
}
} else if (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0) {
$upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['column_info'])
$upd_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' (db_name, table_name, column_name, mimetype, transformation, transformation_options) '
. ' VALUES('
. '\'' . PMA_sqlAddslashes($db) . '\','

View File

@@ -57,12 +57,12 @@ if ($cfgRelation['pdfwork']) {
switch ($do) {
case 'choosepage':
if ($action_choose=="1") {
$ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
$ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND pdf_page_number = ' . $chpage;
PMA_query_as_cu($ch_query, FALSE, $query_default_option);
$ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
$ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND page_nr = ' . $chpage;
PMA_query_as_cu($ch_query, FALSE, $query_default_option);
@@ -74,7 +74,7 @@ if ($cfgRelation['pdfwork']) {
if (!isset($newpage) || $newpage == '') {
$newpage = $strNoDescription;
}
$ins_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['pdf_pages'])
$ins_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' (db_name, page_descr)'
. ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
PMA_query_as_cu($ins_query, FALSE, $query_default_option);
@@ -90,7 +90,7 @@ if ($cfgRelation['pdfwork']) {
// get the tables that have relations, by descending
// number of links
$master_tables = 'SELECT COUNT(master_table), master_table'
. ' FROM ' . PMA_backquote($cfgRelation['relation'])
. ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . $db . '\''
. ' GROUP BY master_table'
. ' ORDER BY ' . PMA_backquote('COUNT(master_table)') . ' DESC ';
@@ -135,7 +135,7 @@ if ($cfgRelation['pdfwork']) {
foreach ($all_tables AS $current_table) {
// save current table's coordinates
$insert_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_coords']) . ' '
$insert_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
. '(db_name, table_name, pdf_page_number, x, y) '
. 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($current_table) . '\',' . $pdf_page_number . ',' . $pos_x . ',' . $pos_y . ')';
PMA_query_as_cu($insert_query, FALSE, $query_default_option);
@@ -182,26 +182,26 @@ if ($cfgRelation['pdfwork']) {
$arrvalue['y'] = 0;
}
if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
$test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
$test_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
. ' AND pdf_page_number = ' . $chpage;
$test_rs = PMA_query_as_cu($test_query, FALSE, $query_default_option);
if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
$ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
$ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
. ' AND pdf_page_number = ' . $chpage;
} else {
$ch_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_coords']) . ' '
$ch_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
. 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
. ' AND pdf_page_number = ' . $chpage;
}
} else {
$ch_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_coords']) . ' '
$ch_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
. '(db_name, table_name, pdf_page_number, x, y) '
. 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
}
@@ -211,7 +211,7 @@ if ($cfgRelation['pdfwork']) {
break;
case 'deleteCrap':
foreach ($delrow AS $current_row) {
$d_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords']) . ' ' . "\n"
$d_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' ' . "\n"
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . "\n"
. ' AND table_name = \'' . PMA_sqlAddslashes($current_row) . '\'' . "\n"
. ' AND pdf_page_number = ' . $chpage;
@@ -229,7 +229,7 @@ if ($cfgRelation['pdfwork']) {
}
// Now first show some possibility to choose a page for the pdf
$page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
$page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$page_rs = PMA_query_as_cu($page_query, FALSE, $query_default_option);
@@ -285,7 +285,7 @@ if ($cfgRelation['pdfwork']) {
<h2><?php echo $strSelectTables ;?></h2>
<?php
$page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
$page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND pdf_page_number = ' . $chpage;
$page_rs = PMA_query_as_cu($page_query, FALSE, $query_default_option);

View File

@@ -316,7 +316,7 @@ class PMA_PDF extends PMA_FPDF
global $cfgRelation,$db,$pdf_page_number,$with_doc;
if ($with_doc){
$test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
$test_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND page_nr = \'' . $pdf_page_number . '\'';
$test_rs = PMA_query_as_cu($test_query);
@@ -709,7 +709,7 @@ class PMA_RT_Table
//x and y
$sql = 'SELECT x, y FROM '
. PMA_backquote($cfgRelation['table_coords'])
. PMA_backquote($GLOBALS['cfgRelation']['db']) . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table_name) . '\''
. ' AND pdf_page_number = ' . $pdf_page_number;
@@ -1046,7 +1046,7 @@ class PMA_RT
$pdf->SetLineWidth(0.2);
$pdf->SetDisplayMode('fullpage');
// Get the name of this pdfpage to use as filename (Mike Beck)
$_name_sql = 'SELECT page_descr FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
$_name_sql = 'SELECT page_descr FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE page_nr = ' . $pdf_page_number;
$_name_rs = PMA_query_as_cu($_name_sql);
if ($_name_rs) {
@@ -1116,7 +1116,7 @@ class PMA_RT
$pdf->SetAutoPageBreak('auto');
// Gets tables on this page
$tab_sql = 'SELECT table_name FROM ' . PMA_backquote($cfgRelation['table_coords'])
$tab_sql = 'SELECT table_name FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND pdf_page_number = ' . $which_rel;
$tab_rs = PMA_query_as_cu($tab_sql, NULL, PMA_DBI_QUERY_STORE);
@@ -1176,7 +1176,7 @@ class PMA_RT
$pdf->PMA_PDF_setFontSizeScale(14);
// $sql = 'SELECT * FROM ' . PMA_backquote($cfgRelation['relation'])
// $sql = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
// . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\' '
// . ' AND foreign_db = \'' . PMA_sqlAddslashes($db) . '\' '
// . ' AND master_table IN (' . $intable . ')'

View File

@@ -94,7 +94,7 @@ if (isset($do_save_data)) {
foreach ($field_orig AS $fieldindex => $fieldcontent) {
if ($field_name[$fieldindex] != $fieldcontent) {
if ($cfgRelation['displaywork']) {
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_info'])
$table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' SET display_field = \'' . PMA_sqlAddslashes($field_name[$fieldindex]) . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
@@ -105,7 +105,7 @@ if (isset($do_save_data)) {
}
if ($cfgRelation['relwork']) {
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['relation'])
$table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' SET master_field = \'' . PMA_sqlAddslashes($field_name[$fieldindex]) . '\''
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''
@@ -114,7 +114,7 @@ if (isset($do_save_data)) {
unset($table_query);
unset($tb_rs);
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['relation'])
$table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' SET foreign_field = \'' . PMA_sqlAddslashes($field_name[$fieldindex]) . '\''
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\''

View File

@@ -89,7 +89,7 @@ if (isset($destination) && $cfgRelation['relwork']) {
if ($foreign_string != 'nix') {
list($foreign_db, $foreign_table, $foreign_field) = explode('.', $foreign_string);
if (!isset($existrel[$master_field])) {
$upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['relation'])
$upd_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)'
. ' values('
. '\'' . PMA_sqlAddslashes($db) . '\', '
@@ -99,7 +99,7 @@ if (isset($destination) && $cfgRelation['relwork']) {
. '\'' . PMA_sqlAddslashes($foreign_table) . '\','
. '\'' . PMA_sqlAddslashes($foreign_field) . '\')';
} elseif ($existrel[$master_field]['foreign_db'] . '.' .$existrel[$master_field]['foreign_table'] . '.' . $existrel[$master_field]['foreign_field'] != $foreign_string) {
$upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['relation']) . ' SET'
$upd_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation']) . ' SET'
. ' foreign_db = \'' . PMA_sqlAddslashes($foreign_db) . '\', '
. ' foreign_table = \'' . PMA_sqlAddslashes($foreign_table) . '\', '
. ' foreign_field = \'' . PMA_sqlAddslashes($foreign_field) . '\' '
@@ -108,7 +108,7 @@ if (isset($destination) && $cfgRelation['relwork']) {
. ' AND master_field = \'' . PMA_sqlAddslashes($master_field) . '\'';
} // end if... else....
} elseif (isset($existrel[$master_field])) {
$upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
$upd_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND master_field = \'' . PMA_sqlAddslashes($master_field) . '\'';
@@ -220,17 +220,17 @@ if ($cfgRelation['displaywork']
if ($disp) {
if ($display_field != '') {
$upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_info'])
$upd_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' SET display_field = \'' . PMA_sqlAddslashes($display_field) . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
} else {
$upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info'])
$upd_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
}
} elseif ($display_field != '') {
$upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_info'])
$upd_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. '(db_name, table_name, display_field) '
. ' VALUES('
. '\'' . PMA_sqlAddslashes($db) . '\','