adminer icon indicating copy to clipboard operation
adminer copied to clipboard

Gemini plugin is commenting out the SQL

Open tkohout opened this issue 9 months ago • 2 comments

Adminer version: 5.3.0 Compiled: single file Driver: MySQLi Database version: e.g. 10.2.12-MariaDB Plugins used: sql-gemini

I tried the SQL gemini plugin and it works great - very cool. The only problem I have that most of the time it returns the commented out SQL like this:

Image

It's not 100% consistent, sometimes it will return the sql correctly stripped.

Looking into the code, if I replace this line:

https://github.com/vrana/adminer/blob/master/plugins/sql-gemini.php#L44

with this code (just switching the position of the closing \n and */:

$text = preg_replace('~(\n|^)```sql\n(.+)\n```(\n|$)~sU', "*/\n\n\\2\n\n/*", "/*\n$text\n*/");

the stripping works well for me. I can do the PR but I wanted to check first to make sure I understand this 100%.

tkohout avatar May 05 '25 09:05 tkohout

~Also wanted to check with you whether you hardcoded the gemini key here on purpose: https://github.com/vrana/adminer/blob/master/plugins/sql-gemini.php#L19~

Nevermind - I read the comment.

tkohout avatar May 05 '25 09:05 tkohout

Feel free to create a pull request.

vrana avatar May 05 '25 14:05 vrana