Stored Procs / Functions

Jun 27, 2012 at 8:25 PM

Are there any plans in the works to support backing up MySQL Stored Procedures and Functions?

Jun 27, 2012 at 9:46 PM

Hi, this is a good suggestion. This feature is added into the development work out list. We'll study and try to find a way to work it out.

By the way, do you have any ideas on how to do this? sample codes?


Jun 28, 2012 at 12:22 AM

I would like to have something to contribute, but no - I don't know how to do it or have any sample codes.

I'll try to do some research and see just how mysql stores functions / procs and see what I can do. 


Thank you!

Jun 28, 2012 at 1:15 AM

hopefully we can find the way. thanks for the suggestion. :)

Jun 28, 2012 at 1:37 PM

It looks like the information is stored in the TRIGGERS and ROUTINES tables in the information_schema. The action statement field for triggers and the routine definition field for procs / functions has text of the command. I am thinking that there is enough data present in those tables to dynamically generate the DROP FUNCTION IF NOT EXIST statements and the simply insert the remaining text from the aforementioned fields.


I'll give it a shot and see what happens.

Aug 13, 2012 at 7:39 AM

Hi, wsurritte_gs,

Version 1.4 is released with the ability to backup/restore triggers, stored procedure, function, events, views.

 I have tested it, but however, could you please help to verify that this version contains bugs or not. thanks.   


Aug 14, 2012 at 7:45 PM



Thank you for implementing it, I really appreciate it.  I am working on testing it at the moment. My initial impression is that it works ok, but due to the amount of routines our application uses, it will take a while to verify.


I did have to make one change to keep it from throwing an exception on my computer.

In MySqlBackup.cs I had to change

          sbData.Append(((byte)ob).ToString(nf) + ",");


            sbData.Append(Convert.ToByte(ob).ToString(nf) + ",");


on line 1194 - not sure why.


Best Regards,


Aug 17, 2012 at 7:07 AM

I'll take note of the byte to string conversion.

and thanks for your effort on the verification .

Aug 29, 2012 at 1:23 PM
Edited Aug 29, 2012 at 1:24 PM

Hi, the bug is fixed in V1.4.5

The error occur because of the wrong cast type. It should be cast as sbyte not byte.