views:

9

answers:

1

Hi guys! I have searched for the answer to this one and haven't found it. I think it's simple. We have several users on our system that are (via programmatic methodology) using the same user id to run MySQL commands. I have been tasked with storing the user environment variable when these commands are ran.

I guess my question is this: can one send comments along with a MySQL query ? I am aware that you can store comments about tables and that sort of stuff. The goal here is to be able to look at any given query from the log and see who executed it from the comments being sent along with the query/select/etc etc. (Of course the best idea would be to not use the same dang user for MySQL but unfortunately I can't change that).

Shelly

A: 

Yes.

"MySQL Server supports three comment styles:

From a “#” character to the end of the line.

From a “--” sequence to the end of the line. In MySQL, the “--” (double-dash) comment style requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on). This syntax differs slightly from standard SQL comment syntax, as discussed in Section 1.8.5.5, “'--' as the Start of a Comment”.

From a /* sequence to the following */ sequence, as in the C programming language. This syntax enables a comment to extend over multiple lines because the beginning and closing sequences need not be on the same line."

Keep in mind that comments in this format, /*!12345 ... */, are not stored on the server.

http://dev.mysql.com/doc/refman/5.1/en/comments.html

Paul McMillan
You are the best Paul! S.O. is such a great place to get these answers and my apologies for what was a fairly simple question. Probably need to work on my Googling skills a lot more. :-).. Shelly
Michelle Bobek
Glad to get you a quick and complete answer :)
Paul McMillan