Beispiel #1
0
        /// <summary> Returns test results for the existence of stored procedure 'procedure' on 'cmd' connection's database in use.
        /// <para> If 'procedure' does not exist, an attempt is made to create it from this connection's database. </para>
        /// <para> Error messages are stored in .Message </para>
        /// </summary>
        /// <param name="cmd"></param>
        /// <param name="procedure"></param>
        /// <returns></returns>
        public bool ProcedureExists(VEDatabase cmd, string procedure)
        {
            bool exists = cmd.StoredProcedureExists(procedure);

            if (!exists)
            {
                string text = RetrieveProcedureTextString(procedure);

                if (text.Length == 0)
                {
                    message = string.Format("VEDataAdmin.ProcedureExists: Unable to create procedure '{0}' from this connection's database [{1}]", procedure, DataControl.Connection);
                }
                else
                {
                    cmd.Execute(text);

                    if (!(exists = cmd.StoredProcedureExists(procedure)))
                    {
                        message = string.Format("VEDataAdminProcedureExists: An error occurred trying to create procedure '{0}' on {1}", procedure, cmd.DataControl.Connection);
                    }
                }
            }

            return(exists);
        }
Beispiel #2
0
 public void DropProcedure(VEDatabase cmd, string procedure)
 {
     if (cmd.StoredProcedureExists(procedure))
     {
         cmd.DropProcedure(procedure);
     }
 }