Permalink
Browse files

selectQueryBuild() method

  • Loading branch information...
vrana committed Aug 24, 2012
1 parent 5d337fe commit 700a78b37730a95c4657c3635695291fe14e9bc4
Showing with 28 additions and 1 deletion.
  1. +13 −0 adminer/include/adminer.inc.php
  2. +10 −1 adminer/select.inc.php
  3. +1 −0 changes.txt
  4. +4 −0 editor/include/adminer.inc.php
@@ -452,6 +452,19 @@ function selectEmailProcess($where, $foreignKeys) {
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
@@ -230,7 +230,16 @@
$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
@@ -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
@@ -411,6 +411,10 @@ function selectEmailProcess($where, $foreignKeys) {
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-->";
}

0 comments on commit 700a78b

Please sign in to comment.