April 19, 2016 at 2:42 am #13526
Is there a keyboard shortcut that will comment out a selected section when I’m altering a Stored Proc? I need to do this to test various sections of the SP.
I tried Ctrl+Shift+C, but this doesn’t work when I save the SP – not sure what the purpose of this actually is.
I need to comment a section using “#”, but not fun if I have to manually do that for every line.
April 20, 2016 at 12:18 pm #35703
This is reproducible at our end. We are considering the implementation aspects for fixing this. Thanks in advance for your patience.
April 20, 2016 at 12:57 pm #35704
Please tell if commenting out using ‘#’ saves the Stored Procedure or not?
April 20, 2016 at 10:15 pm #35705
Yes, using ‘#’ in a Stored Proc is saved.
April 21, 2016 at 7:44 am #35706
I don’t think so that even putting a “#” would save the changes. Please check that there are two cases here that are possible. One is that you add comments to the SP and then close only the tab of SP and second is closing SQLyog altogether and opening again.
As you would know that the comments fall into metadata of a stored procedure, views, etc. MySQL does not save comments for the SP or views for that matter. You can check the information_schema for the data. The mysql documentation explains that here http://dev.mysql.com/doc/refman/5.0/en/views-table.html or running the query:
SHOW CREATE PROCEDURE
does not contain comments anywhere.
So in the first case where you close the SP tab without saving it in a .sql file there is no way server will remember the changes.
But in the second case where you close SQLyog the changes that you made to any editing tab, may it be SP or query editing the changes that you made will be saved due to Session restore that SQLyog offers. Please note here that SQLyog is saving whatever there is on the editor tab, not the server. So we cannot do much in this case.
April 22, 2016 at 12:34 am #35707
MySQL does store comments for Stored Procs. I checked information_schema > ROUTINES, and the comments appear in the ROUTINE_DEFINITION column. They also appear using SHOW CREATE PROCEDURE
I tried altering a Stored Proc using “#, “– ” and “/* … */”, they all saved OK.
However, I have tried again using Ctrl+Shift+C, and this time the section I commented was saved when I ran the ALTER Stored Proc, so I believe it was my error when I first tried it.
Topic closed, I think.
April 22, 2016 at 6:47 am #35708
Sorry there is a small correction. As you said MySQL does store the comments but only that lie inside the routine definition. If you have tried to comment anything outside the Routine definition, that is not being saved.
You must be logged in to reply to this topic.