The Little Things

Mar 30, 2009 / By Sheeri Cabral

Tags:

It’s always the little things in life. One of the things that has been a very “little thing” that causes a lot of frustration while writing The MySQL Administrator’s Bible is the prompt. Specifically, the fact that you can only change the first line of the prompt, but not the subsequent lines.


The default prompt that appears on the first line of the prompt is:
mysql>
The default (and unchangeable) second line of the prompt is four spaces followed by an ASCII arrow:

    ->

The second line of the prompt is hard-coded to match up very nicely with the first line in a fixed-width font:

mysql> SELECT
    -> 1+2;

However, you can change the prompt, which is pretty handy:

mysql> prompt \d: 
PROMPT set to '\d: '
(none): use test;
Database changed
test:

But remember, the second line of the prompt is unchangeable, which leads to a very ugly:

test: SELECT
    -> 1+2;

This may not seem like a big deal. But for people that copy and paste examples (such as people double-checking their own work, a technical editor, or a reader), they might think to change the prompt, so they can copy and paste examples:

test: prompt /* mysql */ 
PROMPT set to '/* mysql */ '
/* mysql */ SELECT 
    -> "If I could change the second line, then I could copy and paste multi-line examples!";

This should be an easy enough fix for the MySQL client. At the very least the prompt should default to something commented, in my opinion.

Perhaps the Drizzle folks (or XtraDB from Percona) will pick up on this idea and have a default of something commented.

4 Responses to “The Little Things”

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>