selectQueryBuild() method

This commit is contained in:
Jakub Vrana 2012-08-23 22:17:44 -07:00
parent 5d337fe04c
commit 700a78b377
4 changed files with 28 additions and 1 deletions

View file

@ -452,6 +452,19 @@ username.form['auth[driver]'].onchange();
return false;
}
/** Build SQL query used in select
* @param array result of selectColumnsProcess()[0]
* @param array result of selectSearchProcess()
* @param array result of selectColumnsProcess()[1]
* @param array result of selectOrderProcess()
* @param int result of selectLimitProcess()
* @param int index of page starting at zero
* @return string empty string to use default query
*/
function selectQueryBuild($select, $where, $group, $order, $limit, $page) {
return "";
}
/** Query printed after execution in the message
* @param string executed query
* @return string

View file

@ -230,7 +230,16 @@ if (!$columns) {
$page = floor(max(0, $found_rows - 1) / $limit);
}
$query = "SELECT" . limit((+$limit && $group && count($group) < count($select) && $jush == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . $from, ($where ? "\nWHERE " . implode(" AND ", $where) : "") . $group_by, ($limit != "" ? +$limit : null), ($page ? $limit * $page : 0), "\n");
$query = $adminer->selectQueryBuild($select, $where, $group, $order, $limit, $page);
if (!$query) {
$query = "SELECT" . limit(
(+$limit && $group && count($group) < count($select) && $jush == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . $from,
($where ? "\nWHERE " . implode(" AND ", $where) : "") . $group_by,
($limit != "" ? +$limit : null),
($page ? $limit * $page : 0),
"\n"
);
}
echo $adminer->selectQuery($query);
$result = $connection->query($query);

View file

@ -4,6 +4,7 @@ Edit strings with \n in textarea
Time out long running database list and select count
Use VALUES() in INSERT+UPDATE export
Style logout button as link
selectQueryBuild() method (customization)
Adminer 3.5.1 (released 2012-08-10):
Support same name fields in CSV export

View file

@ -411,6 +411,10 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
return false;
}
function selectQueryBuild($select, $where, $group, $order, $limit, $page) {
return "";
}
function messageQuery($query) {
return " <span class='time'>" . @date("H:i:s") . "</span><!--\n" . str_replace("--", "--><!-- ", $query) . "\n-->";
}