1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-06 06:37:33 +02:00

New plugin: Specify query timeout

This commit is contained in:
Jakub Vrana
2025-06-28 22:11:03 +02:00
parent c9a52cd28c
commit 6dec0d63b0
10 changed files with 70 additions and 9 deletions

View File

@@ -340,7 +340,7 @@ if (!defined('Adminer\DRIVER')) {
function partitionsInfo(string $table): array {
$from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q(DB) . " AND TABLE_NAME = " . q($table);
$result = connection()->query("SELECT PARTITION_METHOD, PARTITION_EXPRESSION, PARTITION_ORDINAL_POSITION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");
$result = $this->conn->query("SELECT PARTITION_METHOD, PARTITION_EXPRESSION, PARTITION_ORDINAL_POSITION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");
$return = array();
list($return["partition_by"], $return["partition"], $return["partitions"]) = $result->fetch_row();
$partitions = get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $from AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");

View File

@@ -60,6 +60,10 @@ if (isset($_GET["oracle"])) {
}
return $return;
}
function timeout(int $ms): bool {
return oci_set_call_timeout($this->link, $ms);
}
}
class Result {

View File

@@ -85,6 +85,10 @@ class Adminer {
return 2;
}
/** Called after connecting and selecting a database */
function afterConnect(): void {
}
/** Headers to send before HTML output */
function headers(): void {
}

View File

@@ -108,3 +108,5 @@ include "../adminer/include/xxtea.inc.php";
include "../adminer/include/auth.inc.php";
include "./include/editing.inc.php";
include "./include/connect.inc.php";
adminer()->afterConnect();

View File

@@ -253,8 +253,7 @@ abstract class SqlDriver {
return !is_view($table_status);
}
/**
* Return list of supported index algorithms, first one is default
/** Return list of supported index algorithms, first one is default
* @param TableStatus $tableStatus
* @return list<string>
*/

View File

@@ -338,11 +338,11 @@ function get_settings(string $cookie): array {
}
/** Get setting stored in a cookie
* @param mixed $default
* @return mixed
*/
function get_setting(string $key, string $cookie = "adminer_settings") {
$settings = get_settings($cookie);
return $settings[$key];
function get_setting(string $key, string $cookie = "adminer_settings", $default = null) {
return idx(get_settings($cookie), $key, $default);
}
/** Store settings to a cookie