MySql.Data.VisualStudio.StoredProcedureNode.Save C# (CSharp) Method

Save() protected method

We override save here so we can change the sql from create to alter on first save
protected Save ( ) : bool
return bool
        protected override bool Save()
        {
            // since MySQL doesn't support altering the body of a proc we have
            // to do some "magic"

            try
            {
                string sql = editor.Text.Trim();
                if (!IsNew)
                {
                    // first we need to check the syntax of our changes.  THis will throw
                    // an exception if the syntax is bad
                    CheckSyntax();

                    sql = ChangeSqlTypeTo(editor.Text.Trim(), "CREATE");
                    ExecuteSQL(GetDropSQL(Name));
                }
                ExecuteSQL(sql);
                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "MySQL", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
        }