mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 15:47:00 +02:00
Separate queries(null)
This commit is contained in:
@@ -542,22 +542,21 @@ function query_redirect($query, $location, $message, $redirect = true, $execute
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Queries {
|
||||||
|
static $queries = array();
|
||||||
|
static $start;
|
||||||
|
}
|
||||||
|
|
||||||
/** Execute and remember query
|
/** Execute and remember query
|
||||||
* @param string or null to return remembered queries, end with ';' to use DELIMITER
|
* @param string end with ';' to use DELIMITER
|
||||||
* @return Result or [$queries, $time] if $query = null
|
* @return Result
|
||||||
*/
|
*/
|
||||||
function queries($query) {
|
function queries($query) {
|
||||||
global $connection;
|
global $connection;
|
||||||
static $queries = array();
|
if (!Queries::$start) {
|
||||||
static $start;
|
Queries::$start = microtime(true);
|
||||||
if (!$start) {
|
|
||||||
$start = microtime(true);
|
|
||||||
}
|
}
|
||||||
if ($query === null) {
|
Queries::$queries[] = (preg_match('~;$~', $query) ? "DELIMITER ;;\n$query;\nDELIMITER " : $query) . ";";
|
||||||
// return executed queries
|
|
||||||
return array(implode("\n", $queries), format_time($start));
|
|
||||||
}
|
|
||||||
$queries[] = (preg_match('~;$~', $query) ? "DELIMITER ;;\n$query;\nDELIMITER " : $query) . ";";
|
|
||||||
return $connection->query($query);
|
return $connection->query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,7 +582,8 @@ function apply_queries($query, $tables, $escape = 'Adminer\table') {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function queries_redirect($location, $message, $redirect) {
|
function queries_redirect($location, $message, $redirect) {
|
||||||
list($queries, $time) = queries(null);
|
$queries = implode("\n", Queries::$queries);
|
||||||
|
$time = format_time(Queries::$start);
|
||||||
return query_redirect($queries, $location, $message, $redirect, false, !$redirect, $time);
|
return query_redirect($queries, $location, $message, $redirect, false, !$redirect, $time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user