ActiveState Community

MySQL Shortcuts

Posted by tswicegood on 2007-03-21 20:08
OS: All / Any

Howdy all,

I recently downloaded Komodo to review IDEs and see if I could find one that would work well at staying out of my way. Part of what I've been working with recently is some SQL upgrade scripts which I'm constantly running portions of to test. I decided to check out Komodo's toolbox and see what it could do.

Enter the MySQL Shortcuts. This is a collection of run commands to execute the selected query(ies), execute the current file, get a number of rows via a derived table, get the results of an EXPLAIN command, and run a handful of admin functions against tables (SHOW CREATE, ANALYZE, OPTIMIZE, etc., etc.).

These assume that you have a 'mysql' executable of some sort or another in your path and it can be accessed via the command line. It just drops the selected text in the form of a query to mysql via the -e command or if nothing is selected, it will prompt you for a query. It makes the assumption that you're connecting to the localhost and that anonymous user access is enabled - both of which are easily changed by editing the command to meet your setup.

I found these useful, hope someone else does to. These are available under the new BSD, so feel free to edit, redistribute, and do with as you please.

AttachmentSize
MySQL Shortcuts.kpz6.66 KB

Dereckson | Thu, 2007-04-26 04:17

Hi, your extension could be useful.

A suggestion to improve it: an installer to customize the MySQL command, allowing us to specify -h -u -p ... arguments that package the customized .kpz

tswicegood | Thu, 2007-04-26 07:36

Hey,

Thanks for checking it out. I thought about how to handle that and decided that I'd leave that up to the individual person since the macros are in plain text. I could have done a better job documenting that though. Another area that it can pretty easily be customized is to specify a DB to use by default.

-Travis