dbcli / mycli

A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting.
http://mycli.net
Other
11.41k stars 658 forks source link

Make favorite queries execute mycli's special commands #747

Open statox opened 5 years ago

statox commented 5 years ago

Hi everyone,

I'm not sure if this is a bug or if I'm missing something so I would appreciate some help:

I have a script file that I need to source regularly, using this command it works fine:

source /home/statox/projects/boilerplate/setup.sql

I tried to make it a favorite command with this command:

\fs setupkey source /home/statox/projects/boilerplate/setup.sql

And also by adding this line directly in my .myclirc:

[favorite_queries]
...
setupkey = 'source /home/statox/projects/boilerplate/setup.sql'

In both cases everything is fine (no startup error or anything) until I try to execute the command:

mysql user@localhost:newws> \f setupkey
(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'source /home/statox/projects/boilerplate/setup.sql' at line 1")

I am sure that my sql script works fine since I can execute it directly and my other favorite commands (which don't use source) all work fine so I don't know how to fix my issue and I didn't found a related issue yet.

Also mycli -v returns Version: 1.8.1

Anyway thank you for your great tool :+1:

tsroten commented 5 years ago

Hello @statox! I think you're right that the favorite queries don't support client-specific commands (e.g. source). I had started to add this awhile ago, but got sidetracked. Hopefully I can make the time soon to finish this up.

I think this is the only issue that is tracking this, so I'm going to rename it and label it.

Thanks for reporting this!