LIMIT separator

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1494 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2010-04-26 16:19:26 +00:00
parent 4595348a14
commit 99a643b86e
5 changed files with 9 additions and 8 deletions

View file

@ -251,7 +251,7 @@ if (isset($_GET["mssql"])) {
return get_vals("EXEC sp_databases");
}
function limit($query, $limit, $offset = 0) {
function limit($query, $limit, $offset = 0, $separator = " ") {
return (isset($limit) ? " TOP (" . ($limit + $offset) . ")" : "") . " $query"; // seek later
}

View file

@ -260,10 +260,11 @@ if (!defined("DRIVER")) {
* @param string everything after SELECT
* @param int
* @param int
* @param string
* @return string
*/
function limit($query, $limit, $offset = 0) {
return " $query" . (isset($limit) ? "\nLIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
function limit($query, $limit, $offset = 0, $separator = " ") {
return " $query" . (isset($limit) ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
}
/** Formulate SQL modification query with limit 1

View file

@ -163,8 +163,8 @@ if (isset($_GET["pgsql"])) {
return get_vals("SELECT datname FROM pg_database");
}
function limit($query, $limit, $offset = 0) {
return " $query" . (isset($limit) ? "\nLIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
function limit($query, $limit, $offset = 0, $separator = " ") {
return " $query" . (isset($limit) ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
}
function limit1($query) {

View file

@ -211,8 +211,8 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
return array();
}
function limit($query, $limit, $offset = 0) {
return " $query" . (isset($limit) ? "\nLIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
function limit($query, $limit, $offset = 0, $separator = " ") {
return " $query" . (isset($limit) ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
}
function limit1($query) {

View file

@ -197,7 +197,7 @@ if (!$columns) {
$page = floor(($found_rows - 1) / $limit);
}
$query = "SELECT" . limit((intval($limit) && $group && count($group) < count($select) && $driver == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . $from . $group_by, ($limit != "" ? intval($limit) : null), ($page ? $limit * $page : 0));
$query = "SELECT" . limit((intval($limit) && $group && count($group) < count($select) && $driver == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . $from . $group_by, ($limit != "" ? intval($limit) : null), ($page ? $limit * $page : 0), "\n");
echo $adminer->selectQuery($query);
$result = $connection->query($query);