1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-20 05:11:25 +02:00

New plugin: AI prompt in SQL command creating the queries with Google Gemini

This commit is contained in:
Jakub Vrana
2025-03-23 07:34:33 +01:00
parent cf436d7317
commit 204176b33b
5 changed files with 72 additions and 1 deletions

View File

@@ -263,6 +263,11 @@ class Adminer {
return shorten_utf8(trim($query), 1000);
}
/** Print HTML code just before the Execute button in SQL command
*/
function sqlPrintAfter() {
}
/** Description of a row in a table
* @param string
* @return string SQL expression, empty string for no description

View File

@@ -245,6 +245,11 @@ class Plugins extends Adminer {
return $this->applyPlugin(__FUNCTION__, $args);
}
function sqlPrintAfter() {
$args = func_get_args();
return $this->applyPlugin(__FUNCTION__, $args);
}
function rowDescription($table) {
$args = func_get_args();
return $this->applyPlugin(__FUNCTION__, $args);

View File

@@ -235,7 +235,9 @@ if (!isset($_GET["import"])) {
echo "<p>";
textarea("query", $q, 20);
echo script(($_POST ? "" : "qs('textarea').focus();\n") . "qs('#form').onsubmit = partial(sqlSubmit, qs('#form'), '" . js_escape(remove_from_uri("sql|limit|error_stops|only_errors|history")) . "');");
echo "<p>$execute\n";
echo "<p>";
$adminer->sqlPrintAfter();
echo "$execute\n";
echo lang('Limit rows') . ": <input type='number' name='limit' class='size' value='" . h($_POST ? $_POST["limit"] : $_GET["limit"]) . "'>\n";
} else {