Page 1 of 1

MySQL Should Support the 'ls' Command

Posted: Thu Jun 19, 2008 7:28 pm
by volomike
How many of you are like me, you connect to MySQL at <*gasp*> command line, and you type 'ls' once you've selected your database, only to get the wrong result, and then remember, duh, oh yea, 'supposed to use 'show tables' instead?

Is there a way to hook mysql command such that when I type:

ls;

it does a 'show tables' for me?

Re: MySQL Should Support the 'ls' Command

Posted: Sun Jun 22, 2008 2:12 am
by onion2k
You can with MySQL Proxy and some LUA scripting... http://datacharmer.blogspot.com/2007/06 ... proxy.html

The script has moved to http://forge.mysql.com/tools/tool.php?id=76

Re: MySQL Should Support the 'ls' Command

Posted: Sun Jun 22, 2008 3:16 am
by Kieran Huggins
You can code mysql functions in C as well... I've only added functions that were pre-written (levenshtein and the like), but you only need to do it once per server.

Re: MySQL Should Support the 'ls' Command

Posted: Sun Jun 22, 2008 3:29 am
by Weirdan
Kieran Huggins wrote:You can code mysql functions in C as well... I've only added functions that were pre-written (levenshtein and the like), but you only need to do it once per server.
Yeah, but those are only functions, and you need a statement here.

Re: MySQL Should Support the 'ls' Command

Posted: Sun Jun 22, 2008 7:09 am
by Kieran Huggins
Right you are!

Weirdan strikes again ;-)