Default query can contain field names (RFE #948590, patch #961726).

This commit is contained in:
Michal Čihař
2004-05-28 14:08:32 +00:00
parent 8ed5e573fc
commit 566d4b4f33
4 changed files with 20 additions and 13 deletions

View File

@@ -8,6 +8,8 @@ $Source$
2004-05-28 Michal Čihař <michal@cihar.com>
* libraries/display_tbl.lib.php: Decrease limit for query truncating (see
comments in bug #951744).
* Documentation.html, config.inc.php, tbl_query_box.php: Default query can
contain field names (RFE #948590, patch #961726).
2004-05-26 Michal Čihař <michal@cihar.com>
* lang/norwegian: Update, thanks to Sven-Erik Andersen - sven-erik.

View File

@@ -1837,8 +1837,9 @@ Defaults to FALSE (drop-down). <br />
<dt><b>$cfg['DefaultQueryTable']</b> string</dt>
<dt><b>$cfg['DefaultQueryDatabase']</b> string</dt>
<dd>
Default query that will be displayed in query boxes, when user didn't
specify any. Use %d for database name and %t for table name.
Default queries that will be displayed in query boxes when user didn't
specify any. Use %d for database name, %t for table name and %f for a
comma separated list of field names.
<br /><br />
</dd>

View File

@@ -532,9 +532,10 @@ $cfg['ReplaceHelpImg'] = TRUE; // show help button instead of strDocume
/**
* Default queries.
* %d will be replaced by database name
* %t will be replaced by table name
* Default queries
* %d will be replaced by the database name.
* %t will be replaced by the table name.
* %f will be replaced by a list of field names.
*/
$cfg['DefaultQueryTable'] = 'SELECT * FROM %t WHERE 1';
$cfg['DefaultQueryDatabase'] = '';

View File

@@ -141,10 +141,13 @@ if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
<?php
if (! empty($query_to_display)) {
echo htmlspecialchars($query_to_display);
} elseif (isset($table)) {
echo htmlspecialchars(str_replace('%d', PMA_backquote($db), str_replace('%t', PMA_backquote($table), $cfg['DefaultQueryTable'])));
} else {
echo htmlspecialchars(str_replace('%d', PMA_backquote($db), $cfg['DefaultQueryDatabase']));
$query = str_replace('%d', PMA_backquote($db), $cfg['DefaultQueryDatabase']);
if (isset($table)) {
$query = str_replace('%f', implode(', ', PMA_backquote($fields_list)), $cfg['DefaultQueryTable']);
$query = str_replace('%t', PMA_backquote($table), $query);
}
echo htmlspecialchars($query);
}
?></textarea></td>
<?php if (isset($table) && $fields_cnt > 0) { ?>