Howdy All,

The MySQL Reference Manual lists 2 limitations on the way the mysql client
parses /* ...  */ comments, these being:

      Single-quote and double-quote characters are taken to indicate the
beginning of a quoted string, even within a comment.
      If the quote is not matched by a second quote within the comment, the
parser doesn't realise the comment has ended.
      If you are running mysql interactively, you can tell that it has gotten
confused like this because the prompt changes from mysql> to '> or ">.

     A semicolon is taken to indicate the end of the current SQL statement and
anything following it to indicate the beginning of the next statement.
     (Section 6.1.6 Comment Syntax)

I would like to suggest that a third condition be included in this list. It
seems that either of the other 2 comment characters, *  --  * or  *  #  *  are
also
recognized by the parser within /*  ...  */.

I discovered this by accident when running a database / table creation script.
Within the SQL statements creating one table, a comment line such as
this appeared:  /* some words here -- is this field related to foo?  */.  Next
came several field / attribute statements that were syntactically correct,
followed by
another comment:  /* some more words here  */.  The script ran without error,
but the fields between these two comments were not created. Apparently
the parser recognized the double-dash-and-space within the first  /* ...  */ ,
commented out the closing  */ of the first comment,  and everything else until
the closing   */
of the second comment.  I then experimented with the * # * character and found
that the same behavior occurred.

I know it's never a good idea to nest comments. And now I really know it's never
 a good idea to nest comments. Some of us are just slow learners.

David Giragosian, Psy.D.
MD Anderson Cancer Center
Houston, Texas



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to