Option 1: put this in your procedure to print a “comment” to stdout when it starts.
SELECT 'Comment';
Option 2: put this in your procedure to print the variable with it to stdout:
declare myvar INT default 0; SET myvar = 5; SELECT concat('myvar is ', myvar);
Sends myvar is 5 to stdout when the procedure executes.
Option 3: create a table with one text column called tmptable and click on the message:
declare myvar INT default 0; SET myvar = 5; insert into tmptable select concat('myvar is ', myvar);
You can put this in a stored procedure, so all you would need to write is the following:
CALL log(concat('the value is', myvar));
Which saves a few keystrokes.
Option 4, Write Messages to a File
select "penguin" as log into outfile '/tmp/result.txt';
This team has very severe restrictions. You can only write outfile in areas on the disk that give the group of "others" the ability to create and write permissions. It should work, saving it in the / tmp directory.
Also, once you write outfile, it cannot be overwritten. This is done in order to prevent crackers from rooting your box just because they had SQL that entered your site and could run arbitrary commands in MySQL.
Patrick Oct 23 '13 at 11:47 2013-10-23 11:47
source share